Jump to content

Script isn't running- help please!


amblingalong

Recommended Posts

Can someone help me make sense of this? The idea is that when a weapon kill an enemy, the enemy is resurrected as a Dead Thrall (the actual enchantment adds a 10% chance of that happening, as well as some other requirements, but that isn't relevant to the script). For some reason, however, it doesn't seem to be working. I'm hoping someone will be able to help me troubleshoot. Thanks in advance!

 

Scriptname EncEldingarEffectScript extends ActiveMagicEffect  

Spell Property Revenant Auto

Event OnDeath (Actor akKiller)

Actor TargetActor = GetTargetActor()

Utility.Wait(2)

Revenant.cast (TargetActor, akTarget = TargetActor)

EndEvent

Edited by amblingalong
Link to comment
Share on other sites

Hmmm...

i took me a while to understand this, cause i dont know what

DeadThrall.cast(TargetActor, akTarget = TargetActor)

does. I guess it is not important for this matter ..

 

So from a logical point of view, i would reanimate dead, instead of dying ;)

 

Event OnDeath() 
  ;something got killed
Actor TargetActor = GetTargetActor()
  ;Target, what got killed
DeadThrall.cast(TargetActor, akTarget = TargetActor)
  ;cast DeadThrall on the target that died, akTarget is btw the same target again

 

Did i get it right? :)

Link to comment
Share on other sites

Does it give you any errors on compile or it just doesn't resurrect the enemy ?

Btw, I get the feeling the GetTargetActor() isn't used right...

I would try something like that :

 

Scriptname EncEldingarEffectScript extends ActiveMagicEffect 

Spell Property Revenant Auto

Event OnEffectStart(Actor Target, Actor Caster)

 Utility.Wait(10)

 if Target.IsDead() == true
   Revenant.cast(Caster, Target)
 endif

EndEvent 

Edited by darkylord
Link to comment
Share on other sites

Does it give you any errors on compile or it just doesn't resurrect the enemy ?

Btw, I get the feeling the GetTargetActor() isn't used right...

I would try something like that :

 

Scriptname EncEldingarEffectScript extends ActiveMagicEffect 

Spell Property Revenant Auto

Event OnEffectStart(Actor Target, Actor Caster)

 Utility.Wait(10)

 if Target.IsDead() == true
   Revenant.cast(Caster, Target)
 endif

EndEvent 

 

Thanks for the suggestions! The targetactor seems to be working correctly, since the game logs are showing that the spell was cast on the correct NPC. It's very odd; basically, after they are killed, the 'raise dead' spell-casting animation plays and they shimmer purple (as undead do while you're raising them, usually) and then... nothing, they just lie there. No errors, nothing. The reason I have them casting on themselves is because I'm not sure how else to ensure that the spell won't be blocked by the level scenery, and because visually I don't want to have the player casting raise dead on them.

 

Did you change the eventtype from OnDying to OnDeath?

 

I did; it wasn't casting because the spell was reading the NPC in the process of dying as alive, and therefore an invalid target.

 

I'm really appreciating the help!

Edited by amblingalong
Link to comment
Share on other sites

That could be the reason it doesn't work. It's possible they can't cast this to themselves so you probably have to make the user of the item been the caster of the spell too.

 

Hmmmm... I wonder if there is a way to do this without having the visual effect of the player casting the spell, because I really want it to look like they're rising as a result of the weapon hit. I'll give it a shot and let you know what happens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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