Difference between revisions of "OnTriggerEnter - ObjectReference"
Jump to navigation
Jump to search
imported>Terra Nova2 m (→Notes: typos) |
imported>Thorskin (→Notes) |
||
Line 45: | Line 45: | ||
EndEvent | EndEvent | ||
</source> | </source> | ||
*If you set a trigger around a teleport door marker this event will fire for the player but not for NPCs. | |||
== See Also == | == See Also == |
Revision as of 08:32, 22 July 2016
Member of: ObjectReference Script (Papyrus)
Event called when the object reference is a trigger volume and has been entered.
Syntax
Event OnTriggerEnter(ObjectReference akActionRef)
Parameters
- akActionRef: The ObjectReference that entered the volume.
Examples
Event OnTriggerEnter(ObjectReference akActionRef)
Debug.Trace(akActionRef + " just entered us!")
EndEvent
Notes
- This event can be received out of order with OnTriggerLeave, so it's ideal to keep a count instead of a simple true/false value for when things are inside the trigger.
Int InTrigger = 0
Event OnTriggerEnter(ObjectReference akTriggerRef)
if (InTrigger == 0)
if akTriggerRef == Game.GetPlayer()
InTrigger += 1
debug.notification("Entered Trigger")
endif
endif
EndEvent
Event OnTriggerLeave(ObjectReference akTriggerRef)
if (InTrigger > 0)
if akTriggerRef == Game.GetPlayer()
InTrigger -= 1
debug.notification("Leaving Trigger")
endif
endif
EndEvent
- If you set a trigger around a teleport door marker this event will fire for the player but not for NPCs.