I know there's already a lot that can be done with regions-- setting collisions, restricting movement, adding interactive terrain and so on. I also know how they are stored in the $dataMap file... but I want to know if it's possible to add more functions to make it easier to search a map for region information, like an easy way to get the location of those tiles. Basically, a way to do the opposite of the $gameMap.regionId(x,y) function: finding the x and y values of region tiles in a (hopefully) efficient manner... and then being able to use that information for practical purposes...
An in-depth description of what I hope to use it for is detailed in this topic, in case it makes my train of thought any clearer... however I'm not really looking for answers to that problem specifically, because I'm clearly lacking a more fundamental understanding of the features of RMMV.
(I know it's in the "plugin requests" section, but I'm really the type that likes to do everything by herself and not knowing how to solve this is seriously bugging me so I'd rather get clarification than have someone magically solve things for me. There are other things I want to do with regions, anyway. so many questions that i think it would be overwhelming to ask all of them in a single topic)
Right now, I'm just trying to get a grasp on how versatile the region feature is, really, and what its limitations are.
From what I understand of the default code, the engine ignores regions completely unless the player is standing on top of one, or if you check for an id by manually pointing to an x,y coordinate (whether it be the semi-arbitrary like coords of an event, or static like a couple of inputted number values).
By default, you can't check if the player or an event is fenced in by a region (only if it's standing on top of a filled-in region area), or if it's standing between 2 different regions, etc. Region restriction scripts that I've looked at don't really activate unless a character is adjacent to a restricted region/tries to move onto it, which is basically the same as how the engine handles regular tile collision.
You also can't simply say "hey game, return ALL tiles marked with region (0-255) with an X value of 7". In order to do that, as far as I know, you'd have to add a function that loops through ALL tiles of the map and then stores their values into a large array/object(s), and then have it search every one of those indexes for matching X and region ID values.
I know javascript is supposed to be pretty fast, but the above method feels pretty redundant to me, when that data should already be stored in the $dataMap object (which can be retrieved using $dataMap.data[(5 * map height + y) * map width + x]). in a 50x50 map, (7,1) is 12557 and (7,2) is 12607 and so on. But for the formula to work it still needs a specific coordinate so it knows what index to look for in that massive array of tiles, unless you go back to the looping method to return everything into an array. Is that really the only way? I see the pattern there, but... is it really a practical way to do it? My worry is that it affects performance. Chances are I am looking at the problem from the wrong angle entirely.
An in-depth description of what I hope to use it for is detailed in this topic, in case it makes my train of thought any clearer... however I'm not really looking for answers to that problem specifically, because I'm clearly lacking a more fundamental understanding of the features of RMMV.
(I know it's in the "plugin requests" section, but I'm really the type that likes to do everything by herself and not knowing how to solve this is seriously bugging me so I'd rather get clarification than have someone magically solve things for me. There are other things I want to do with regions, anyway. so many questions that i think it would be overwhelming to ask all of them in a single topic)
Right now, I'm just trying to get a grasp on how versatile the region feature is, really, and what its limitations are.
From what I understand of the default code, the engine ignores regions completely unless the player is standing on top of one, or if you check for an id by manually pointing to an x,y coordinate (whether it be the semi-arbitrary like coords of an event, or static like a couple of inputted number values).
By default, you can't check if the player or an event is fenced in by a region (only if it's standing on top of a filled-in region area), or if it's standing between 2 different regions, etc. Region restriction scripts that I've looked at don't really activate unless a character is adjacent to a restricted region/tries to move onto it, which is basically the same as how the engine handles regular tile collision.
You also can't simply say "hey game, return ALL tiles marked with region (0-255) with an X value of 7". In order to do that, as far as I know, you'd have to add a function that loops through ALL tiles of the map and then stores their values into a large array/object(s), and then have it search every one of those indexes for matching X and region ID values.
I know javascript is supposed to be pretty fast, but the above method feels pretty redundant to me, when that data should already be stored in the $dataMap object (which can be retrieved using $dataMap.data[(5 * map height + y) * map width + x]). in a 50x50 map, (7,1) is 12557 and (7,2) is 12607 and so on. But for the formula to work it still needs a specific coordinate so it knows what index to look for in that massive array of tiles, unless you go back to the looping method to return everything into an array. Is that really the only way? I see the pattern there, but... is it really a practical way to do it? My worry is that it affects performance. Chances are I am looking at the problem from the wrong angle entirely.