Mod:Creation Kit/RegisterForDistanceLessThanEvent - ScriptObject

Member of: ScriptObject

Registers this script to receive a single OnDistanceLessThan event when two objects are closer than the specified distance apart. If the objects are already that close, 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.

Syntax
Function RegisterForDistanceLessThanEvent(ScriptObject akObj1, ScriptObject akObj2, float afDistance) native

Parameters

 * akObj1: The first object to check distance with. (Must be an ObjectReference or ReferenceAlias)
 * akObj2: The second object to check distance with. (Must be an ObjectReference or ReferenceAlias)
 * afDistance: How close the objects must be before the event is sent

Return Value
None

Examples
RegisterForDistanceLessThanEvent(Me, Stalker, 100.0)
 * Register for an event when the stalker is closer then 100 units from me