Region IDs

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
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.
 

Kaliya

// Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
506
Reaction score
566
First Language
English
Primarily Uses
RMMV
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.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
I see. That's something new, I thought it was the actual coordinates. Thanks a lot.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,863
Messages
1,017,053
Members
137,571
Latest member
grr
Top