You’ve just gotten started with RPG Maker MV, or maybe you’ve been using it for a while. You know what that RegioinID Layer is for. It’s for determining monster areas, right?
And you are right. that is the most immediate use of it. But there is more. You can do so much more. Events can also reference RegionID. So, let’s look at how that can be used.
The first thing we need to know how to do is to determine the RegionID of the map tile the player is standing on. This is something you will be using over and over again once you know how, so I suggest making this into a Common Event. Common Events can be called from other Events. That way, instead of putting these lines of code in every time you need to check, you can just put in one line “Call Common Event” and it will do it for you.
There are three variables you will need to store to get a player’s RegionID. Like I’ve mentioned before with generic count variables, this is so common, I almost suggest the first three variables in every single game be these: Player X, Player Y, and Player RegionID.
The first command you will need is Control Variables. Use the Game Data Operand to set variable Player X to Map X of Player. This will store the Player’s X coordinate on the map in the variable.
Repeat this process with variable Player Y and the operand Map Y of Player. Now we have the coordinates that the Player is standing on. With that, we can determine what the RegionID of that tile is. All we need to do is use the Get Location Info command, tell it to store in the Player RegionID variable, select Info Type Region ID, and use variable designation, picking Player X and Player Y.
And with that, I have a Common Event that I can call from any Event that can immediately grab the Player’s X and Y coordinates, and what the RegionID of that tile is.
But what can we USE that for?
Example Use: Arrow Flooring
A mechanic seen in tons of games, you are in an area, there are floors with arrows on them, and when you step on the arrows, your character is pushed in the direction indicated.
Now, you could do this with just a bunch of events. There is no need to check RegionID; you could just have each arrow be a Player Touch Move Route Player in X direction event. But what if I told you it could all be done with ONE event.
First, draw out your floor plan and your arrows.
This is an incredibly simplistic map, but it’s perfect for showing off the process.
The next step is to assign each direction arrow a different RegionID, in my example, I’m going to use the following:
- Right: 1
- Down: 2
- Left: 3
- Up: 4
Take your RegionIDs and paint them on the appropriate arrows.
So now, instead of making every arrow an event, all we have to do is make ONE parallel process event that moves the player around based on what RegionID he is standing on.
So open up a new event (I’m partial to placing them in the upper left corner when they are invisible behind the scenes events myself), and set it to Parallel Process. Remember, Parallel Process Events will run in the background indefinitely as long as they are active.
The first thing it needs to do is record where your character is standing. To do that, we just need to call our common event with the command appropriately titled “Call Common Event”.
After that, it’s just a series of easy conditional branches. If Variable “Player RegionID” = 1 Move route: Right, If 2, Move down, if etc. Remember to unselect Wait until finished. This prevents the character from taking control between two tiles.
After you are done, you should have an event that looks like this:
With this event, we’ve cut the number of events on the map DRAMATICALLY. It also makes bugfixing faster. If you have a problem with the Event, you can edit just this one, rather than having to edit every single iteration of the Event on the map.
You can also check the demo version of this project HERE, for a better understanding of the process.
There are tons of ways to use RegionIDs in eventing, can you think of more? Have any questions about the process? Can you think of any way to improve this? Tell us in the comments below!