User Tools

Site Tools


Combination Locks


NOTEME This is a modification of a Dromed Central tutorial.

First, create several items:

  • one physicalGizmoGaugeOdometer
  • one physicalGizmoSwitchesButtonsNumberButton. The others can be added once this one has had some properties set.
  • one fnordTrapTrigQuestVarTrigger
  • An item (eg. Door) you can control with a ControlDevice Link.

After placing these in a level, we do the following.

  1. Add the property TrapQuestVar to the Odometer and give it the argument door_combo
  2. Do the same for the NumberButton
  3. Add the property ShapeTxtRepl r0 to the NumberButton. The argument for this is obj\txt\button0
  4. To make the rest of your buttons, clone this one and change the TxtRepl r0 argument to button1, button2, button3, etc.
  5. Add the property TrapQuestVar to the QuestVarTrigger and give it the argument “1138:door_combo (YES, a QUOTE goes to the beginning but not the end! Kinda like cheap French literature.)
    • OBVIOUSLY, you should replace 1138 with the combination you want to use, or we’ll have the combination 1138 in every fan mission…
    • The means that the quest variable door_combo should end with 1138, which allows for the player trying other numbers beforehand.
  6. Add a ControlDevice link from the QuestVarTrigger to the item you want to control with the code.
  7. Type the command quest_create_mis door_combo, 0
    • This is optional - it will reset the code to 0000 when you exit game mode. If you don’t do it, the odometer will display the most recent value of door_combo until you close Dromed.

The combination lock should now be fully functional.

NOTEME You will notice there are no ControlDevice links between the NumberButtons and the Odometer. This is because the buttons inherit the NumberButton script from the hierarchy, and that script looks at the texture to work out which number has been entered.

If you want to have multiple independent combination locks, do the above steps again but instead of typing door_combo, type something else (door_combo is just a variable name, there’s nothing special about it).

dromed/odometer.txt · Last modified: 2010/05/03 11:09 by r_soul