This is the first article to give you some inspiration and tips to think outside the box. At this point, I assume you already know the basics and have set up your first generated map(s). It’s okay when you haven’t touched the Templates in the Plugin Manager yet; I will guide you through them.
So, what are we going to build today? We make a simple tower, maybe with 10 floors; however, we want to have some variations for each floor. For example, save points appear only on every 3rd floor, every x floor is a simple puzzle to cool down, and on the final stage (or somewhere in the middle?), a boss is waiting for you. And while you start slaying trash mobs, stronger enemies other than slimes cannot wait to fight against you. And no, we will not use a plugin to automatically increase monsters‘ levels, but we want variety!
Have you already noticed that you can use Switches as a precondition when you let objects such as chests or monsters spawn? Or, that you can use Variables to define how often objects will appear? Well, now you have!
Switches and Variables are the most basic logic elements in RPG Maker.
A Switch is a global parameter that is either ON or OFF. As a game developer, you can set a Switch and its value at any time in your game, e.g., when the player successfully finishes a task of a quest line. A Switch’s value can be queried at any time, and since it’s global, the quest giver can react to it.
A Variable is similar to a Switch; however, its value is a number that one can count. For example, you can ask the player to gather 5 mystic flowers from the dark forest.
Game developers often use Conditional Branches to set and query Switches and Variables.
If not already done, draw all the maps you need for a generated map. You can use both the snippet-based and snippet-less techniques. Furthermore, you want to have a map where the player enters your dungeon; that could be a world map or any other map.
This is where we want to build on top of it.
The Floor Variable
So, before we can set up Switches and Variables, we need something to keep track of on which floor the player is right now. Well, two options come to my mind:
- You can use a single Variable that counts up every time the player enters the next floor
- You can use the Meta Maze
The Meta Maze assists you as it automatically keeps track of which floor the player is and also manages Self Switches. On the other side, the Meta Maze may be a whole new chapter and overwhelming for you, so a single Variable that counts up is what we want to do now.
Set up a Variable and call it „Floor Id“. Set it to 1 when the player enters your dungeon. Example:
Next, go into your Eventing, where the player reaches the exit and goes to the next floor. It probably looks like this:
Just before you call the generator to create a new map, increment „Floor Id“ by 1 (see screenshot below).
We stay here as this is the place where we want to define our new rules. Let’s say the save point appears only on every 3rd floor.
How can I check whether „Floor Id“ is divisible by a number n? I admit RPG Maker is a bit clumsy here, and you need a few commands for this. I think the best is to just copy-paste the commands shown below.
Experienced developers may short-cut and use the JS script command like this:
const b = $gameVariables.value(42) % 3 == 0
Replace 42 with the Variable Id of your „Floor Id“ and 43 with the Switch Id of your „Save Point?“.
How to bind the Switches to the Assets on my Asset Map?
- Go into the Plugin Manager and click on the RNGMaps Plugin of your choice
- When you see a list of Templates, you may want to duplicate one of your choice
- Inside a Template, you find a section where you define all the Assets
- There’s probably a rule called „Switch“ that you may reuse or simply create a new rule. If you decide to create a new one, delete the „Switch“ rule to not have duplicates.
- Here you can bind your Switch to your Asset like this:
The Asset with Region Id 22 only appears if and only if Switch #23 is ON.
Don’t forget to set all the other values, e.g., Region Id.
Today you learned…
How to make objects appear only when a given precondition is fulfilled. Looking at the RPG Maker’s Variable Operations and Checks in the Conditional Branch, you now have great tools to improve your gameplay! Just a few ideas:
- Other enemies appear as soon as your player reaches a specific level/party size/floor/…
- Special Chests appear at every x level
- Chests (don’t) spawn until a specific floor