Background for Skyrim SE
Member of the Form script
boolfunctionRegisterForAnimationEvent(ObjectReferenceakSender, stringasEventName)Native

Description

Wiki Description

Registers this active magic effect/alias/form for the specified Form.OnAnimationEvent(...) 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.

Documentation Comment

Register for the specified animation event from the specified object - returns true if it successfully registered


Caveats

CK Wiki - Notes

  • 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 Form.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)


Parameters

  1. ObjectReferenceakSender

    CK Wiki Description

    The ObjectReference we want animation events from.

  2. stringasEventName

    CK Wiki Description

    The event we want from the object.


Examples

; 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

Auto-Generated Example

ObjectReference myObjectReference__akSender
string myString__asEventName

bool returnedValue = myForm__toCallFunctionOn.RegisterForAnimationEvent(myObjectReference__akSender, myString__asEventName)

Related Pages


Additional References

View this function’s page on the Skyrim Creation Kit Wiki

Some data provided by the Skyrim Creation Kit Wiki. Licensed under the Creative Commons Attribution-ShareAlike license.