Here's a really quick tutorial about getting a key to open a door (there might be an easier way to do this but I found that this method works pretty well). You can also use the key in other levels by just cloning the door, trigger and multisource
. There are already two tutorials that deal with the env_global
, so I'll try not to go over the same stuff.
The idea here is to make sure that the door will not open until you have the key. First up place an item_security
entity, an env_global
entity and a multisource
in your map. Oh yeah, don't forget the door and the card scanner.
In the properties of the item_security
entity set the Target
to the name of the env_global
. I have used card
to make things easy. Something of interest here is that you could also use a world_items
entity because it does the same thing. In the properties of the env_global
entity set the Name
, Global State to Set
, Trigger Mode
and Initial State
. In the properties of the multisource
set the Name
and Global State Master
You need to set the properties of the door and the door's func_button
(card scanner) so that it actually works. The card scanner does not need a name; the only properties that really need setting are the Target
, in this case door2
(the name of the door) and Master
(the name of the multisource
). If you want the door to close behind the player, make sure that Toggle
is not checked in the flag properties and that the door has the same flag.
So What's Going On?
Picking up the security card calls the global (card
) which sets the state to cardtaken
. The multisource
will not let the func_button
operate until the cardtaken
state has been called and now that it has, it allows the func_button
There are two maps provided because I wanted to prove the Global. I won't go into level transitions in this tutorial. Atom mentions them in Globals
. Just something on level transitions: most of the stuff I have read recommends that you do not run the game from the compiler. Instead use the console after compiling each map seperatly. By the way, this tutorial is only set up as a one-way transition. So this is what it looks like. Someone has bashed poor old Barney on the head, and the key is by his side (must have been a monster 'cause there is a 357 on the table). Try using the card scanner on the table before you get the card. The set of entities used lend themselves to endless possibilities, so have fun and if you find more uses then let us know through the forum.
The original idea behind this tutorial came from The Spawning Tank