Continuing the Chest Tutorials, we’re now going to create a trapped chest, i.e. when you open it, it will trigger a random trap, which will cause damage or affect the player’s status.
Trapped chests can be used to add an element of danger, especially as red herrings or for obtaining much more powerful items.
Setting Up The Traps
To begin, create a basic chest (as detailed in Chapter 1).
You can set up the randomized traps in one of two ways: In the chest event itself or as a Common Event. Personally, I prefer the Common Event method so it can be called easily wherever you put a trap, not just chests but doors or floor triggers as well.
This will require as many "Conditional Branches" as you have traps triggered, including one where you avoid the trap (depending on the number of traps you want). For this tutorial, we’ll create 4 Conditional Branches and the Common Event method.
So, let’s create a Common Event (in the Database) called Random Traps, leaving "Trigger" at "None". And we’ll recycle the Randomizer variable we already created in Chapter 3 (if you’ve been going through the tutorial chapter by chapter).
We can now call the Random Traps event before the rewards (in our example, right before the "Random Contents" Call Event we defined in Chapter 3).
With that in place, the chest will open normally and you’ll receive the goodies from within the chest after the trap has been triggered.
We can now move onto Chapter 6: Picking Locks.