Understanding Tile Regions

In this article we go over the “Region” property in your tiles. Tile regions are unique to RPG Maker VX Ace.

It explains what a region is, how you can use them, what RPG Maker uses them for by default, how you can manipulate it for your own purposes, and finally a sample list of what other scripters have been using regions for.

What is a Region

It’s just a number. Really. Take a look at the following diagram:


Working with Regions

The map editor allows you to edit tile regions. To access the region editor, press F7, or press the colourful icon in the toolbar.

You will see 64 different regions available to colour your map with (63 numbered regions, and the Zero-Region which is not numbered).

By default, any tile that does not have a region, is the Zero-Region, with a region ID of 0.

To set a region, simply pick a region from the palette and spread it over your tiles.

Regions and Encounters

A built-in use case for regions is in the map encounter system, which you can access from map properties.

From here, you can choose which regions an encounter will appear in. For example, maybe certain troops only appear in water, or only appear in grasslands. Some troops may be encountered more frequently in certain regions, and less frequently in other regions.


Tile Regions and Events

You can use tile region information in your events. While conditional branches do not support checking a tile’s region event directly, you can accomplish this using variables.

On the third page of the event commands, you will see a command called “Get Location Info”. When you click on it, a dialog will appear asking you what kind of information you want on a particular tile. The tile can be specified directly, or via variables. When this command is executed, it will check the specified tile and store the region in the designated variable. You can then use this variable for other commands such as conditional branches or script calls.

So for example, if you store the player’s (x, y) position in variables 2 and 3, you can designate the tile you want the command to check using those two variables and you will be able to check the player’s current region in your events.


Accessing a Character’s Current Region

If you want to avoid the “Get Location Info” step, you can access the region a character is standing on directly. A character can be the player, an event, a follower, or a vehicle.

The region ID can be obtained via script calls:


You can then use this in your conditional branch’s script call directly. So actually conditional branches do support checking regions.

How Regions are Stored in Data

Region ID’s are stored with each tile. All tile are stored in a Tilemap, which holds all of the information about a map’s tiles including the tile ID’s, terrain tags, various tile properties such as damage tile or counter tile, and of course the region ID.

Tile data is stored in a 3-dimensional RGSS Table with 4 components for each tile. Each component corresponds to a different layer for each tile. Indeed, RPG Maker VX Ace supports layered tiles, but you really only have control over the bottom layer and the top layer (the middle layer is handled by auto-tiles).

These are the four components of a tile:

  1. Tile ID for bottom layer
  2. Tile ID for middle layer
  3. Tile ID for top layer
  4. Shadows and Region ID’s

All IDs are stored as unsigned 2-byte integers. Notice that the region data is stored with the shadow data. This is because regions occupy the upper 8 bits of the integer, while shadows occupy the lower 4 bits.

As an aside, if you do some math, you will see that there are 4 unused bits. I don’t know why this is. It seems like RPG Maker could have supported a lot more regions quite easily with no additional effort or space.

Programmatically Accessing Regions

In Game_Map, there is a method called region_id that returns the region ID of the tile at the specified position.

def region_id(x, y)
  valid?(x, y) ? @map.data[x, y, 3] >> 8 : 0

Here, we can see that the map accesses the 4th component of the tile info and then bit-shifts it to the right by 8. For those that don’t know what bit-shifting is, this is how it looks. I use a region ID of 3 as my example:



The top number shows 768 (in base 10), which is obviously not the right region ID. However, after bit-shifting, we get the number on the bottom, which is equal to 3 (in base 10).

Manipulating Regions

To change the region ID of a tile, you would need to perform some bit-masking on the 4th component of a tile. Remember that this component stores more than just region information; only the high-order 8 bits are used for region. So if you’re manipulating this value, you should remember to keep the other bits intact.

I will assume you understand bitwise operators. We will be using bitwise AND and OR to set our region ID. Here is the general procedure

  1. Pick a number. Let’s say 11
  2. Convert it to binary. That is 0000 1011. This is our new value.
  3. Remember that we are working with 2 byte integers and don’t want to alter the lower 8 bits. So add ones to the end of your number. Now we have 0000 1011 1111 1111. In hex, this is 0x0BFF
  4. Take the original region and apply a 1111 1111 0000 0000 (0xFF00) OR mask to it to mask all the region bits to 1 and leave the other bits intact
  5. Take your new value and apply an AND mask to it. This will turn off the corresponding region bits, while leaving the other bits intact.

