5.1. Target patterns

In Half-Life, when an entity triggers another entity it usually toggles its target (or targets). Specifically enabling or disabling an entity requires an intermediate trigger_relay entity that sends an 'on' or 'off' signal to the target entity.

Some mods, like Spirit of Half-Life, made it possible for any entity to send 'on' or 'off' signals simply by adding a + or - before the target name. The MESS target patterns behavior lets you do exactly that, and more. It works by automatically generating the required intermediate entities. For example, if a func_button targets +door, then MESS will insert a trigger_relay named +door, which sends an 'on' signal to door. This behavior is smart enough to only insert the required entities once, so if another entity also targets +door, only a single trigger_relay named +door will be inserted.

Available target patterns:


Enable target

property name value
Target +targetname

This generates a trigger_relay that sends an 'on' signal to targetname.


Disable target

property name value
Target -targetname

This generates a trigger_relay that sends an 'off' signal to targetname.


Kill target

property name value
Target kill targetname

This generates a trigger_relay that kills all entities named targetname.


Show target

property name value
Target show targetname

This generates an env_render that sets the FX amount of targetname to 255.


Hide target

property name value
Target hide targetname

This generates an env_render that sets the FX amount of targetname to 0.


Change target

property name value
Target targetname->newtarget

This generates a trigger_changetarget that sets the target of targetname to newtarget.

newtarget can also be a pattern, like +newtarget or -newtarget. Note that multi-target patterns take precedence, so button1->door1,door2 is interpreted as a multi-target pattern that contains a change-target pattern.


Set counter value

property name value
Target set targetname value

This generates a game_counter_set that sets the value of targetname to value.


Trigger multiple targets

property name value
Target target1, target2

This generates a multi_manager that triggers both target1 and target2. Targets can also be patterns, so +target1,show target2 will also generate a trigger_relay and an env_render, according to the 'enable' and 'show' patterns.

It's also possible to give targets a delay:

property name value
Target target1, target2: 1.5, target3: 2

This generates a multi-threaded multi_manager that triggers target1 immediately, target2 after a 1.5 second delay and target3 after a 2 second delay.


Configuration

The following globals (defined in mess.config) can be used to disable specific patterns. This can be useful if you're making maps for a mod or game that already supports some of these patterns, such as Spirit of Half-Life:

global effect
MTL_TRIGGER_PATTERNS_DISABLE_ON_PATTERN = 1 Disables the+targetname pattern.
MTL_TRIGGER_PATTERNS_DISABLE_OFF_PATTERN = 1 Disables the-targetname pattern.
MTL_TRIGGER_PATTERNS_DISABLE_KILL_PATTERN = 1 Disables thekill targetname pattern.
MTL_TRIGGER_PATTERNS_DISABLE_SHOW_PATTERN = 1 Disables theshow targetname pattern.
MTL_TRIGGER_PATTERNS_DISABLE_HIDE_PATTERN = 1 Disables thehide targetname pattern.
MTL_TRIGGER_PATTERNS_DISABLE_CHANGETARGET_PATTERN = 1 Disables thetargetname->newtarget pattern.
MTL_TRIGGER_PATTERNS_DISABLE_SET_PATTERN = 1 Disables theset targetname value pattern.
MTL_TRIGGER_PATTERNS_DISABLE_MULTITARGET_PATTERN = 1 Disables thetarget1, target2 pattern.