Move route interruption and restore?

Hello there!

I'm trying to make a patrolling NPC (custom move route) between 2 houses, the player has to move between roofs without sliping to the floor tiles or calling the npc's attention for too long. I set this with Region's ID, floor tiles ID1, roof tiles ID2 .and Mog's  Sensor Range Script (wich makes nearby events activate their self switch D if the player is at X distance from it)

Basically, if you step on region 1, the npc runs towards you and game over,

on region 2 activates a stepping sound

Set the npc range detection to 1 (will activate switch when standing beside it) so when you're walking on the edge of the roof and the npc walk's "below" you, it looks towards the player and stares as if it had heard something.

So far so good, everything works except that after I trigger the NPC's self switch D by standing in range and then walking out of it, the npc will start the custom move route all over again, screwing up the patrol positioning. Is there any way I could 'label' the step in the move route it was on before activating the self switch D(walking beside the event), and then 'restore the label' when it turns OFF (walking away) so it resumes the move route as intended?

Is there a way to make it so that after the Self switch D is activated, if not deactivated in X seconds its game over, to make it look as if the npc sees you if you dont hide quickly?

Im not sure if I explained myself proprely, I could load SS if needed ñ___ñ
Unfortunately, when a new page is activated in an event, its move route runs right from the beginning. You could solve it in one of two ways, both quite difficult:


- use a move route to move your NPC back to where they started, before changing the self switch to make the previous page active. This could be difficult as you may not know exactly where the event will be when it needs to move back to the start.


- get someone to write a script for you that will save the current step of a move route, and when that page is activated again, continue the move route from its last position. However, if the event has moved from that last position, you will still have to move it back again before it can continue from where it was. Also, you would be making an assumption that page 1 is active (has the regular move route), page 2 becomes active (conditioned by self switch D) and the step in the move route is saved, and then it goes straight back to page 1 again. In reality, any one of dozens of other pages, each with their own move routes, could become active in between. So again, you have no guarantee that saving the current position in the move route will work, because you can't be sure the event will stay in that position while that page is waiting to become active again.
Is there a way to make it so that after the Self switch D is activated, if not deactivated in X seconds its game over, to make it look as if the npc sees you if you dont hide quickly?
Well remembering move route locations and restarting them is a bear for sure.
And a Self-switch means it would affect the event page, but why not a global switch?


and... How quickly is quick?


I use a switch throw in a mine cart move route and maybe it would work in this application, but it would have to be that the player can hide in one step. Like the guard turns his head and you move away now! If you are willing to be a slave to the processor time and the really fast pace, it might work; it is hard for me to tell, sorry. You can have a switch be thrown in the move route which gets turned back after checking if the player is "safe" or not in a parallel process. I have a demo if you want to see it, but of course it is of mine carts jumping.


/me hopes Shaz will weigh in if I am missing the point or something...


************edit****************


or couldn't the switch open an event page in the parallel process which starts a timer? and checks if the player is in "safe" area after the timer runs out?
Hey thanks for the answers! I guess I'm being greedy for all these reactions I want to set to the npc, I'll just have 2 kinds set on the map, the patrolling one which will have no reaction to the player being near, just if he steps on a defined region, and another 'standing and turning' one that reacts to the player being near, making use of Grandma's system... though I didnt really get what you ment... could you share the demo? I'll study it and modify it to what I need. I hope I'm not bothering too much 🙁  

Thankyouthankyouthankyou lovely doves.

Original thread: https://forums.rpgmakerweb.com/threads/move-route-interruption-and-restore.15413/