EVENT – On Map Encounters

twitter

Creating on map encounters isn’t new in RPG Maker, its pretty simple to do and is used fairly frequently in many games.  What I’m going to go over here are how I do on map encounters and some of the variations on the idea I use.  I’ll cover how to create some basic random monster tables, and how to increase encounter difficulty by party level.  I’ll be working in VXA, but the concepts are basic enough to apply to other versions or RPG Maker.

I made a very simple 30×20 exterior map using the default graphics that come with VXA.  This will be included in the project files for the demo available for download at the end of this article.

Demo On Map Encounters

Demo On Map Encounters

The Basic On Map Encounter

First, lets make sure everyone knows what a basic on map encounter event looks like.  I’ve created one below.

Basic On Map EncounterThis creates a simple encounter with slimes that will wander around on the map randomly, moving pretty slow.  It won’t attack on its own and battle only happens if the player approaches and uses the action button (space bar).  The first line in the event sets the battle background, this isn’t necessary you can do it for the map in the map properties, but I like to set it in encounters in case my map has different areas where I might want to use different battle backgrounds.  You can skip this if you prefer.

The next line uses the Battle Processing command found on tab 3 of the Event options under Scene Control.  In this case I’ve set it to the default Slime*2 troop and allowed out player the option to escape.  The default Eric character is our player, he’s by himself but shouldn’t have any trouble with this simple encounter.

If we stopped here we’d have an event that would allow us to have simple encounter, but it wouldn’t chase our player; nor would it disappear if defeated.  We probably don’t want immortal slimes running around so let’s fix this first.

Self Switch added

Self Switch added

All I did was add a command to set Self Switch A to ON in the event our player wins the battle.  Then I added a second blank page with the condition Self Switch A is ON, like so…

Basic On Map Encounter 3This cause our encounter to disappear if the player defeats the slimes in battle.  Just like that, no more eternal slimes!  But this is still kinda boring so lets make the slimes more aggressive on the map.  This is easy to do, just go back to page 1 of the event and change a few things under Autonomous Movement and Trigger like so…

Now the slimes get aggressive.

Now the slimes get aggressive.

Changing Type to Approach and Trigger to Event Touch means the event, in this case slimes, will move toward the player when both are in the visible area of the map.  If the event touches the player, it runs the event script which in this case starts the battle.  Since I left the slimes moving at x2 Slower, they’re pretty slow and easy to outrun, but you can make encounters move really fast if you wish depending on how you want things to work.

So now you have a basic on map encounter that will approach and attack the player.  If the player wins the battle, the encounter disappears.  But lets do one more thing to dress up our basic encounter before we move to the cooler stuff.  Lets give our on map encounter a “death animation” before it disappears.  This is also easy to do.

Basic On Map Encounter 5All I did was just above the self switch command I added a Show Animation command, which shows on this event, and plays the Water One animation (you can browse the different animations by opening your Database manager and looking at them on the Animations tab).  There are several animations that I could have used but I chose the Water animation since our encounter is a slime and it seemed appropriate and fun to me.

That’s it, we have our basic on map encounter.  Now on to the cool stuff.

Randomizing Encounters

With the basic on map encounter you always get exactly the same encounter.  In the example from above, you always get exactly 2 slimes.  Again, this is kind of boring.  One way to mix this up, literally, is to add some random variety to the encounter.  Its easy to do, but it does require a little preparation.

First we need to think about what encounters we want to have on that map and what kinds of variations we might add.  We’ll do this in our Database on the Troops tab.  Here’s a basic example with only one Troop, the two slimes.

Troops 1What kind of variations could we create.  Well, a simple one is just to add more slimes to the group.  Easy enough, we just drop down to the 002 slot and add 3 slimes, autoname it and presto, we’ve got 3 slimes in a group.

You can create as many variations as you like, just keep in mind you don’t want to make the encounters too tough for your map.  Don’t do anything (yet) that your basic level 1 character (Eric) can’t handle.  I created a couple more for the demo.

TIP: When you create your groups you can move around each creature you add , this lets you control where it will appear on the battle screen.  You can put flying creatures up higher, arrange them in groups, whatever you like.  Have a bit of fun with it and be creative.

Now that we have some different troops we can set up a new encounter that will randomly choose from them.  We’ll start by copying and pasting our basic encounter over to a new spot and then we’ll edit page 1 of the event to add some condition branches and a random variable.

We’ll need  random variable, so we’ll create one and call it Random Number.  We’ll use this to generate and store a random number which our condition events will compare with to see what Troop the encounter turns out to be.

TIP:  In most of my game projects I create a Random Number variable early on because I use it for so many things.  Its a handy variable to have and if you set it aside early as one of your first 10 variable it makes it easy to find when you’re scripting events later.

I have 5 different troop types that I can use.  Three of them I want to have only a 10% chance of appearing, and one of them a 30% chance which leave 40% for the last troop type.  Or something like this

  • 40% — 2*slimes
  • 30% — 3*slimes
  • 10% — 5*slimes
  • 10% — 2*slimes, bat
  • 10% — 2*slimes, hornet

