RegisterForAnimationEvent - Form

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: ActiveMagicEffect Script, Alias Script, and Form Script

Registers this active magic effect/alias/form for the specified animation event on the specified reference. The event will only go to the specific effect, alias, or form that registered and will not be relayed to attached aliases or effects.

Syntax[edit | edit source]

bool Function RegisterForAnimationEvent(ObjectReference akSender, string asEventName) native

Parameters[edit | edit source]

  • akSender: The ObjectReference we want animation events from.
  • asEventName: The event we want from the object.

Return Value[edit | edit source]

Returns True if it was successfully able to register for the event. If false, something went wrong (the animation graph may not be loaded quite yet)

Examples[edit | edit source]

; Listen for the "reset" animation event from the object we are attached to
If (!RegisterForAnimationEvent(self, "reset"))
  Debug.Trace("Failed to register for event!")
EndIf


; sounds triggered by an animation can also be called for an event registration
Function UpdateAnims()
    RegisterForAnimationEvent(PlayerREF, "Soundplay.NPCHumanPickAxe") 
EndFunction

Notes[edit | edit source]

  • Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
  • Changing race can also stop an animation event from being registered on an alias.
  • 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.
  • As v1.4.23 of the CK, not every Animation can be registered. Only some animations that related to vanilla Quests can be registered and called via OnAnimationEvent. Some working Animations are:
    • SetRace
    • IdleFurnitureExit
    • T02Ascend
  • Animation events are almost always made up of a group of animations (ex: start sit chair, sit, start sit exit)and often these parts can be called as the event
  • Animation events also include sounds which themselves can be called as the event in question (ex: "Soundplay.NPCHumanPickAxe" can be called as an animation event and the pick axe sound will trigger the event)

See Also[edit | edit source]