env_global Last edited 4 years ago2019-05-19 03:52:57 UTC

env_global - Point Entity

The env_global entity provides a way to store global variables — that is, values that can be retrieved and used across level changes. For example, you could use an env_global to have a switch in one level unlock a door in another.



Set Initial State - If enabled, the value of the global variable will be set by the env_global when it is first loaded.


From the VERC Archive


The env_global seems a bit complicated to use, but it really is quite easy. Here's a brief list of the steps I took in the example map.
  1. In global1.bsp, i've got a button that activates some things. This button has a multisource master specified (button_master).
  2. The button_master multisource has a Global State Master of levelpower. This means that the multisource will not be "on" until the levelpower global variable has a state of "on". You must now walk through a hallway, through a level transition, into the global2.bsp map.
  3. In global2.bsp, i've got a button which targets an env_global.
  4. The env_global has the following properties:
    • Name - level_power
    • Global State to Set - levelpower
    • Trigger Mode - Toggle
    • Initial State - On
  5. When the button triggers the env_global, the levelpower global variable is created with its state set to On. Each time the button here is pressed, the state of the levelpower global variable will toggle between On and Off. Make sure the power button is on (you'll be able to tell from the texture of the button whether it is on or off), then walk back down the hallway through the level transition into the room you initially started in.
  6. The button will now be usable, allowing you to turn some things on and off.
  7. You can go back to the other room and turn the power off, or on, as many times as you like.

Example Maps

Loading embedded content: Vault Item #13


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