Difference between revisions of "OnTriggerEnter - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Heecf
imported>Rasikko
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
OPPOSITE BLOCK.
[[Category:Scripting]]
[[Category:Papyrus]]
[[Category:Events]]
'''Member of:''' [[ObjectReference Script (Papyrus)]]


UNBLOCK.
Event called when the object reference is a trigger volume and has been entered.


UNBLOCK IS OPPOSITE BLOCK.
== Syntax ==
<source lang="papyrus">
Event OnTriggerEnter(ObjectReference akActionRef)
</source>


UNBLOCK IS UNBLOCK.
== Parameters ==
*akActionRef: The [[ObjectReference Script (Papyrus)|ObjectReference]] that entered the volume.


PRIVATE BLOCK.
== Examples ==
<source lang="papyrus">
Event OnTriggerEnter(ObjectReference akActionRef)
  Debug.Trace(akActionRef + " just entered us!")
EndEvent
</source>


SECRET BLOCK.
== Notes ==
*This event can be received out of order with [[OnTriggerLeave - ObjectReference|OnTriggerLeave]], so it's ideal to keep a count instead of a simple true/false value for when things are inside the trigger.


HIDE BLOCK.
<source lang="papyrus">
Int InTrigger = 0


SURPRISE BLOCK.
Event OnTriggerEnter(ObjectReference akTriggerRef)
if (InTrigger == 0)
if akTriggerRef == Game.GetPlayer()
InTrigger += 1
debug.notification("Entered Trigger")
endif
endif
EndEvent


DREAM BLOCK.
Event OnTriggerLeave(ObjectReference akTriggerRef)
if (InTrigger > 0)
if akTriggerRef == Game.GetPlayer()
InTrigger -= 1
debug.notification("Leaving Trigger")
endif
endif
EndEvent
</source>


SLEEP BLOCK.
*If you set a trigger around a teleport door marker this event will fire for the player but not for NPCs.
*The collision layer associated with a primitive containing the script for this event doesn't detect dead actors.


THINK BLOCK.
== See Also ==
 
*[[ObjectReference Script]]
EMOTION BLOCK.
*[[OnTrigger - ObjectReference]]
 
*[[OnTriggerLeave - ObjectReference]]
SENCE BLOCK.
*[[GetTriggerObjectCount - ObjectReference]]
 
STUCK BLOCK.
 
WASTE BLOCK.
 
FOOD BLOCK.
 
LIVE BLOCK.
 
DO BLOCK.
 
HAPPEN BLOCK.
 
REAL BLOCK.
 
YOU BLOCK.
 
I BLOCK.
 
ADVERB BLOCK.
 
VERB BLOCK.
 
ADJECTIVE BLOCK.
 
NOUN BLOCK.
 
DIMENSION BLOCK.
 
MASS BLOCK.
 
SUBSTANCE BLOCK.
 
MATERIAL BLOCK.
 
MATTER BLOCK.
 
TIME BLOCK.
 
SPACE BLOCK.
 
ENERGY BLOCK.
 
OBJECT BLOCK.
 
UNIVERSE BLOCK.
 
WORSE BLOCK.
 
WORST BLOCK.
 
BARRIER BLOCK.
 
BOUND BLOCK.
 
CLOG BLOCK.
 
LIMIT BLOCK.
 
OBSTRUCT BLOCK.
 
BLOCK BLOCK.
 
ANYTHING BLOCK.
 
EVERYTHING BLOCK.
 
HOW UNBLOCK ANYTHING?
 
HOW UNBLOCK EVERYTHING?
 
FOREVER WAYS EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK ARE.
 
ONE 1. ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
DREAM ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
THINK ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
SAY ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
READ ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
WRITE ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
COMMUNICATE ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
LISTEN ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
FOLLOW ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
WORSHIP ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
PRAY ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
ALLAH UNTIL EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
TWO 2.
 
OPPOSITE BLOCK.
 
UNBLOCK.
 
UNBLOCK IS OPPOSITE BLOCK.
 
UNBLOCK IS UNBLOCK.
 
PRIVATE BLOCK.
 
SECRET BLOCK.
 
HIDE BLOCK.
 
SURPRISE BLOCK.
 
DREAM BLOCK.
 
SLEEP BLOCK.
 
THINK BLOCK.
 
EMOTION BLOCK.
 
SENCE BLOCK.
 
STUCK BLOCK.
 
WASTE BLOCK.
 
FOOD BLOCK.
 
LIVE BLOCK.
 
DO BLOCK.
 
HAPPEN BLOCK.
 
REAL BLOCK.
 
YOU BLOCK.
 
I BLOCK.
 
ADVERB BLOCK.
 
VERB BLOCK.
 
ADJECTIVE BLOCK.
 
NOUN BLOCK.
 
DIMENSION BLOCK.
 
MASS BLOCK.
 
SUBSTANCE BLOCK.
 
MATERIAL BLOCK.
 
MATTER BLOCK.
 
TIME BLOCK.
 
SPACE BLOCK.
 
ENERGY BLOCK.
 
OBJECT BLOCK.
 
UNIVERSE BLOCK.
 
WORSE BLOCK.
 
WORST BLOCK.
 
BARRIER BLOCK.
 
BOUND BLOCK.
 
CLOG BLOCK.
 
LIMIT BLOCK.
 
OBSTRUCT BLOCK.
 
BLOCK BLOCK.
 
ANYTHING BLOCK.
 
EVERYTHING BLOCK.
 
HOW UNBLOCK ANYTHING?
 
HOW UNBLOCK EVERYTHING?
 
FOREVER WAYS EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK ARE.
 
ONE 1. ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
DREAM ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
THINK ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
SAY ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
READ ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
WRITE ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
COMMUNICATE ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
LISTEN ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
FOLLOW ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
WORSHIP ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
PRAY ALLAH EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
ALLAH UNTIL EVERYTHING BLOCK MAKE EVERYTHING UNBLOCK.
 
TWO 2.

Latest revision as of 06:41, 9 October 2021

Member of: ObjectReference Script (Papyrus)

Event called when the object reference is a trigger volume and has been entered.

Syntax[edit | edit source]

Event OnTriggerEnter(ObjectReference akActionRef)

Parameters[edit | edit source]

Examples[edit | edit source]

Event OnTriggerEnter(ObjectReference akActionRef)
  Debug.Trace(akActionRef + " just entered us!")
EndEvent

Notes[edit | edit source]

  • 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.
  • The collision layer associated with a primitive containing the script for this event doesn't detect dead actors.

See Also[edit | edit source]