Description
Wiki Description
Registers this script to receive a single OnDistanceGreaterThan event when two objects are farther then the specified distance apart. If the objects are already that far apart, the event will be sent immediately.
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.
Documentation Comment
Register for OnDistanceFar when the two objects are greater than then afDistance apart. The two objects are interchangable,
and if you register for the two swapped it will simply update the distance. The objects may be reference or reference aliases.
Caveats
CK Wiki - Notes
- The form that this function is called on doesn't have to be either object. In this way you could have a quest that gets distance events from between the player and a quest objective.
- The two object parameters are interchangeable. If you re-register for a distance greater than event using the same two objects in a different order, your current registration will simply be updated with the new distance.
- A script can only be registered for one distance greater than event per object pair. If you register for another one, the distance will be updated. You can, however, register for a distance less than event between the same pair without affecting this registration.
- Aliases and quests will automatically unregister for this event when the quest stops. Active magic effects will automatically unregister when they are removed.
Parameters
ScriptObjectakObj1
CK Wiki Description
The first object to check distance with. (Must be an ObjectReference or ReferenceAlias)
ScriptObjectakObj2
CK Wiki Description
The second object to check distance with. (Must be an ObjectReference or ReferenceAlias)
floatafDistance
CK Wiki Description
How far apart the objects must be before the event is sent
Examples
; Register for an event when the father is farther than 1000 game units from the child or more
RegisterForDistanceGreaterThanEvent(Child, Father, 1000.0)Auto-Generated Example
ScriptObject myScriptObject__akObj1
ScriptObject myScriptObject__akObj2
float myFloat__afDistance
myScriptObject__toCallFunctionOn.RegisterForDistanceGreaterThanEvent(myScriptObject__akObj1, myScriptObject__akObj2, myFloat__afDistance)Related Pages
Additional References
View this function’s page on the Fallout 4 Creation Kit Wiki
