Skip to main content

trigger_condition

trigger_condition icon
Point entityPorted from SevenKewpSven Co-op

A trigger_condition compares a key of an entity with a value, or with a key of another entity, and fires its "true" or its "false" target. With Cyclic, it checks once for each trigger, and without it, it keeps checking while it is on, so it can watch a key such as a monster's health or the position of a train. See the Changing values guide for a setup with it.

Attributes​

The entity also has these common keys:

KeyDescriptionDefault
Monitored entitytarget

Names the entity whose key it checks, as a name, !activator or !caller.

Monitored keym_iszValueName

Names the key it checks.

Compare-entitym_iszSourceName

Names an entity to compare with. If you set it and Compare-key, the entity ignores Compare-value.

Compare-keym_iszSourceKey

Names the key of the Compare-entity.

Compare-valuem_iszCheckValue

Sets the value to compare with when there is no Compare-entity.

If you leave this key empty, it is 0.

Comparatorm_iCheckType

Sets how the entity compares the monitored value with the compare value. & only works on keys that hold whole numbers.

  • == (Equal) (0)
  • != (Not equal) (1)
  • < (Less) (2)
  • (Greater) (3)

  • <= (Less or equal) (4)
  • = (Greater or equal) (5)

  • & (any bit set, integer keys) (6)
Default == (Equal) (0)
Target for 'true'-casenetname

Fires this target when the comparison is true.

Target for 'false'-casemessage

Fires this target when the comparison is false.

In constant mode fire whenm_iCheckBehaviour

While the entity is on, sets when the targets fire. "Result has changed" only fires when the result differs from the last check.

  • Result has changed (0)
  • Result has changed or it keeps being true (1)
  • Result has changed or it keeps being false (2)
  • Always (3)
  • When the entity turns on, the last result counts as true. So with "Result has changed", a first result of true fires nothing
Default Result has changed (0)
Check intervalm_fCheckInterval

While it is on, sets how many seconds pass between two checks, at least 0.01.

Default 0.1
Reset at round startround_reset

With Yes, the entity goes back to the way it was when the map loaded, at each round start before the players spawn. See Round hooks for more details.

  • No (0)
  • Yes (1)
Default No (0)

Flags​

1Start Off

The entity starts off, and a trigger turns it on

2Don't use X

The X of a vector isn't compared

4Don't use Y

The Y of a vector isn't compared

8Don't use Z

The Z of a vector isn't compared

32Cyclic

Each trigger checks once, and the entity has no on and off state

64Keep activator

The targets get the activator of the trigger. Without this flag, the trigger_condition itself is the activator

128Ignore initial result

The first check after it turns on fires nothing

Notes​

  • Without Start Off or Cyclic, it is on from the start and checks every Check interval
  • A trigger with On turns it on, a trigger with Off turns it off, and a trigger with Toggle switches it
  • A target that triggers the same trigger_condition while it fires is ignored
  • For vectors, "Equal" and "Not equal" compare all three numbers when the compare value is a vector. The other comparisons use the vector's length
  • Without a Monitored entity or a Monitored key, the entity removes itself. With developer 1 set in the console, the console says so
  • Setups from Sven Co-op carry over, because the class name, key names, flags and comparison numbers are the same

See also​

Changes since 1.38​

  • trigger_condition is new