env_global

Modified

12-Jul-2023

The env_global entity provides the decisive functionality for allowing entity-interaction between maps. More accurately, it allows you to create/set a global variable by a name of your choice. Global variables are set to a use-type of 'On' or 'Off', which can then be used by some entities as their state. E.g. the multisource entity can be set to read its state from a global variable at map load, unless you are having triggers targeting it. This could, for example, be used to make a key for some door collected in one map allow a specific door to be opened in another map.

Keyvalues


OnDestroy Function ondestroyfn : Name of the function to use from already parsed .as script files when entity is destroyed (killed) in any way. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.

Name targetname : Set name of env_global so other entities can trigger it to set global state. Every trigger use-type works uniformly. Can be kill-targeted.

Global State to Set globalstate : Name of the global state to set. If it does not exist, it will be created.

Trigger Mode triggermode : How to set the global state. Shall it be set to 'On', 'Off', or shall its current state be toggled? If you specify 'Dead', that will delete the global state if it exists.

  • 0 : Off
  • 1 : On
  • 2 : Dead
  • 3 : Toggle

Initial State initialstate : If the 'Set initial state'-flag is set, the given global state will be set to the state specified here. 'Dead' removes the global state in case it exists and should act before any entities can read its global state and won't read anything at all, resulting in default behaviour. For some reason, 'Toggle' is not an option here, possibly because of the undefined case of a non-existing/'uninitialized' global state being told to toggle.

  • 0 : Off
  • 1 : On
  • 2 : Dead

Flags


  • 1 : Set Initial State : If set, the given global state will be set to the given initial state on map load.