Tutorial: Security Cards Last edited 1 year ago2022-10-10 22:57:29 UTC

Download attachment

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 those entities - Tutorial: Globals and Tutorial: Multisource - 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 to card, Global State to Set to cardtaken, Trigger Mode to On and Initial State to Off. In the properties of the multisource set the Name to Cardms and Global State Master to cardtaken.

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, cardms (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 to operate.

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 Tutorial: 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 separately. By the way, this tutorial is only set up as a one-way transition.
"Oh cruel fate! Such misfortune that doth slayed me!""Oh cruel fate! Such misfortune that doth slayed me!"
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.


Commented 15 years ago2009-05-02 20:28:12 UTC Comment #100523
Not only is this tutorial very useful and helpful, I remember it as the first tutorial I ever read from TWHL, and what eventually got me to join up.
Commented 15 years ago2009-05-03 12:45:05 UTC Comment #100524
helped me alot :)
Commented 14 years ago2010-02-26 10:41:08 UTC Comment #100525
Great tutorial, can teach a lot to one person.
Commented 8 years ago2015-11-12 05:23:00 UTC Comment #100526
Nice little tut. Informative and simple enough for a noob like me to understand :)
Commented 6 years ago2017-11-14 03:13:07 UTC Comment #100527
I wonder if there's a way to make it work in multiplayer.
Commented 6 years ago2018-01-21 23:56:43 UTC Comment #100528
thank you :)

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