Advanced Outputs

A Quick Recap

The basic output system is covered in Core Concepts. Outputs connect one entity to another in the editor: when something happens on entity A, it calls an input on entity B with an optional string parameter. Most of the time that’s all you need. This page covers the more advanced features that let you build complex map logic without writing any code.

Delays

Every output has a Delay field. Setting it to a value greater than zero causes the engine to wait that many seconds before calling the input. The entity that fired the output continues running normally in the meantime.

Delayed outputs are queued on the entity that fired them. If that entity is despawned before the delay elapses, the output will not fire.

Refire

The Refire field controls how many additional times an output repeats after the initial fire. A value of 0, -1, or blank means fire once and stop. Setting it to 3 means the output fires once immediately and then three more times, each separated by the Delay interval.

Delay and Refire work together: a Delay of 1 and a Refire of 4 fires the output five times total, once per second.

The _activator Target

Normally the To Entity field targets a specific named entity. There is one special target name: _activator. Instead of looking up an entity by name, this routes the output back to whichever entity caused the output chain to start.

For example, a func_trigger fires OnTriggerEnter when an entity walks into it. Setting that output’s target to _activator and the input to Destroy will destroy whatever walked into the trigger, without knowing its name in advance.

The activator is tracked through the whole chain. If entity A fires to entity B and entity B fires to _activator, it still refers back to whatever originally started the chain at entity A.

Pass Variables

Pass variables let data travel through an output chain. When an entity fires an output in code, it can attach named values alongside it. In the editor you reference those values in the Input Parameter field using the ! prefix, and the engine substitutes the actual value when the output fires.

Pass variables are formatted as key:value strings. For example, when func_trigger fires OnTriggerEnter, it passes from_class:Player alongside it. If you set an output’s Input Parameter to !from_class, the engine strips the !, looks up from_class from the chain, and uses Player as the actual parameter instead.

Without pass variables, every parameter in the editor has to be a fixed string set at map design time. With pass variables, parameters can be determined by what actually happens at runtime.

What Variables Are Available

Pass variables come from the engine-side code that calls CallOutput(). The built-in entities expose the following:

func_trigger

Passes from_class on all three trigger outputs, containing the class name of the entity that entered or exited.

LogicCompare

Passes value and comparison on all four comparison outputs.

LogicArithmetic

Passes value_c (the result), value_a, and value_b on OnValueComputed.

WorldEntity (all)

The built-in DamageTaken output passes damage:N with the damage amount.

Passing Variables from Your Own Entities

To pass variables from your own entity, use the overload of CallOutput() that accepts a params array of strings formatted as key:value:

entity.CallOutput(“OnActivated”, this, “activator_hp:100”, “activator_team:blue”);

Any output connected to OnActivated can then reference !activator_hp or !activator_team in its Input Parameter field. Variables are available for the entire duration of that output chain, including delayed or refired outputs.

The GetValue Input

All entities have a built-in input called GetValue that reads a field from the entity and injects it into the pass variable chain. Target an entity with GetValue and set the parameter to the key name of a field marked [ExposeValue(“key”)], and that value becomes available as !key for any downstream outputs.