Skip to main content

Trigger modes

Every trigger one entity sends to another has a use type (On, Off, Toggle or Set), and with Obey Trigger Mode, doors, trains and triggers follow it instead of switching on every trigger. The entity that gets the trigger decides what the use type means, and many entities treat every use type the same way unless you set that key.

Use types​

Use typeNumberWhat it usually means
Off0Turn off, close or stop
On1Turn on, open or start
Set2Set a value, which entities such as calc_eval_number and game_counter_set send together with a number
Toggle3Switch to the other state

What sends which use type​

Most entities send Toggle, and the entities below send something else or let you choose:

EntityWhat it sends
trigger_once, trigger_multiple, multi_managerToggle
func_button, func_rot_buttonThe use type you choose in their key Use type, Toggle by default. With the Toggle flag, the choices On/Off and Off/On send one use type when the button goes in and the other when it comes back out
trigger_relay, trigger_auto, game_team_masterThe use type you choose in their key Trigger State
trigger_entity_iteratorThe use type you choose in its key Trigger state for each entity
env_stateOn and Off to its Target, and Toggle to its other targets
calc_stateOn to its Target when the result is true, and Off when it is false
trigger_inoutOn when something enters and Off when it leaves, to its Fire on/off target, and Toggle to its other targets
multi_watcher, watcher_countOn to their Target when their result becomes true, and Off when it becomes false. A multi_watcher with the flag Send 'Toggle' sends Toggle
Doors, platforms and trainsThe use type you choose for each of their "Fire On" keys, such as Fire On Start use type, Off by default

Trigger State​

The key Trigger State (triggerstate) sets the use type an entity sends. Its default in the editor is Off, and an entity without the key sends Off too, so set it to On or Toggle for the target to switch on.

ValueWhat it sends
0Off, which is the default
1On
2Toggle
-1Copy Input, which is the use type the relay got, and only works on a trigger_relay
-2Reverse Input, which sends On when the relay got Off and Off when it got On, passes Toggle and Set on as they came, and only works on a trigger_relay

Obey Trigger Mode​

Without this key, the entities below treat every use type the same way, so a door opens or closes when you trigger it with On, Off, Toggle or Set. With Obey Trigger Mode (m_iObeyTriggerMode) set, they follow the use type instead:

EntityNo (0), the defaultYes (1)
func_door, func_door_rotating, func_waterAny trigger opens the door when it is closed, and closes it when it is open and has the Toggle flagOn opens the door, Off closes it and Toggle opens or closes it, but only while the door stands still
func_train, env_modeltrain, env_spritetrainAny trigger starts or stops the trainOn starts it, Off stops it and Toggle switches it
func_rotatingAny trigger starts or stops itOn starts it, Off stops it and Toggle switches it
trigger_hurt, trigger_push, trigger_monsterjumpAny trigger turns it on or offOn turns it on, Off turns it off and Toggle switches it
monster_apacheThe first trigger starts it, and later triggers do nothingOn starts it, Off stops it in the air and Toggle switches it

With Yes, an On sent to an entity that is already on, or an Off sent to an entity that is already off, does nothing. For the trains, func_rotating and the triggers in the table, Set works like Toggle.

Doors have a third choice, Yes, even when currently moving (2), which also acts while the door is moving:

  • Toggle always acts
  • On opens a closing door again, and Off closes an opening door if it has the Toggle flag, while a door without that flag keeps opening
  • While the door stands still, On opens it and Off closes it, as with Yes

Changes since 1.38​

  • Obey Trigger Mode is new, because SBO 1.38 ignored the key on every entity, and the compatibility file removes it from the custom maps that had it
  • The Trigger State choices Copy Input (-1) and Reverse Input (-2) are new
  • The Use type key of func_button and func_rot_button is new, and so are the use type keys of the "Fire On" keys of doors, platforms and trains

See also​