How would you accomplish this? Is there an API call on the Battler or some where else to say: If Actor touches Region, do x, if event touches region do y?
Determine if Event or Actor touched region
Javascript/Plugin SupportNope, you need to check per update on the map by looping through the events ( $gameMap.events() ) and the player (and followers, if you want) to see if they're on the region you're looking for. Keep in mind that if you're using a Pixel Movement plugin, region/terrain tag detection doesn't really work well between the tiles, due to the way the regions/terrains are stored in the map data.
I am not using Pixel Movement plugin, but I can see that this will not be an incompatibility of my script, is there no way to capture what is touching the region at the time it touches it ? My map has both NPC's and a player walking around.
no, the data doesn't work that way - the engine would have to update a new array on movement to store that info, and that would cost even more processing time (not even considering the RAM-use for that data storage) compared to checking it in a simple loop.
Well it would be in the CharacterBase not Battler. What I would do is add in an extra function to the the nonmoving functions for Game_Player and Game_Event or just inside Game_CharacterBase and check if the current position is on X region and if it is then call the function you want it to run when the character is on X region. I would also add in a switch so that function only runs once every position change so it doesn't keep running when the characters are standing on X region.
I actually figured out how to do this, with out running through all the events and the characters and all that jazz. Thanks guys
Original thread: https://forums.rpgmakerweb.com/threads/determine-if-event-or-actor-touched-region.52911/