RegisterForAnimationEvent - ScriptObject

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: ScriptObject

Registers this active magic effect/alias/form for the specified animation event on the specified reference.

Only the script that registers for an event will receive it. Other scripts attached to the same form, alias, or magic effect will not receive the event unless they also register for it.

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

Notes[edit | edit source]

  • The reference in question must have loaded 3D, otherwise this function will fail
  • Aliases and quests will automatically unregister for this event when the quest stops.
  • Active magic effects will automatically unregister when they are removed.
  • Animation events are always unregistered when the target animation graph unloads. Anything registered will automaticallly get the OnAnimationEventUnregistered event when this happens.

See Also[edit | edit source]