How to make a teleport by region number to another map.

How can i determine a teleport target inside that map?
You write a script that loops through every coordinate on the map and checks if that coordinate is region id x. If it is, set player's position to that coordinate.

Presumably you only have one coordinate of that region, otherwise it will set the player's position to the last coordinate that meets that criteria. Or you can break the loop at the first result.
anyway you can event it.
the simplest form would be to loop through the entire map chacking each tile

but it depends on what exactly you want to do, and what data you saved from the previous map.
for example you could have saved the old position as well as the old region, then loop through only the area around those coordinates while looking for an equal region number.

and most likely each map will have a slightly different algorithm based on what the map is like - we can't tell you how to do this because we don't know how it should work in your game
I did a brute force check in the autorun event.
Just a chain of invisible motorcycles rides from the bottom up and when they find such a region, they teleport the character there and destroy themselves.

Thank you all very much!

Scripts and tips helped, and I even watched all the videos!🙂🙂🙂
If I have two identical maps, I can save the coordinates and move to the same point from where I teleported, but to another map.
But the fact is that the maps are different and I can teleport into a wall or furniture.

Therefore, I need to split into regions and appear approximately in the area from where I teleported. Let's say I can switch to another map and I have the number of the region to jump to.
But for that, I need the coordinates of the map. How can i get location info (Tile ID) from region ID????

The way I'd handle this problem would be to simplify it.

I would identify a few designated "safe" teleport destinations on each map.

Then, when the player tries to teleport, use a formula to determine which designation on the target map is most suitable based on the current player coordinates.

You can save each map's target teleport locations to variables (or set them as self-variables in an event on that map using a self-variable plugin to keep things cleaner) , and get the player current coordinates using a script call.

Then, you can just have some conditions that, depending on whether the X and Y are within specific ranges, teleports the player to the appropriate pre-set location on the other map.

If you are willing to move the player's destination to avoid walls and obstacles in the first place, I can't imagine it would be that big of a change to make them arrive in a more limited range of target locations in general. You can set as many target possibilities as you want, depending on the map size.

Of course, if you have like 200 maps this might not be worth the work. It would depend on your game.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-teleport-by-region-number-to-another-map.164656/