Is it possible to teleport the player a certain distance from their current location?

To elaborate, what I'm asking is if it is possible, instead of directly teleporting the player to specific coordinates, I want to teleport the player a specific distance upwards from where they are.

I'm not sure if this makes any sense but I thought I'd ask.
control variables: Map ID
control variables: Map X of player
control variables: Map Y of player

then subtract a number from the Map Y of player variable (number of tiles you want to move up)

Transfer player: -> to the variables above
control variables: Map ID
control variables: Map X of player
control variables: Map Y of player

then subtract a number from the Map Y of player variable (number of tiles you want to move up)

Transfer player: -> to the variables above
This is only half the equation, because transfer player does no sanity checking and you obviously don't want to teleport the player into walls, so you will also have to check whether the player is able to pass into/from the destination tile.
Well true, but it depends where/how they use the event. They might use it in a way that it's not necessary to check for passabilities.

But if they want, they can add the:

$gameMap.isValid(x, y) <- check bounds

$gamePlayer.canPass(x, y, direction) <- check if you can pass

EDIT: or mark region IDs where you can't teleport and check if the tile has that ID
Well true, but it depends where/how they use the event. They might use it in a way that it's not necessary to check for passabilities.

But if they want, they can add the:

$gameMap.isValid(x, y) <- check bounds

$gamePlayer.canPass(x, y, direction) <- check if you can pass

EDIT: or mark region IDs where you can't teleport and check if the tile has that ID
I can't conceive of any method of doing this via which you wouldn't need to check passability.
Well true, but it depends where/how they use the event. They might use it in a way that it's not necessary to check for passabilities.

But if they want, they can add the:

$gameMap.isValid(x, y) <- check bounds

$gamePlayer.canPass(x, y, direction) <- check if you can pass

EDIT: or mark region IDs where you can't teleport and check if the tile has that ID
You could also do a terrain tag check so you don't need to paint your map with region ids.
Ah, man, things have really come a long way since the 2000/2003 days, where I would have to rig up an event, teleport it to the player's position, record its coordinates, make it jump to the desired position, and check the coordinates again to see if they have changed or if an impassable tile has blocked the jump from going through.

The miracle of technology.
I can't conceive of any method of doing this via which you wouldn't need to check passability.
I might be wrong but I don't think I need to as I am using this to teleport the player to a nearly identical map above the map the player starts on. I needed them to teleport up a certain Y distance so that the player will be in the same location relative to the old map if that makes any sense. So I don't think that the player should ever be able to teleport inside walls or something, so I believe the original solution that @rpgLord69 gave should work perfectly. (Btw thanks for that, right now it seems to be a perfect solution).
Again I might be completely wrong and RPG Maker might work completely differently than what I thought but that is my thought process.
Ahh, so it's not a thing like Blink, it's that you need to offset Y by a specific amount.
I might be wrong but I don't think I need to as I am using this to teleport the player to a nearly identical map above the map the player starts on. I needed them to teleport up a certain Y distance so that the player will be in the same location relative to the old map if that makes any sense. So I don't think that the player should ever be able to teleport inside walls or something, so I believe the original solution that @rpgLord69 gave should work perfectly. (Btw thanks for that, right now it seems to be a perfect solution).
Again I might be completely wrong and RPG Maker might work completely differently than what I thought but that is my thought process.
I know this is solved and all, but may I ask why you specifically need to teleport a specific distance instead of using an event to teleport to a different spot on the map? I feel like that would be simpler, no? Or does it need to be something you can flexibly do from any given point on the map such as through a common event that is called via item? Because if it's set locations that do the teleport, then surely just teleporting to the points you want would be more simple, no?
I know this is solved and all, but may I ask why you specifically need to teleport a specific distance instead of using an event to teleport to a different spot on the map? I feel like that would be simpler, no? Or does it need to be something you can flexibly do from any given point on the map such as through a common event that is called via item? Because if it's set locations that do the teleport, then surely just teleporting to the points you want would be more simple, no?
I'm not sure exactly how to explain this but I'll try my hardest.
Basically, on every map I have two versions of the same map but with different tiles so they look different but have the same layout, for example, they'd both be L shapes but one looks dark and dreary and the other looks pristine. One version of the map is 10 tiles above the other one so that you can't see one from the other. The gameplay is when you press a button on your keyboard, which can be done anywhere on the map, it will teleport you between the two, so I need to make it look like the map has changed instead of it looking like you have teleported to a different map. To do that I need to make sure that the player is in the same place where they teleport to, as when they left. To accomplish this I need to teleport the player 10 y higher so that they go from the bottom map to the top map but appear to be in the same location. (For example, if they were in the bottom right corner of the lower map, they would teleport to the bottom right corner of the top map.) If I teleported the player to a target spot on the map they could be standing in the top right corner but teleport to where I set it to be and it would be obvious that they moved.

