Onliners

Affiliates

Concepts: Triggers and Targets

By Chris 'autolycus' Bokitch

Most editing tutorials throw around the words trigger and target without a real explanation of what they mean. As they are at the heart of almost every entity event, it is extremely important to understand what they are and how they work.

We'll start with a visual example:

A trigger is something that can activate another event. In the example above, I've used a trigger_once entity, which requires that the player walk through it to set it off. A button or some other method could also have been used here, but this keeps it simple.

In an entity capable of acting as a trigger there is a Target property. The value of this property is the name of the event that will be affected or used. This can be where things get confusing - the term "target" can refer to any entity capable of being named. People occasionally have the idea that this must refer to an info_target entity, but this is not correct -- it can be an info_target, but it doesn't have to be.

In the example above, you can see that the trigger_once targets the env_beam in a way that will activate it. This would be active targeting or simply triggering.

The env_beam has two properties associated with it that allow you to target objects -- the Start Entity and Ending Entity. In the example, you can see that these properties do target info_target entities, but as mentioned above, they could easily have been any other entity, including moving ones. (note: if you are referencing a non-point-based entity (like a func_door) for its location, that entity needs to have an origin brush as part of it which will act as a targeting point).

The env_beam uses the two info_targets' locations as the start and end points of its beam, but does not actually trigger or activate them in any way. This would be benign targeting, or simply targeting.

Special Targeting: The Killtarget

Aside from the active and benign targeting, some entities possess the ability to remove other entities by targeting them with their killtarget property. When an entity is killtargeted, it is completely removed from the game -- there is no way to re-enable the killed entity.

So, to recap, triggering something refers to one entity (generally a trigger_something, but not necessarily) targeting and activating another entity or event, whereas targeting something is simply the act of making one entity aware of another, possibly for triggering, and possibly not.