Following on from Chapter 4a, which created a single combination, this tutorial will prevent you from opening the chest unless you know the complete combination beforehand.
For the purposes of this tutorial, we’ll create 4 additional events (Bush #1, Bush #2, Bush #3 and Bush #4) that can be searched for each part of the combination. These are dotted around the map so that when "searched", one part of the combination will show up.
We’ll also need to create 4 variables (Num 1, Num 2, Num 3 and Num 4) to "store" the individual combination numbers, but this is primarily to avoid using switches when the number is obtained.
The combination for this tutorial will be 4321, with each part stored in the variable "Num Digits". If you attempt to open the chest without first knowing the entire combination of four numbers, you won’t be able to open it.
Setting Up The Combination
Starting with the Bush #1 event, in the Event Commands, we’re going to create a "Conditional Branch" to determine if the bush has already been searched. If so, display a message with the first number in the combination sequence; if not, set the first number (in this case set to 4) and add one to the number of digits.
Repeat this process for Bush #2, increasing the variable number in the "Conditional Branch" and renaming it to Num 2, and then reference it under the "Else Handler" as well. Change "\V[3]" to "\V[4]" in the text boxes.
Do the same with Bush #3 and Bush #4, increasing the numbers accordingly.
Creating The Combo-Lock Chest
After that, we need to create the chest. For this, we’ll check to see if all the numbers needed for the combination lock are known. If not, a message will be displayed telling you that you don’t know the full code. If so, check for the correct combination (in this case, 4321) and open the chest upon the correct combination being entered.
We’ll be drawing on the previous tutorials – Chapter 1 (Basic Chests), Chapter 4a (Combination Locks) and Chapter 3 (Random Contents) to create the chest.
The complete routine will look like this:
On Page 2, set the "Conditions" switch to "Chest 4b Opened".
Next Chapter
We can now move onto Chapter 5: Trapped Chests.
You must log in to post a comment.