From Valve Developer Community
(Redirected from Trigger)
Jump to: navigation, search

Triggers are entities which respond to the presence of other entities. Trigger brushes can be created by mappers, while programmers can make anything into a trigger.

Level design


There are many types of brush entity trigger that can be created from within Hammer; see Special:PrefixIndex/trigger for the complete list.

The most common general-purpose ones are trigger_once, trigger_multiple, trigger_look and trigger_proximity. They all share these properties and outputs:

All trigger entities must use this material on all faces.
Filter entities can be used to restrict what activates the trigger.
Filter Flags
There are a series of flags that permit simple filtering without the need of a second entity.
Outputs called whenever a entity matching all filters enters/leaves the trigger, regardless of whether it has passed any further tests. The entity that entered or left is the !caller.
As above, but only called if there are no other (filtered) entities touching the trigger.
One of these outputs will be fired in response to the TouchTest input. All triggers support this, but most do not have it listed in their FGD.
Fires whenever an entity matches all of the trigger's criteria.

Warning: For a trigger_once, this output is not the same as OnStartTouch and OnStartTouchAll. When a trigger that does not reset is activated, it removes itself from the map after 0.1 seconds. OnStartTouch can still be re-triggered during that 0.1 second window.

See also


All entities can respond to collisions with other entities (see Touch()). If you want touches without actual collisions, then you have two options:

SetSolid(SOLID_NONE) and AddSolidFlags(FSOLID_TRIGGER)
This will cause the entity to receive touches as things pass through it.
This will give the entity a "trigger box" that extends around its bounding box by iBloatSize units in X/Y and (iBloatSize/2) in +Z (-Z remains the same). The trigger box is world aligned and will work regardless of the object's solidity and collision group. It will be visible as a light blue box when the ent_bbox console command is used.
Valve use trigger boxes for all pickup items. Their bloat size is 24, a surprisingly large figure.


To make a new brush trigger, which tests using the shape of its brush model instead of a bounding box, inherit from CBaseTrigger and call InitTrigger().