In RPG Maker, you can set up your maps so that the player will randomly encounter enemies. You can choose what enemies will be present on the map, what regions they will be available in, how often they will show up, and so on.
During the game, the player can then explore your maps and randomly encounter enemies.
However, what happens if you wanted to have some more control over the random encounters? What if you wanted to increment some variables depending on what you encountered? Or perhaps give the player a chance to skip the encounter by pressing a certain sequence of buttons in time!
This plugin gives you the tools to apply your eventing knowledge towards random encounters as well.
When the player runs into a random encounter, a common event of your choice will execute, before the battle begins.
Plugin: download here (right click and save as)
Download the plugin and place it in the “plugins” folder in your project’s “js” folder. Then open your Plugin Manager (F10), double-click an empty row, and select the HIME_RandomEncounterEvents plugin. Please do not rename this.
Once it is in your list of plugins, turn the plugin on.
Begin by reserving a variable in your game. This is a special variable that the game will use to determine which common event will run.
Next, go to the plugin manager, double-click on the RandomEncounterEvents entry, double-click on the “Variable ID” entry, and enter the ID of the variable that you’ve decided to use.
And now everything is ready.
To test that it works, follow this example:
1. Let’s assume you have chosen variable 10 as your random encounter variable, and that your map has some random encounters set up.
2. Create a common event that will display a message “Encounter!” We’ll assume this is common event 1.
3. Start testplay, press F9, and change the value of variable 10 to the ID of the common event you set up in step 2. In this case, I will set it to 1.
4. Now, run around and wait for a random encounter. At some point, you should get a message that says “Encounter!”, and once you finish reading the message, the battle will occur.
If you see the encounter message, then your random encounter event has been set up successfully. You can choose which common event to run at anytime using events.
This plugin let’s you skip random encounters in your random encounter
To do this, you would make a script call
Which would basically tell the engine to ignore the battle.
Accessing Encountered Enemy Information
In your common event, you will have access to the enemy troop that you encounter.
You can access the troop through this object in script calls
I will provide a separate tutorial showing some things you can do with the troop information.