YEP_EventChasePlayer does not make the Event go back to the original position after switching Event Page.

Hi, I am trying to use the plugin, YEP_EventChasePlayer, to be able to chase the player at LOS proximity. When the Event touches the player, it initiates a battle sequence. When the player chooses ESCAPE, it will pause the Event, allowing the player to have time to get out of sight. When the player is out of the Event's chase range, the Event will go back to its original position by calling Yanfly's $gameMap._events[this.eventId].startReturnPhase() via script command.
Handling Chase sequence:
1589567915062.png

Handling Battle sequence after escaping:
1589567981072.png

Now, this only works if I am using a single Event page. But, when I try to use multiple pages, it no longer put the event back to it's original position.
I am super new to writing codes, but I tried to do a bit of google to understand simple things. And I realized the variables $gameMap._events[this.eventId]._startLocationX and $gameMap._events[this.eventId]._startLocationY gets updated every time the Event switch pages, at least that is what the console log is showing. These two variables are being use by startReturnPhase(). For some reason every time the Event switch pages, it updates the location to where the Event is now after the chase sequence happen instead of just leaving it a lone. I am not sure what I'm doing at the moment, but I thought adjusting the code to something like this would work:
1589568164163.png

but it does not seem to. Any help would be appreciated.
Have you tried storing the spot where the event detected the player into variables? Then, when the event switches back. There might be a way to refrence those variables to tell the event where to go

Edit: The downside to this method is you wouldn't be able to do too many of these events on a map unless you also use a self variables script
Have you tried storing the spot where the event detected the player into variables? Then, when the event switches back. There might be a way to refrence those variables to tell the event where to go

Edit: The downside to this method is you wouldn't be able to do too many of these events on a map unless you also use a self variables script

So ended up using a self variable scripting, as you said. I'd mess and watch a 3-hour tutorial on how Javascripting works, and I edited Yanfly's YEP_EventChasePlayer plugin, and it seems to work now. The Event store's original location at $gameMap._events[this.eventId]._newLocationX and Y. The Event chases the player. On Event touch, it switches to an event page to handle battle and escape sequences. On escape, Event pauses, giving the player to get out of the Event's chase range.

Here's what I add and change just in case anyone spots anything wrong with it or better recommendation.
1589588381960.png


1589588432269.png

1589588491830.png

Handling Chase sequence:

1589567915062.png


Handling Battle sequence after escaping:

1589567981072.png

Original thread: https://forums.rpgmakerweb.com/threads/yep_eventchaseplayer-does-not-make-the-event-go-back-to-the-original-position-after-switching-event-page.121608/