Description
Wiki Description
Registers this script to receive the specified custom event from the source object whenever that source object sends the event. The event will be relayed only to this script and will not be sent to other scripts attached to the same object, or to any aliases or magic effects attached to the object.
Documentation Comment
Register for a custom event to be sent from the specified sender. The event will be sent to:
Event .( akSender, Var[] akParams)
For example, MySpecialEvent on MyQuest would be:
Event MyQuest.MySpecialEvent(MyQuest akSender, Var[] akParams)
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.
- The object type in the custom event definition must be the script where the event was originally defined. For example, if the AmbushTriggerScript sends the Ambush event, you must use that and not ObjectReference, which doesn't define the event.
Parameters
ScriptObjectakSender
CK Wiki Description
The ScriptObject that receives the event we want to also receive.
stringasEventName
CK Wiki Description
The event we want relayed to us. This must be a raw string literal and may not be a variable.
Examples
; AmbushTriggerScript defines the Ambush custom event
AmbushTriggerScript Property kTrigger Auto Const
Event OnInit()
; Register for Ambush event from the trigger - note the trigger type is the script type that defines the event
RegisterForCustomEvent(kTrigger, "Ambush")
EndEvent
; Special event to receive when the ambush event is received from a AmbushTriggerScript script
; Note the type in the event name matches the type of the first parameter, and is also the script where the
; custom event is defined.
Event AmbushTriggerScript.Ambush(AmbushTriggerScript akSender, Var[] akArgs)
Debug.Trace("We received the ambush event from " + akSender + " with arguments " + akArgs)
EndEventAuto-Generated Example
ScriptObject myScriptObject__akSender
CustomEventName (string[]) myCustomEventName (string[])__asEventName
myScriptObject__toCallFunctionOn.RegisterForCustomEvent(myScriptObject__akSender, myCustomEventName (string[])__asEventName)Related Pages
Additional References
View this function’s page on the Fallout 4 Creation Kit Wiki
