RPG Maker MV Tutorial: Using Region ID to Transfer Players to Different Maps

Discussion in 'RPG Maker MV Tutorials' started by Grassfur, Mar 2, 2019.

  1. Grassfur

    Grassfur Joyful Creature Member

    Likes Received:
    a game somewhere
    First Language:
    Primarily Uses:
    Hello all!

    Recently I had found myself encountering a rather annoying problem: that of transferring the player to different maps when he/she moves to the edge of said map.

    That is precisely what this tutorial is here to teach you.

    Let's say you have a character in an open field, for example. You do not want a gigantic map, as this causes lag, so you would like to create numerous small maps for him/her to move to. The catch: You want your character to automatically transfer from one map to another merely by walking to the edge of the map, but using many different events to do this takes time, tedious effort, and unnecessary lagging.

    What should you do instead? Use Region IDs!

    Take a look at an example of what I mean if you are confused:

    Let's say you want your character to begin in an open field such as this one:


    Then you want him to move to this map merely by walking to the far left:


    Instead of using a ton of single events, transporting the character to the corresponding points on the next map, you can simply use Region IDs.

    Step 1: Add Region IDs.

    So, assuming you have never used Region IDs, in order to use them, you must first know where they are.

    Simply click the "R" tab in the tilesets to the far left of the RPG Maker window to access Region IDs:


    Now that you can see them, you add them to the map merely by clicking on one of the numbered tiles and painting the area you want (make sure you are in map-editing mode and not event-editing mode). In this case, we will paint the Region ID of "1" on the far left side of our first map:


    Now do the same except for the second map, on the far right side:


    Great! Now... how do you get this all to work?
    Step 2: Create appropriate common events and variables.

    So, the first time I encountered the information on how to do this next step was by following this tutorial (I think it's best to give credit where credit is due): http://blog.rpgmakerweb.com/tutorials/tutorial-using-regionid-in-events/. This tutorial gives a marvelous account of the general use of Region IDs, so if you're still confused about them after my tutorial, you should check it out!

    Now, as mentioned in the tutorial linked above, you will want to set up some very important variables. The first step is to set up a Region ID Common Event. Follow these steps:
    1. Go to "tools", select "database", then go down to "common events".
    2. Create an event and name it "Region ID".
    3. Click on an empty space, and select "Control variables".
    4. Create a new variable named "Player X". Click confirm.
    5. In the operand area, select "Game Data", and go to "Character". Select "Player" in the first drop down, then "Map X" in the second. Click OK to confirm this, and then "OK" again to go back to the Common Event.
    6. Do the same steps (3 through 5) for the Player's Y-position, except name the variable "Player Y" and set it to "Map Y".
    7. Now, click another empty space in the common event, and go to the third page, under the "Map" section. Select "Get Location Info".
    8. Under the "variable" portion, create a new one named "Player Region ID".
    9. Under "Info Type" portion, select "Region ID".
    10. Select "Designation with Variables", and set "X" to the "Player X" variable, and "Y" to the "Player Y" variable. Apply these changes, then click "OK".
    Your common event should look like this:


    The common event ("Region ID") and the variables (Player X, Player Y, and Player Region ID) that you just created will allow for you to call the Region ID and coordinates of your Player using events in the game. But before this is covered, there is a bit more you need to do.
    There are two other common events you need to make that are not described in the tutorial I provided a link for. These common events will allow you to make your Player appear in the correct location when transferring to a new map. Without them, when you go to the far left position of the first map and transfer to the second, you will appear all the way to the left of the second, which you do not want.

    Take a look:


    Instead of appearing in the desired blue circle, you would appear in the undesired red circle. That doesn't make sense, so let's make sure we prevent it.

    The next events we will create are a "Positions for Changing Areas" event, and a Map ID event.

    For the first common event, the Positions for Changing Areas Event, which will control what coordinate your Player appears on in the map, follow these steps:
    1. Go back to common events.
    2. Create one named "Positions for Changing Areas" (or anything else that works for you).
    3. Click an empty space and make a variable called "X-Position for Left Area".
    4. Now, under the operation section, select "set", and in the operand type the value "15" into the box next to "Constant". This value will vary with map dimensions. My maps are 17x13 (see note below).
    5. Next, make another variable called "X-Position for Right Area" and set it to "1".
    6. Now make one called "Y-Position for Bottom Area" and set it to "11".
    7. And one more named "Y-Position for Top Area", set to "1".
    8. Something to note: The values you set for these variables depends on the dimensions of your map. The maps I am using for this tutorial are 17x13. Therefore, I set the value here at "15" because the Player needs to appear 1 space in front of the Region ID on the map, and the x-coordinate at this point is 15 (you can see coordinates by selecting any area of the map and looking at the numbers in the bottom far right corner of the screen). If you were to set the Player to appear on the same tile as the Region ID, then they would continue to warp back and forth between each map, which is not desired.
    Now, after you finish creating your Positions for Changing Areas event, it should look like this:


    Next, create a Map ID Common Event to allow you to call the Map ID.
    1. Create another common event.
    2. Title it "Map ID".
    3. Click on an empty space and select control variables.
    4. Create a variable called "Map ID", and in the operand section, click Game Data.
    5. Go to "other" and select "Map ID". Apply these changes, and you're good.
    The scripts should look like this:


    Now you're all set!
    Step 3: Using the Region IDs to go from one map to another.

    Now that you have your common events, variables, and Region ID locations, you will want to actually use them of course.

    So, you need to create an event that makes this possible (the tutorial I linked above also shows how to do several parts of this as well, though not all of it).
    1. Go to event-editing mode.
    2. Place an event anywhere on your first map (it's best to put it somewhere that you will not need to interact with).
    3. Set its priority to "Below characters", and its trigger to "Parallel" (Parallel allows it to run constantly while also allowing you to control your character).
    4. In the contents, click on an empty space. In tab 1, look under the "Flow Control" section and click "Common Event..."
    5. Select your "Region ID" variable.
    6. Now select another empty spot and do the same, except set the "Common Event" to your "Positions for Changing Areas" variable.
    7. Now, click yet another empty space and select "Conditional Branch" under Flow Control.
    8. In the first tab, select "Variable", and select your "Player Region ID" variable.
    9. Set this to equal 1 (or whatever the number of the Region ID on your map is).
    10. Click OK, then under the "If Player Region ID = 1" line, click an empty space and select "Control Variables".
    11. Select variable "Map ID", and set it to the number of the map you want your character to transfer to (in my case it is 9). This can be seen by selecting your map at the left and looking at the very bottom of the screen. The line "00#:MAP00#" means it is map "#" (i.e. 009:MAP009 is Map 9). This is the same value as your Map ID.
    See the red arrow? [​IMG][​IMG]


    12. Now click another empty space, go to the second tab, and select "Transfer Player" under Movement.
    13. Select "Designation with Variables".
    14. Set ID to your "Map ID" variable.
    15. Set X to your "X Position for Left Area" variable.
    16. Set Y to your "Player Y" variable.

    Hurrah! Your event page should look like this:


    Now, after doing all of these steps, you should be able to walk to the far left corner of the first map and appear on the second map, to the right.

    But you will not yet be able to go back to the first map, so this has to be set up as well.

    I recommend merely copying the event on your first map and placing it somewhere on your second map.

    After doing this, everything in the event should remain the same except the following:
    1. Change the Map ID to whatever your first map is (mine is 8).
    2. For "Transfer Player", set X to "X Position for Right Area" rather than "X Position for Left Area".
    See image:


    Now you should be able to travel between your two different maps (left and right) with ease!

    In order to travel between areas by going to the top or the bottom of the map, you would follow the same steps except with those new maps, and use the variables "Y-Position for Top Area" and "Y-Position for Bottom Area" (which we created variables for) in place of the "X-Position for Left Area" or "X-Position for Right Area". Additionally, you would set X to the "Player X" variable so that X position would remain the same.

    Update: When you make a map allowing your character to go to the top, bottom, left, and right to transfer to different areas, you're going to want to have an event for each. So you would want four events for doing that; each event needs to correspond with the appropriate Region ID.

    i.e. If I set Region ID 1 to transfer to the left, ID 2 to transfer to the right, ID 3 to transfer to the top, and ID 4 to transfer to the bottom, I would need an event for each of these that tells my Player to transfer to the correct map if the Region ID = (corresponding number).

    So what I showed in the tutorial, except three more events (one for each side of the map).

    I also recommend erasing the corner Region IDs, as it may be harder to decide what map to transfer to if, for example, you go to the top far left corner (should you go to the area at the top, or to the left?).


    Happy Gaming! :biggrin:


    Attached Files:

    Last edited: Mar 15, 2019

Share This Page