Skip to content

Master entities

Roman Chistokhodov edited this page Sep 14, 2023 · 12 revisions

Master entities

In original Half-Life there's a concept of Master entity that allows to "lock" other entities (e.g. prevent doors from opening) until the Master entity state is On.

The only entity capable of being Master in Half-Life is multisource. This entity, however, might be quite confusing and hard to use as master. That's why Half-Life Featureful SDK introduces more ways to implement Masters.

env_state

Half-Life Featureful SDK adds a new entity env_state which is much easier to understand and use as a master entity. The entity itself is implemented after the one of the same name from Spirit Of Half-Life.

Globals as masters

In Half-Life Featureful SDK global variables can be used as Master entities as well. Use env_global with Act as Master spawnflag set. Then set the env_global targetname (the entity's name, not the associated global variable name!) as Master for other entity. If the associated global variable state is On, then the Master will be considered enabled. Otherwise (Off and Dead states, or if the global variable was not initialized) it's considered disabled. This allows to implement cross-level masters easily without resorting to using multisource or trigger_auto.

calc_state

Another new entity that can act as a master. calc_state takes states of two other entities (e.g. env_state or env_global) and evaluate the resulting state using the specified logical operator (AND, OR, etc.). Aside from having a Master capability, calc_state also can trigger other entities depending on the result of the operation if it's triggered by something else. If calc_state is set to target the env_state then the latter is basically used as a variable to store the result of the operation allowing for the arbitrary boolean expressions. The env_global can be used in a similar fashion if it has Set State: Obey Use-type as a trigger mode.

Other entities as masters

Most entities can't be used as masters. It's different in Spirit of Half-Life where every entity has the associated state and can be used as a master. In Half-Life Featureful SDK we still stick to more classic approach where only few entities have Master capability. This might change in future (preferably it should be a configurable feature though).

Clone this wiki locally