MZ Events triggering when player gets too far away

Wondering if there was a script out there that can have events trigger when the player gets too far away from them (while working off screen)

Or if I can event a way to make an event trigger when the player gets too far away from specific coordinates
the second part is easy - two or four control variables to get the xy coordinates of the player and one position or one event, then use mathematics to calculate the distance and a conditional branch to check if it is greater than the trigger or not.
the 1st part would be harder, which probably need a "face" direction.
as to far in front would be the same as to far behind.

someone tried this, but a direction of the event needs to be checked
in order to make this work, and in what purpose?

do you want it a square, circle, line of sight etc?
Wondering if there was a script out there that can have events trigger when the player gets too far away from them (while working off screen)

Or if I can event a way to make an event trigger when the player gets too far away from specific coordinates
Parralel process that saves the players coordinates as a set of variables, then sees if the x or y is too far away from the event's, if yes, flip self switch to the event code.
Wondering if there was a script out there that can have events trigger when the player gets too far away from them (while working off screen)
Now there is 😉
[RMMZ] Player's Too Far Away from Event - Plugin: Click Here to View

1649718032066.png

To enable place something like this in an events notebox:
Code:
<far:!$gameSelfSwitches.value([$gameMap._mapId, this._eventId, 'A'])&&!$gameSelfSwitches.value([$gameMap._mapId, this._eventId, 'B'])>
That code says if not selfswitch 'A' and not selfswitch 'B' run the event if the player is too far away
Spoiler: Example Event Setup
1649718806159.png

1649718823559.png

1649718841093.png
Is this like what you were asking for?

I could further customize this also.
Basically I just reversed my chase player plugin 😉
Now there is 😉
[RMMZ] Player's Too Far Away from Event - Plugin: Click Here to View

View attachment 222946
To enable place something like this in an events notebox:
Code:
<far:!$gameSelfSwitches.value([$gameMap._mapId, this._eventId, 'A'])&&!$gameSelfSwitches.value([$gameMap._mapId, this._eventId, 'B'])>
That code says if not selfswitch 'A' and not selfswitch 'B' run the event if the player is too far away
Is this like what you were asking for?

I could further customize this also.
Basically I just reversed my chase player plugin 😉
uh. yea thanks. Can it work like this with different distances for different events?
uh. yea thanks. Can it work like this with different distances for different events?
No prob. ☺️
I had a feeling you might want that. lol

Updated to v1.10 and added such features 🙂

To change from the default distance use the following comment(s) in the event page:
<away_distanceX: x>
<away_distanceY: x>

Example:
<away_distanceX: 3.8>
<away_distanceY: 3.8>

The parameter of that can also be javascript 😉

Spoiler
1649733282392.png
Spoiler
1649733312117.png

Let me know how it goes. Should work as you need 🙂

Original thread: https://forums.rpgmakerweb.com/threads/events-triggering-when-player-gets-too-far-away.146652/