Numeric code lock

You have seen them in Doom3 for example; basically a keypad in which you had to type in a code to perform specific actions: gain access to health and ammo, enter specific rooms etc.

The impact of these locks on gameplay was very powerfull. In my case, for example, it had me searching for PDA’s like crazy. I also ended up giving more atention to the background story. Now although the interface used in Doom3 cannot be used in AvP2, locks which operate with codes might have the same impact: the player paying more and more atention to the story, reading PDA’s and notes in hope of finding a code, a code which will give him the health and armor he desperately needs.

  • 29 triggers, 16 TranslucentWorldModel and 10 switches. This is what it took (in my case) to have something very similar in AvP2. The features gained are as follow:
  • the lock will be opened if you punch in a series of 3 digits
  • by default, the lock cannot be used again: once it unlocked the resources it was guarding, it will remain unlocked.
  • the lock doesn’t care about the succesion of the digits.

Although this last mention might look like a serious bug, please take this into account: chances of guessing the digits of the code (no matter the order in which they are placed) is almost 1 in 1000. Now, punching in a combination takes at best 2 seconds. Nobody will try for 2000 seconds (33 minutes) to crack a lock: you will need the code.

Due to the complexity of the prefab, I will first explain how to integrate it into a map, how to set a password and what to change after a COPY-ALT-PASTE operation. For reasons that elude me at this point, triggers are copy-paste friendly. Switches and pretty much anything else are not. This does affect our lock. After a copy-paste operation, you will first have to edit the switches of the lock:


To be more accurate, you will have to change the LockedCommand string to point to the right trigger:



And you will have to do this for all 9 switches, so that SkX_Ln will point to the show_kX_Ln: kX will tell you which key you are editing, while Ln will tell you to which lock this key belongs. Now, after a copy-paste operation, regarding the switches, the only thing that needs to be edited is the index of the lock (Ln), as shown in the above pictures. The indexes of the keys are safe. After editing the switches, it’s time to set up a password. The focus changes from the switches, to the triggers targeted by the switches:


For example, if we want to include the digit 0 in the code for lock 1, we will have to edit the trigger targeted by Sk0_L1, and that one (again as shown in the pictures above) is called Show_k0_L1. You will be able to find it in the node view in the path Triggers/ButtonAnim/k0_.

The next thing is to have this trigger unlock one of the 3 control triggers of lock 1: FirstKeyOK_L1, SecondKeyOK_L1 or ThirdKeyOK_L1.


In our case, FirstKeyOK_L1:


Linking in this way show_k4_L1 to SecondKeyOK_L1 and show_k7_L1 to ThirdKeyOK_L1, you have the following codes allowed: 074, 047, 407, 470, 704 and 740.

The last thing needed is to have the lock actually doing something. For this, we will edit the UserOpen_L1 trigger. As the name says, this is the trigger that should be used to have the lock 1 linked to an action:


In our sample, we will turn on the lights in our map.

I’ve prepared two goodies: the regular archive (containing the .ed file, the textures needed and this very page) and a small-one-room map. Enjoy.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s