Well there are several techniques to make doors with passwords, but I think this is by far the easiest method. Although this tutorial is relatively long, it is still relatively easy - trust me).
STEP 1: BUILDING A KEY PAD
If you want to do a key pad password to a door(or anything else) the following is required. Note, that the colors of the keys relate to the key position and order they must be pressed to unlock the door. In this example the code is 5734:
For consistency, I have colored all keys in this tutorial, and the colours are assigned thus: FIRST DIGIT
, SECOND DIGIT
, THIRD DIGIT
, FOURTH DIGIT
In the map editor align the buttons of your key pad like this:
Make sure all
buttons have wait=0.1
Buttons B0-B9 can have the "port 0#" texture. Where you make it bigger and make it so only the last number is shown, the port 0# textures are in SIGNS category in Qoole 99.
To make the 0-button, take port01, but use the zero in the beginning.
BR can have the empty round, gray button that turns orange when pressed.
BA can have elevator button pointing UP.
STEP 2: MAKING THE LOCK CODE
The first code number must have a trigger referring to the first trigger_changetarget
As stated above, the code is set to 5734B1:
target: but_resetB3:targetname: B3target: but_resetB4:targetname: B4target: but_resetB5:targetname: B5target: but_code1B6:
target: but_resetB7:targetname: B7target: but_resetB8:
STEP 3: CODING THE TRIGGER_CHANGETARGETS
11 trigger_changetarget are required to make the key pad work. Note that all these triggers here are trigger_changetarget. Set the trigger_changetargets to:
newtarget: but_resettargetname: but_resettarget: B3newtarget: but_resettargetname: but_resettarget: B4newtarget: but_resetNOTE: The first code digit must be reset correctly, or else the code lock will "lock" after entering a wrong code digit!! (I learnt that the hard way)targetname: but_resettarget: B5newtarget: but_open1
newtarget: but_resettargetname: but_resettarget: B7newtarget: but_reset
STEP 4: SETTING THE RESET FOR THE ENTER BUTTON
The reset for "enter" button by:
STEP 5: BUILDING THE CODE CHECK
Now we create an 8 trigger_changetarget
to update the codelock, if the correct code digit has been entered.GROUP 1targetname: but_open1target: B5newtarget: but_resettargetname: but_open1target: B7newtarget: but_open2GROUP 2targetname: but_open2target: B7newtarget: but_resettargetname: but_open2target: B3newtarget: but_open3GROUP 3targetname: but_open3target: B3newtarget: but_resettargetname: but_open3target: B4newtarget: but_open4GROUP 4targetname: but_open4target: B4newtarget: but_reset
STEP 6: CONNECTING THE CODE LOCK TO THE DOOR
Connecting the code lock to the door is essential, else the codelock is completely useless. To do this you need to create two small button OUTSIDE
the map.The first button:
sound: Access Denied
wait: 0.1The second button:
sound: Access Granted
STEP 7: TARGETING THE DOOR
Now we target but_door to what we want when the correct code is entered. We target it to a single func_door:
target: but_reset<<< NOTE!! The but_reset is vital to reset the code when the door has been opened. For example, in multiplayer maps this means the next play can not open the door, without re-entering the code
The codelock can be used again and again. I believe this will be cool in multiplayer maps, where the developer can have a "code" to enter a protect-room, or full with weapons. Imagine a button to open a door with lava under all the other players. Why not a turret? use your imagination!
Finally I have included an flow diagram of all the triggers and buttons required to make this work. It doesn't display to well here, so click and download: Have fun with your code locks!