11 March 2010

Chapter 4a: Combination Locks (Basic) - The Complete Chest Tutorial

Combination locks can be placed on some chests, which will only be opened if the correct combination is entered, otherwise will remain closed. In this two part tutorial, I'll demonstrate how this can be achieved.

The first, which sets up a basic 4-digit combination lock, we need to create another chest event, "Chest 4a". On Page 2, set the Preconditions Switch to "Chest 4a Opened".

On Page 1, we'll set up a variable and input option for the combination (in this case 1234), stored in "Combo", determine if the correct combination has been entered and, if so, provide random contents (detailed in Part 3). If not, the chest remains closed.

The complete code on Page 1 will look like this:
<>Input Number: 4 Digit, [0002:Combo]
<>Branch if Var [0002:Combo] is 1234
  <>Play Sound: open1
  <>Move Event: This Event, Face Right
  <>Wait: 0.2 Sec
  <>Move Event: This Event, Face Up
  <>Wait: 0.2 Sec
  <>Move Event: This Event, Face Left
  <>Wait: 0.2 Sec
  <>Call Event: Random Contents
  <>Switch Operation: [0001: Chest 4a Opened] ON
: Else Handler
  <>Message: The combination is incorrect.
: End

When you playtest the game, if you try and open the chest with any other combination than 1234, the combination will be incorrect. Trying 1234 will open the chest and give random items (from Part 3).

2 Comments So Far:

Anonymous said...

Thank you very much.

Companion Wulf said...

You're welcome. :)
You might be interested to know that there's an updated version of this entire tutorial here.

Post a Comment

Related Posts with Thumbnails
Template Design "Perfect World" by SkinCorner