Help with onDying() Script

Post » Sat Apr 13, 2013 10:34 am

Hey all,

I am relatively new to modding (a total newbie when it comes to scripting) and hoping someone might have some helpful advice.

I am trying to figure out how to make an arrow which causes its target to explode - but only after it dies.

I've got the ammo > projectile > explosion > enchantment > magic effect sequence down pat. Ultimately the magic effect applies a Script to the target. The problem I have is that while I think the script is getting attached to the target, the target will not explode once it dies.

The script that I am using is based upon the script for a Flame Atronach. The script does appear to work as far as the OnEffectStart event. I get the debug notifications and the explosion works at that point when testing. I cannot seem to get the OnDying event to ever fire.

Below is the script that I am using. Does anyone have any suggestions? I figure there is something subtle that I am missing. Thanks in advance!

Scriptname gbobDeathExplosion extends ActiveMagicEffect;===============================================import utilityimport form;===============================================Actor selfRefexplosion property DeathExplosion autoFloat HealthEVENT OnEffectStart(Actor akTarget, Actor akCaster)  Health = selfRef.GetActorValue("Health")  debug.notification("death explosion added to " + akTarget + " health=" + Health)  selfRef = akTarget   ;selfRef.placeAtMe(DeathExplosion)ENDEVENTEvent OnEffectFinish(Actor akTarget, Actor akCaster)ENDEVENTEVENT onDying(actor myKiller)  Health = selfRef.GetActorValue("Health")  if Health > 0   debug.notification("dying - not dead yet - " + Health)  elseIf Health <= 0   debug.notification("death - should explode now" + selfRef)   wait(3.0)   selfRef.placeAtMe(DeathExplosion)  endifENDEVENT
User avatar
SaVino GοΜ
 
Posts: 3360
Joined: Mon Sep 17, 2007 8:00 pm

Return to V - Skyrim