Introduction #
In this tutorial, we will learn how to setup the combination keypad as seen in Tomb Raider Chronicles.
The objective of this is for the player to input the correct code into the keypad for something to happen (ie: a door opening or something else).
The setup will be demonstrated using three different methods: triggers, volume events and scripted.
Please download the keypad object for this tutorial HERE
Step One: Create a new camera #
First: create a new camera anywhere on your level. We need to do this for the setup and will be required later.
You can do this by either pressing ALT+C and clicking on any square or right-clicking any square and selecting “Add Camera”.
Step Two – Rename Camera #
Right-click on the camera object you’ve just created and select “Rename Object” and name your camera. For this tutorial I have named it “keyPadCam”
Step Three: Place Keypad #
Place the supplied object (ANIMATING32) in your level. It will be raised to the correct height for the player but you can adjust this if you wish.
Once done: I recommend renaming it so you can find it easier in the next steps. I have called this keypad object “keyPad1”
This keypad has been modified and, if you choose to modify it, must use this supplied one as a basis. Thank you to LGG_PRODUCTIONS for allowing the usage of this.
This object does not have to be in that particular slot so you can change it to another ANIMATING slot if needed.
Step Four: Create Volume #
Next, you need to create a volume around the keypad object.
- Select the square below your keypad and press V. A purple cube will generate here. This is your volume.
- Rename the volume to “keyPad1Volume”
- Resize the volume using the handles so that it is just covering the keypad, as shown on the right.
Step Five – Create Event Set #
Now the objects have been setup: we need to do the setup within the in-built Node Editor.
- Double click the purple icon in the middle of your newly created volume and the Edit Volume window will appear.
- Press the + button (top left) and this will create a new Event Set.
- Rename this new Event Set to “keyPad1”
Step Six: Create Nodes. #
- Make sure you are in “On Volume Enter” mode
- Right click the node window and find the “Create a Keypad” node (Inside the UI/HUD section)
You will be met with a node with a few parameters that you need to set. I will explain this next part in left to right order.
- Change the keypad object box to the keypad we created. This is why we named our objects to make it easier to find it!
- Change your keypad combination (maximum 4)
- Change the camera to the keyPadCam
- Change the volume to keyPad1Volume
Step 7a: Event Activation #
To set the keypad to activate a volume event: then you must create a volume event set with the nodes that will activate when the correct code has been input:
- Make sure you are in “On Volume Inside” mode
- Create a “Run a keypad (Volume Event)” node
- Adjust the parameters so it is pointing to another event set. In my level, I have created a simple event that opens the door next to this keypad.
Step 7b: Classic Trigger Activation. #
NB: This post also acts as mini-tutorial on setting up the trigger_triggerer To set the keypad to activate classic triggers then you must create triggers that will activate with help from a TRIGGER_TRIGGERER object when the correct code has been input:
- Right click your keypad object and select “Select floor below current object” . This will highlight the square you need to create all triggers on.
- Press the “Set trigger triggerer” button in your Section Options window . This will put a blue border around the square that you know now is set up as a frozen trigger until activated.
- Drop a TRIGGER_TRIGGERER nullmesh on the same square as these triggers and rename it “keyPad1TT“.If you do not have this in your WAD: you can add it from the default TombEngine WAD2 located in your Tomb Editor / Assets directory (wherever you installed Tomb Editor) via Wadtool.
- Double click your volume around the keypad.
- Make sure you are in “On Volume Inside” mode
- Create a “Run a keypad (Triggers)” node
- Adjust the parameters so that your first parameter has your keypad object listed , and the second as your recently created trigger_triggerer nullmesh (keyPad1TT)
Step 7c: Script Activation. #
To set the keypad to activate a script function inside your level’s script file:
- Open up your script file (levelname.lua) located in your game’s Script/Levels folder. For this same function of opening the door next to the player I have made a simple script:
LevelFuncs.OpenDoor = function()
local door = GetMoveableByName("keyPadDoor1")
door:Enable()
end
- Double click your volume around the keypad.
- Make sure you are in “On Volume Inside” mode
- Create a “Run a keypad (Script)” node
- Adjust the parameters so that your first parameter has your keypad object listed , and the second your script function.