TriggerSwitch¶
A trigger zone that controls either its own hit value when the player enters or exits the zone or it controls the hit value of another NPCControl when the player enters the zone, but not when they exit it.
Data Arrays¶
data[0]: If it's -1, the trigger manages its ownhitvalue when the player enters or exits the zone. If it's 0 or above, it manages thehitvalue of the map entity whose id is that value when the player enters the zone (not when they exit it). NOTE: any values below -1 are considered invalid because while this triggerhitwill be set when the player enters the zone, it will not be set when the player exits the zonedata[1]: This has 3 possible valid values (any other values is invalid and causes illogical behaviors):- -1: the
hitvalue of the refered entity will be toggled when entered. Ifdata[0]is -1 on top of this, thehitvalue will always be set to false when the player exits the zone - 0: the
hitvalue of the refered entity will be set to false when the player enters the zone. Ifdata[0]is -1, it will be set to true when the player exits the zone - 1: the
hitvalue of the refered entity will be set to true when the player enters the zone. Ifdata[0]is -1, it will be set to false when the player exits the zone
- -1: the
data[2]: If it's 1, the player.beemerangis destroyed when entering the zone
Additional data¶
regionalflag: If it's positive, it's the regionalflag slot that is set to true when the player collides with this object.activationflag: If it's above 0, the flag slot that is set to true when the player collides with this object. It is not possible to specify 0 and will be treated the same as not providing a value.
Setup¶
A few adjustements occurs:
- The entity.
alwaysactiveis set to true - The gameObject's isStatic is set to true
- The entity.
rigidis placed in kinematic mode without gravity nointeractis set to true- The layer is set to 0 (default)
- The
scolis disabled
Update¶
If the timer hasn't expired yet, it is decremented by the game's frametime clamped from 0.0 to infinity. Otherwise, if it is 0.0 and the entity isn't dead, a Death coroutine is started with the entity.
OnTriggerStay¶
This does nothing if any of the following is true:
- The player isn't present
- The other gameObject isn't the player
- We are
inevent - We are in a
pause hitis true
The regionalflag slot at regionalflags and the flag slot at activationflag are set to true when applicable.
We resolve the entity.npcdata this refers to by using data[0] as the map entity id, but if it's negative, it defaults to this NPCControl.
The hit field of that entity is toggled if data[1] is -1 or set to true if data[1] is 1 or set to false otherwise.
If the player beemerang is present and data[2] is 1, the player beemerang is destroyed.
OnTriggerExit¶
This does nothing if data[0] isn't -1 and the other gameObject isn't the player.
The only logic here is hit is set to false unless data[1] is 0 where it is set to true.