Jump to content

Recommended Posts

Posted

Hey everyone,

 

So I'm not great with scripting and the CK is being a pain. I'm trying to create a simple mod that will reanimate an undead and then interrupt the raising by disintegrating them midway through the animation process.

 

I've mucked around with some AI help and this is what I have so far:

Quote

 

Scriptname ReanimateThenDisintegrateScript extends ActiveMagicEffect

Spell Property ReanimateSpell Auto
EffectShader Property DisintegrateFX Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)

    If akTarget == None
        Return
    EndIf

    ; If target is already dead
    If akTarget.IsDead()
        ReanimateAndDestroy(akTarget)
        Return
    EndIf

    ; If target is alive, wait for death
    RegisterForSingleUpdate(1.0)

EndEvent


Event OnUpdate()

    Actor target = GetTargetActor()

    If target == None
        Return
    EndIf

    If target.IsDead()
        ReanimateAndDestroy(target)
    Else
        ; Keep checking until dead
        RegisterForSingleUpdate(1.0)
    EndIf

EndEvent


Function ReanimateAndDestroy(Actor target)

    ; Cast vanilla reanimate spell
    If ReanimateSpell != None
        ReanimateSpell.Cast(GetCasterActor(), target)
    EndIf

    ; Wait during rising animation
    Utility.Wait(2.5)

    ; Play disintegration shader if assigned
    If DisintegrateFX != None
        target.PlayEffectShader(DisintegrateFX, 2.0)
    EndIf

    Utility.Wait(1.5)

    ; Force ash pile
    target.KillEssential(GetCasterActor())
    target.SetCriticalStage(target.CritStage_DisintegrateStart)

EndFunction

 

 

If anyone could use this to make a spell (or let me know if something in the script is wrong), I would really appreciate it. Thanks!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...