Event running when player is off screen

Hello, Im making live action enemies on the map. When they hit player, the player bounces +1 tile.
Problem is when player gets hit by enemy on edge of screen. Causing the player to bounce all the way out of the edge.

Is there a way to check if player is out of bounds. And by that I mean outside the map itself. So that I can teleport player back to the middle of the map or something like that?

I have been looking around but Im guessing this problem is not that common 😛

Thanks in advance
I've done this before with a region common event plug-in. What you do is you mark all zones that are out of bounds with a region, then set it up so that if the player is ever there the engine will run a common event. Use the event to do what you need to do (teleport back).

The only thing is this requires the out of bounds tiles to still be visible and on the map, so you will have to map at least 1 tile of boundary drawn in the editor.
Hello bgillisp! Thank you for the advice, but I don't think its possible to draw regions outside the edge of the map.

If my map size is 10x10 and a enemy has pushed the player to 10x11
Right, you'll have to make the map 1 tile bigger in all directions and add the regions then. That's what I meant by draw the boundary too.

Outside of that there might be a parallel process you can code which will check the player X/Y and return them, then you can do something if they are invalid, but I have no idea if it will let you return values for outside the map completely.

Though...design note. Almost no one uses the edge of the map for anything but transfer to another map, so your player really should never be on tile 10 of a 10x10 map so that they can get pushed to tile 11. Failure to follow that rule will usually just confuse the player in the long run.
Its good to know, thank you. I appreciate 🙂
But in this case this wont work, it will only move my problem 1 tile.

Do you know of a way to check if player is not inside of the 10x10 map?
No. And why would it move the problem 1 tile anyways? Most maps put a boundary at the edge so all you'd need is a region check at the boundary. Unless you have your player walking on the trees, rivers and such that are usually at the map edge.
Well the good things about games is that they are not the same. 😉

I have just a plain field with grass ( no trees or rivers) with a standard map size, in this scenario. And because the enemies are walking towards hero and giving him a bounce of jump +1 in the attack direction resulting in hero being thrown out of the map unable to get back in again. I figured it must be a easy way to check this. I guess I must google around a little more 🙂
Anyways thanks for your feedback
Maybe check the player position before jumping? E.g. something like this for each direction:
Code:
◆Control Variables:#0001 x = Map X of Player
◆If:x < 16
  ◆Comment:Valid position, bump right one tile.
  ◆Set Movement Route:Player
  :                  :◇Jump:+1, +0
  ◆
:End
For more complex maps you could add a check for the region ID of the destination tile, e.g.
Code:
◆Comment:Get region ID of tile 1 space right of player
◆Control Variables:#0001 x = Map X of Player
◆Control Variables:#0001 x += 1
◆Control Variables:#0002 y = Map Y of Player
◆Get Location Info:regionId, Region ID, ({x},{y})
◆Comment:Check that it is not region 1 (obstacle)
◆If:regionId ≠ 1
  ◆Comment:OK!
  ◆Set Movement Route:Player (Wait)
  :                  :◇Jump:+1, +0
  ◆
:End
Ahh nice Caethyril. I will try it. 🙂
Hope it suffices! I didn't realise the engine allowed jumping into impassable tiles or out of the map, good to know~ 😤
I tried and it was a great success! Thanks, I cant find out how I didnt though of that myself, it was genius simple 😀
Great! Happy RPG Making~ 🙏

Original thread: https://forums.rpgmakerweb.com/threads/event-running-when-player-is-off-screen.109631/