I really hope that at least sort of makes sense, and maybe I completely misinterpreted what you were asking, but I am happy to say that at least right now this solution is exactly what I need to hold the illusion that I'm looking for.
No that makes complete sense. My method recommendation would only have worked if you were fine with fixed locations. But since this seems to need to be dynamic... yeah, the previous method is probably the better of the two. Sorry for the pointless question! I was just curious but should have figured my idea wouldn't work. I hope you enjoy your day!
Some advice: You should probably try to code in that collision check anyway.

You might decide down the line that you DO want to introduce minor changes in geometry between the two versions of the map, for puzzle purposes. In that case, you would benefit from having future-proofed your design. And if you don't, it's no detriment that the check is in anyway.
I'm not sure exactly how to explain this but I'll try my hardest.
Basically, on every map I have two versions of the same map but with different tiles so they look different but have the same layout, for example, they'd both be L shapes but one looks dark and dreary and the other looks pristine. One version of the map is 10 tiles above the other one so that you can't see one from the other. The gameplay is when you press a button on your keyboard, which can be done anywhere on the map, it will teleport you between the two, so I need to make it look like the map has changed instead of it looking like you have teleported to a different map. To do that I need to make sure that the player is in the same place where they teleport to, as when they left. To accomplish this I need to teleport the player 10 y higher so that they go from the bottom map to the top map but appear to be in the same location. (For example, if they were in the bottom right corner of the lower map, they would teleport to the bottom right corner of the top map.) If I teleported the player to a target spot on the map they could be standing in the top right corner but teleport to where I set it to be and it would be obvious that they moved.

I really hope that at least sort of makes sense, and maybe I completely misinterpreted what you were asking, but I am happy to say that at least right now this solution is exactly what I need to hold the illusion that I'm looking for.
Your maps must be super small on the Y axis if going up 10 tiles is enough to switch to the other map but you can't see it from the top of the bottom one. 😛
No that makes complete sense. My method recommendation would only have worked if you were fine with fixed locations. But since this seems to need to be dynamic... yeah, the previous method is probably the better of the two. Sorry for the pointless question! I was just curious but should have figured my idea wouldn't work. I hope you enjoy your day!
It wasn't a pointless question! I just didn't explain it correctly or in a way that made sense before.
Your maps must be super small on the Y axis if going up 10 tiles is enough to switch to the other map but you can't see it from the top of the bottom one. 😛
That was just an example, in reality after I'm done with the maps I can shift them all to be the same distance, or change depending on what map the player is in. As a start, I set the top one 50 y above the lower one, but yeah I will change that once I have finished the maps.
Some advice: You should probably try to code in that collision check anyway.

You might decide down the line that you DO want to introduce minor changes in geometry between the two versions of the map, for puzzle purposes. In that case, you would benefit from having future-proofed your design. And if you don't, it's no detriment that the check is in anyway.
I agree completely, but because I am extremely new to RPG Maker, and the suggestions for collision check that the others have suggested completely fly over my head and I couldn't understand what they were suggesting to do, so I was planning, for now at least, to just work with what I have and what I know how to do. Then later, when I decide to do a puzzle like that because it would make things more interesting, to revisit it and add the collision check-in. I was also thinking about just making it not possible to go between the two areas in situations like this because I know how to do that, and I think it'd be smoother for the player, but I'm not sure.
Here's a way you can do it, based on what @rpgLord69 has said in this thread:

1691464218521.png


If you look at the tile palette, there is a tab labeled "R" that takes you to this colorful number raster. Using this you can paint Regions onto your map. The regions themselves will be invisible during gameplay, but you can use them for various checks.

1691464388288.png


Pick a number you like, then paint all tiles you DON'T want your player to be able to teleport to with this number. You can draw the outline of your room and use the fill tool to help you out, just like with regular tiles.

1691464529129.png


Grab two variables you want to store the player coordinates in. Subtract 10 from the Y coordinate, since you want to check the tile 10 spaces up from the player character. Then use Get Location Info to read that tile's Region ID. And store it inside another variable. If the tile can't be teleported to, the command will read the Region ID you painted onto it and store its number inside that variable.

1691464726520.png


Now you've set everything up that's needed to check whether the teleport is valid. Create two conditional branches that are nested within each other. In one of them, check whether the variable you stored the Region ID is in is NOT EQUAL to the Region ID you painted onto your impassable tiles (1 in my example). Here, if the variable is NOT equal to 1, that means the tile is free to teleport to.

In the second conditional branch, go to tab 4 and select "script". Paste the following into the text field:

Code:
$gameMap.isValid($gameVariables.value(10), $gameVariables.value(11))

Except change the arguments "10" and "11" to the IDs of the variables that hold your x and y coordinates. This will check whether the coordinates stored inside those variables fall outside of the map boundaries, and thus wouldn't be a valid target for teleporting to. If the coordinate does lie within map boundaries, it will return "true" and the location is deemed valid.

1691465151056.png


Once you've done all this, you put the stuff that actually teleports your player into those conditional checks. You may have to set another variable to the ID of the current map so you can use the "Transfer player" command with variables instead of a direct designation.

Hope this helps.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-teleport-the-player-a-certain-distance-from-their-current-location.160072/