Region IDs

I would like to ask how to get the exact region id?

The ones on Game_CharacterBase and Game_Map gives me x and y. What I am looking for, sadly, is how can I set Region ID #1, #2, #3. What I mean is, I want to do something for each region. I want to detect if the character is under region id #1 for example.

Any help is appreciated.
The proper way is to use

var region = $gameMap.regionId(x,y);The X and Y are the grid coordinates on the map, not the actual bitmap coordinates. So if you have a map that is 15x18 it would be within that range.
I see. That's something new, I thought it was the actual coordinates. Thanks a lot.
The method needs the coordinates, and will return the region at those coordinates.


The Game_Character and Game_Player regionId function save you from having to pass the coordinates, and just look at where the player or event is and grabs the info from there.


So $gamePlayer.regionId() will return the region on the tile where the player is standing.
I want to detect if the character is under region id #1 for example.
You would check the character's region directly and compare it with your desired value

Code:
Game_CharacterBase.prototype.regionId = function() {    return $gameMap.regionId(this._x, this._y);};
For example
Code:
$gamePlayer.regionId() === 1$gameMap.event(2).regionId() === 2

Original thread: https://forums.rpgmakerweb.com/threads/region-ids.54776/