activator Last edited 4 weeks ago2024-06-28 17:25:17 UTC

In User posted image GoldSrc entity system, the activator is one of the entity references passed to an entity's targets when it gets activated, the other being the caller i.e. the immediate entity firing the target.

Examples of activation that passes an activator include a player touching a trigger, or pressing a button. The targets of these entities receive references to both the caller (trigger or button), and the activator (the player). In case of solid triggers, checking the "Monsters" (1) flag makes monsters activators too.

An entity getting triggered can, in turn, fire its own targets. This is called a trigger chain. For some entities, it will pass along the activator as it receives it to its targets, perpetuating the activator reference. Then, an entity somewhere along the trigger chain can act on the original activator (e.g. game_text or env_fade, depending on how they're set up) even if it's many levels removed from the original triggering event.

Suppose this chain of triggers:
playertrigger_multiplemulti_managergame_text
the game_text entity at the end of this trigger chain will be able to display its text to the player who activated the trigger_multiple entity at the start of the chain, because these entities pass along the activator when they trigger each other, in this case the player.

Another example:
playerfunc_buttonfunc_healthcharger
will give the player exactly 1HP no matter how long the USE key is pressed, because unlike a func_healthcharger a func_button only sends an impulse USE, and the charger only sends 1HP to the activator. But swap the button with a trigger_multiple with reset value of 0.1s, now turns the trigger into a healing forcefield that respects the func_healthcharger per-skill juice amount.

Do note however that not all entities will pass along their activator reference. Some send none, others will send itself. This means that an activator reference can be a non-player, or none at all, and when they trigger entities that directly affect their activators like func_healthcharger or game_text it may fail, or even cause a crash.

Scenarios where activator is used: The activator chain however will be broken (i.e. the original activator reference lost) in the following entities:

1 Comment

Commented 4 months ago2024-03-26 01:06:50 UTC Comment #106087
In vanilla SDK, there is no way for any entity to specify the activator in the target field. However in SoHL and clones (e.g. Sven Coop and Featureful) the special name
!activator
can be used for this.

You must log in to post a comment. You can login or register a new account.