Background for Fallout 4
Member of the ScriptObject script
voidfunctionRegisterForCustomEvent(ScriptObjectakSender, stringasEventName)Native

[DEV SERVER] Loading description...


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)
EndEvent

Auto-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

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.