Jump to content

[LE] Reanimation Scripting


AshPtMods

Recommended Posts

Hi folks! I was hoping to get some help on a mod i'm working on. I would like to have an npc resurrect (as hostile) every time it is killed. So far I have only managed to make an npc resurrect Once (Similar to the skeletons of Dark Souls) but unfortunately if it is killed a second time, It remains dead.

The effect is applied through a perk entry (Apply Combat hit spell)

 

This is the script i'm currently using: (Copied from the Soul tear magic effect "DLC01_SoulTearWaitForDeathFX")

 

 

  Reveal hidden contents

I have tried playing around with the "IsReanimatedAlready" lines but to no avail.
So, Two things I'd like to know and have help with is:
1. How would I make the target resurrect every time it is killed.
2. How would I increase the wait time before it is resurrected (Right now they reanimate immediately after being killed. I would like to extend this time to about 10-15 seconds)
Thanks for your help folks!
UPDATE: Applied the script which dylbill suggested directly to a draugr actor using the "dunReanimateSelf" spell and it works. The draugr reanimated itself and began attacking me once more. Just need to figure out a way for the script to repeat itself.
Update 2: Cracked it! After a couple of hours of tweaking I have found that all I needed to do was change the "OnDeath" Event to "OnDying" and Voila. Dylbill, I can't thank you enough!
Edited by ashpt
Link to comment
Share on other sites

I would keep it simple and put a new script directly on your NPC. Something like this:

Scriptname TM_ActorScript extends Actor 

Spell property SpellRef auto
{The name of the Reanimate Spell. (REQUIRED!)}

Float Property WaitTime Auto 
{Set amount of time in seconds after death to reanimate}

Event OnDeath(Actor akKiller) 
    Utility.Wait(WaitTime)
    SpellRef.Cast(self, self) ;this actor casts the reanimate spell on themself 
EndEvent

Change the scriptname to something else.

Link to comment
Share on other sites

Thanks for the quick response. The script is working like a charm! The only problem I have now is that it only fires once. I would like for it to trigger every time the target is killed. Any Ideas on that one? Thanks again, you've been a great help.

Link to comment
Share on other sites

If that's the case, I suppect the OnDeath event isn't firing for the reanimated actor. To get around this, also try putting the resurrect function in the script:

 

Spell property SpellRef auto
{The name of the Reanimate Spell. (REQUIRED!)}

Float Property WaitTime Auto 
{Set amount of time in seconds after death to reanimate}

Event OnDeath(Actor akKiller) 
    Utility.Wait(WaitTime)
    SpellRef.Cast(self, self) ;this actor casts the reanimate spell on themself 
    Utility.Wait(2) 
    Self.Resurrect()
EndEvent
Link to comment
Share on other sites

  On 12/2/2021 at 2:18 PM, dylbill said:

 

If that's the case, I suppect the OnDeath event isn't firing for the reanimated actor. To get around this, also try putting the resurrect function in the script:

 

Spell property SpellRef auto
{The name of the Reanimate Spell. (REQUIRED!)}

Float Property WaitTime Auto 
{Set amount of time in seconds after death to reanimate}

Event OnDeath(Actor akKiller) 
    Utility.Wait(WaitTime)
    SpellRef.Cast(self, self) ;this actor casts the reanimate spell on themself 
    Utility.Wait(2) 
    Self.Resurrect()
EndEvent

All done Thanks my friend! All I did was change the OnDeath to OnDying and I've got the result I wanted. The Draugr kept reviving. Thank you again!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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