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.
Setting Up The Chest
For the first chest, which sets up a basic 4-digit combination lock, we need to create another chest event, "Chest 4a". On Page 2, set the "Conditions" switch to "Chest 4a Opened".
Here 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 Chapter 3). If not, the chest remains closed.
The complete code on Page 1 will look like this:
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.
Adding Non-Randomized Items
If you want to add your own items to the chest, simply delete the Call Event: Random Contents event command and replace them with your own.
We can now move onto Chapter 4b: Combination Locks (Advanced).