Difference between revisions of "OnAnimationEvent - Form"

806 bytes added ,  20:19, 4 February 2015
m
linked event as it was a bit hard to find and confusing what it was referring to.
imported>Antares
(→‎Notes: Slight update to info RE: valid animation events.)
imported>Gezegond
m (linked event as it was a bit hard to find and confusing what it was referring to.)
 
(4 intermediate revisions by 2 users not shown)
Line 13: Line 13:
== Parameters ==
== Parameters ==
*akSource: The [[ObjectReference Script|ObjectReference]] that sent the event.
*akSource: The [[ObjectReference Script|ObjectReference]] that sent the event.
*asEventName: The event that was received.
*asEventName: The [[Animation Events|event]] that was received.


== Examples ==
== Examples ==
Line 25: Line 25:
     Debug.Trace("We got the reset animation graph event from ourselves that we were looking for!")
     Debug.Trace("We got the reset animation graph event from ourselves that we were looking for!")
   endIf
   endIf
endEvent
</source>
=== Another example: checking events through script ===
<source lang="papyrus">
Scriptname DetectCastEventScript extends Quest
Event OnInit()
    RegisterForAnimationEvent(Game.GetPlayer(), "BeginCastRight")
    RegisterForAnimationEvent(Game.GetPlayer(), "BeginCastLeft")
    RegisterForAnimationEvent(Game.GetPlayer(), "MRh_SpellFire_Event")
endEvent
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
if (akSource == Game.GetPlayer()) && (asEventName == "BeginCastRight")
  Debug.MessageBox("BeginCastRight Registered!")
endIf
if (akSource == Game.GetPlayer()) && (asEventName ==  "MRh_SpellFire_Event")
  Debug.MessageBox("SpellFire_Event Registered!")
endIf
endEvent
endEvent
</source>
</source>
Line 32: Line 54:
*This event is '''not''' relayed to any aliases or magic effects attached to the form.
*This event is '''not''' relayed to any aliases or magic effects attached to the form.
*This event '''is''' relayed to other scripts attached to the same object.  eg. On a quest form with 2 main quest scripts and a fragment script,  an update event registered by one will be received by all three.
*This event '''is''' relayed to other scripts attached to the same object.  eg. On a quest form with 2 main quest scripts and a fragment script,  an update event registered by one will be received by all three.
*The game will allow you to register ANY animation event, valid or invalid. Though they may register successfully not all of them will necessarily generate events. See the discussion page for more information.
*The game will allow you to register ANY animation event, valid or invalid. Though they may register successfully not all of them will necessarily generate events. [[Talk:RegisterForAnimationEvent_-_Form|See the discussion page for more information.]]


== See Also ==
== See Also ==
Line 40: Line 62:
*[[RegisterForAnimationEvent - Form]]
*[[RegisterForAnimationEvent - Form]]
*[[UnregisterForAnimationEvent - Form]]
*[[UnregisterForAnimationEvent - Form]]
*[[Animation Events]]
Anonymous user