Jump to content

[LE] registerForAnimationEvent() failure


Recommended Posts

I've been trying to figure out basic animation event detection.

 

I've created a spell that runs a script on the target. It's all working fine, up until the point where I try to register for the animation event. It is failing to register and I don't know why.

 

I would appreciate if anyone could have a look at the quoted code and see if I've missed something obvious.

scriptname testAnimationScript extends activeMagicEffect

actor targetReference = None

event onEffectStart(actor akTarget, actor akCaster)
  targetReference = akTarget
  if (registerForAnimationEvent(targetReference, "GetupEnd"))
    debug.sendAnimationEvent(targetReference, "GetupBegin")
  else
    debug.messagebox("registerForAnimationEvent() failed")
  endIf
endEvent

event onAnimationEvent(objectReference akSource, string asEventName)
  if (akSource == targetReference && asEventName == "GetupEnd")
    UnRegisterForAnimationEvent(targetReference, "GetupEnd")
    debug.messageBox("Animation end detected.")
  endIf
endEvent
Edited by dolandemort
Link to comment
Share on other sites

After some weeping and grinding of teeth, I found out the problem was that I had set the "No duration" tick box on the script spell effect UI. I think what was happening was the effect was ending too quickly. I read somewhere that when magic effects expire, they unregister any animation events they registered for automatically. As far as I can tell, the problem had something to do with this. Hope this helps any people reading this from the future.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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