Tutorial: Using RegionID in Events

in Tutorials

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?

regionid

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.

Finding RegionID

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.

MapX

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.

LocationInfo

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.

CommonEvent

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.

Map

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.

mapregionid

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”.

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:

ParallelEvent

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!

Comments on this entry are closed.

  • Corey De Agro

    Considering I know nothing about RPG Maker though I do own it and am still trying to think of valid stories to create through it, this actually got me booting it up and sitting down to try and find the commands, etc- creating events and what not. Though it was a bit overwhelming at the start, I was able to follow the tutorial without grabbing the demo and it works.

    10/10 and was quite an enjoyable dive into MV, thanks!

    • Nick Palmer

      Glad that it helped. Check the tutorial category and you should find plenty of simple to follow eventing tutorials!

      It can be intimidating at first, but after a while it becomes super simple.

  • Seth.D

    Wow, I’m really impressed by how simple yet effective this whole setup is! It really goes to show how efficient RPG Maker can be even though it’s so easy to use and get into.

  • LynX

    It’s easy yeah but is there any other way to check player region ? For example via Conditional branch and “Script” check:?

    • Nick Palmer

      I believe Yanfly has a way to do it via plugins that is faster. I just prefer to stick to ways that can be done with pure eventing for tutorials.