In code, it looks like this

class Game_Map
  def change_region_id(x, y, id)    
    mask = id << 8 | 0x00FF # (1, 2, 3)
    data[x, y, 3] |= 0xFF00  # (4)
    data[x, y, 3] &= mask    # (5)

Now you can change regions on your map with a simple script call. More work will be required if you want to preserve these changes when you reload the map.

Other things you can do with Regions

Regions can be used for a variety of things, though having a limitation of 1 region might make it a bit difficult. Here are some scripts that use region ID’s:

  • Map Regions – Create separate “regions” on your map with unique names,  music, battlebacks, and so on.
  • Region Events – Extend an event’s trigger region to any tiles you want using regions
  • Region Fog – hide or show a “fog” over a set of tiles using regions
  • Random Event Positions – use regions to specify where an event may be randomly located
  • Tile Swap – change all tiles in a specified region to a different tile
  • Neon Black’s Terrain Tags – Special visual terrain effects such as moving over or under tiles
  • Yanfly’s Move Restrict Region – Prevent characters from moving onto certain regions

Have a script you want to recommend for this list? Just leave it in the comments or use the contact form.


As you can see, regions are just numbers. But this information can be used in a variety of ways. Understanding how regions work and how you can use them effectively will allow you to create more advanced mechanics in your game.

Spread the Word

If you liked the post and feel that others could benefit from it, consider tweeting it or sharing it on whichever social media channels that you use. You can also follow @HimeWorks on Twitter or like my Facebook page to get the latest updates or suggest topics that you would like to read about.

You may also like...

20 Responses

  1. 90210 says:

    Know Your Loan-to-Value – Loan-to-value, or loan-to-value ratio, will be the term
    used to explain the proportion in the cost of a property that you simply borrow which
    has a home loan. Information online from various brokers with their online facility will
    help you arm with all the right leads. Suppose you might have some debt beneath your
    belt then you’ll need to provide you with the information about it.

  2. They come in various styles and definately will add extra security for the door if you are home.

    You are assured of efficient and timely service when you call a reputed emergency locksmith.

    It is very easy to initially show you your website link at fist but give back
    to your totally different web page.

  3. homepage says:

    With the insurance consultant in your corner, it is possible to relax and stay assured that a specialist helps you.
    A professional service may also be capable to go through the structural
    supports from the home and discover if any damage has occurred
    that may need immediate attention. Self restoration work can be quite tricky and what might appear being a affordable strategy
    to restore a home has decided to result in expenses and losses that may be
    significantly higher than the expense of hiring a specialist fire and water restoration company.

  4. video game says:

    You can further promote to class specializations, which are specific to a particular class type.
    )”If it were not for bad luck in trading, I would have no Luck at all. Just like sports or governments may customize the rules with their game, you can make positive changes to rule book.

  5. Robert says:

    I’ve got the same issues.
    How do we actually implement this script and which variables have to be configured for the script to work the way we want it to?

    Help would be appreciated.

    • Robert says:

      Holy Shit, I actually got it now. After countless google searches and crash courses into RPG Maker scripting.

      You have to insert the script into the Script Manager as is. Afterwards you call it with a script promt and the following syntax $game_map.change_region_id(x,y,id)

      Exchange “x” and “y” for the coords and “id” for your desired id. Done!

  6. Elisson Henrique says:

    I need to manipulate the ID regions of my project, but am I confused where should I put, exactly, the commands that you made available? And how to use it?
    I need to paste this script into its own slot in the Script Editor, above Main but below Materials?
    And, in the game, I used the script call command, with the following code: change_region_id (8, 6, 7), but it gives the following error:

    Script ‘Game_Interpreter’ line 1414: NoMethodError occurred.
    Undefined method `change_region_id ‘for

Leave a Reply

Your email address will not be published. Required fields are marked *