Or another way to look at it would be 1-4 = 2*slimes, 5-7 = 3*slimes, 8 = 5*slimes, 9 = 2*slimes, bat, and 10 = 2*slimes, hornet.

To script this I set my Random Number to be a random number between 1 and 10 (I could do 1 to 100 if I wanted, but for now 1 to 10 is simplest).  Then I start setting condition branches to check to see what troop we get.   These conditions branches are “nested” inside each other.  That is, each has an Else option that it checks if the first condition doesn’t apply.  This takes us to the second condition and so on until the script hits a condition that does apply.  Like so…

Random Encounter 1Notice I started with the rarer events first (10, 9, and 8) and then worked down.  Now you may be wondering why the fourth condition is set to If Random Number is Greater or Equal to 5?  This is why I start with the rarer stuff first.  Since our event has already checked to see if Random Number is equal to 10, 9, or 8 and determined it is NOT any of those number (else it wouldn’t have gotten this far down on the condition branches) it now checks to see if its equal to or higher than 5.  Why, because if its 5, 6 or 7 then we wanted it to use the slimes*3 Troop, which it will.  If after checking all this and the number was not 5 or greater, than it must be 4 or less.  Since 1-4 was to give the slimes*2 Troop result there’s no need for another condition branch, we just use the last Else statement for that encounter.

You can make this table as large as you want depending on how much variety you want to throw at your players.  If you need to, use a larger variable for your Random Number variable and have fun creating.  Since the Random Number is Set each time its used, any previous result is cleared out, so you can use the same variable over and over for all your encounters.

That’s it, now that you’ve got some random variety to your on map encounters let’s take a look at adjusting it according to the level of your main character.

Increasing Difficulty By Party Level

 So far we’ve created on map encounters and learned how to randomize which Troop is actually encountered in each event.  But what if we want the encounters to get progressively tougher as the characters increase in level?  This is useful to know because you might want to create an area of your map where the player can go to grind for experience.  If the encounters increase in difficulty as the character levels up, it will keep the area challenging longer.

Doing this works almost exactly like creating the random Troops, except we’re going to add in the character’s level to the number checked and then adjust our encounter numbers to reflect this.

First, I’m going to make a new Troop in my database that will be more challenging, probably something Eric shouldn’t fight until he’s level 3 or higher.  Behold the dread Doom Slime!  Now let’s edit our event.

Random Encounter 2The highlighted line is the first thing we add to our random troop event.  This Adds the current level of our first actor (Eric) to the Random Number Variable.  Since Random Number is 1 to 10, this gives us a number from 2 to 11+ depending on the character’s level.  If we plan on this being somewhere from level 1 to level 5 then we get a number anywhere from 2 to 15.  We’ll need to remember that when we adjust our condition branches.

I also changed the event graphic from a blue slime to a green one so I can tell on my map which encounters are using this method.

I added a new condition branch for the new Troop type, and made sure all the other condition branches now use the Greater than or Equal to argument.  Otherwise the event is the same as what we created in the random troop types above.

Random Encounter 3Note that the first condition (where our new tough troop type appears) only happens if Random Number is greater than or equal to 13.  Since our Random Number is from 1 to 10, we can only get a 13 if Eric is level 3 or higher (10 +3 = 13).  Thus when Eric is level 1 or 2 he simply can’t encounter this troop type.  Likewise, he won’t see the 2nd troop type until he is at least level 2 or higher.  The third can be encountered when he is level one, but it will be rare happening only 10% of the time.  See how the math works?

This gives us the ability to not only have random encounters and adjust their difficulty, but the chance that tougher things will be encountered actually increases as the character increases in level.  That is, right now in this script Eric will face the 2*slime troop most of the time when he is level 1 (when Random Number is 6 or less).  But by the time Eric is level 4 he’ll see that troop type much less (since the minimum Random Number could be would be 5 (1+4=5) or in other words it drops from being encountered 50% of the time to just 20% of the time.

Pretty useful.

Now for one last trick.

Respawns

Sometimes you do want the monsters to come back, just not right away.  This is called respawning.  You can make your on map encounters respawn and its very easy to do.  This time we’ll edit page 2 of our event, the one we left blank before.  We’re going to add a simple Wait command.

Random Encounter 3I added 3 Wait commands of 600 frames each.  One frame is equal to 1/60th of a second, so 10 frames is = to 1 sec and 600 is = to 10 sec.  Thus this event will Wait for 30 sec and then it will turn the Self Switch A off.

Also, and this is very important, I changed the Trigger to Parallel Process.  This causes this event to run in the background without any further input from the player.  Just be careful about putting too many of these on one map.  If you’re building a grinding area, keep if fairly small and place maybe 10 or 15 of these events on that map.  That way you keep the number of parallel processes running at any given time down to a manageable amount so that your game doesn’t lag.

If you wanted you could also add an animation just above the Self Switch command that would play as it respawns.

That’s it, hope this helped you create some fun on map encounters that have variety and I hope it helps you improve your game design.  Below are the project files for this demo, you can download them and open them in RPG Maker VXA (you must have that program) if you want to look at how I did the events.  Just right click and Save As…

On Map Encounters Demo

twitter

Leave a Reply