Enemy patrol then chase and patrol again

Hi everyone,

I’m trying to figure out how to make a guard/enemy behave like this:
  • The guard starts by patrolling on the map using a custom move route;
  • If the player enters the guard’s field of vision, the guard chases the player;
  • If the guard touches the player, a battle starts;
  • If the player manages to escape (by staying out of sight for a few seconds), the guard goes back to its original position and resumes the patrol.
I’ve already downloaded and tested several plugins (Yanfly’s EventChasePlayer, Galv’s EventDetectors, and Vlue’s Proximity), but none of them allow me to combine all of this: patrolling + chasing + returning to patrol after losing sight of the player.

If anyone could help me or point me in the right direction, that would be amazing! I’ve searched the forum and YouTube a lot but haven’t found any clear solution yet.

Thanks in advance!
I think the most obvious way to do this would be to split the event into 3 pages.

Page 1: the guard patrols around the map using a custom move route. It's set as parallel, and the commands check the player's proximity and switch to page 2 (via self switch) when the player is in range.

Page 2: the guard approaches the player. Again, it's a parallel page that switches to page 3 if the player moves out of sight for long enough.

Page 3: the guard returns to its original position. I think the best way to do this is this.step_toward from Galv's Move Route Extras. Yet again, it's a parallel event – this one checks the event's own location and switches back to page 1 once it's on the target location. Maybe it also checks the player's proximity and switches to page 2 if they come back into view.

I can see at least 2 problems with that approach, but I think it might be enough to get you started?

The problems are:

  1. Page 2 is not Event Touch, so actually triggering the battle might get a bit tricky.
  2. Setting an event to parallel will (if I'm not mistaken) cause it to draw above star terrains.
I think the most obvious way to do this would be to split the event into 3 pages.

Page 1: the guard patrols around the map using a custom move route. It's set as parallel, and the commands check the player's proximity and switch to page 2 (via self switch) when the player is in range.

Page 2: the guard approaches the player. Again, it's a parallel page that switches to page 3 if the player moves out of sight for long enough.

Page 3: the guard returns to its original position. I think the best way to do this is this.step_toward from Galv's Move Route Extras. Yet again, it's a parallel event – this one checks the event's own location and switches back to page 1 once it's on the target location. Maybe it also checks the player's proximity and switches to page 2 if they come back into view.

I can see at least 2 problems with that approach, but I think it might be enough to get you started?

The problems are:

  1. Page 2 is not Event Touch, so actually triggering the battle might get a bit tricky.
  2. Setting an event to parallel will (if I'm not mistaken) cause it to draw above star terrains.
Thanks, I'm currently trying to apply your advice but I'm still struggling with setting conditions based on the event seeing the player or losing him during the chase.

I don't really understand how to implement these conditions since the Yanfly’s EventChasePlayer plugin works with script commands in the custom movement route window.

For now, I managed to make the enemy patrol with a parallel page (but the loop setting doesn't seem to work everytime so the enemy stops his patrol at the end of the movement route) and chase the player for a certain amount of time. If the player escapes, the enemy walks back to where he got stuck in the first place and stops moving.

Thanks again for the help!
Take a look at this playlist: playlist
Take a look at this playlist: playlist
Thanks, I already watched a few videos from this playlist a while ago and I remember that this youtuber doesn't really talk about patrolling but just about detection and following the player for some time. Even in the "patrol, spot & chase in 3 ways" video, he ends the video without showing how to make the enemy patrol (he's just standing there and waiting for the player to enter his field of view).

As I said, I already managed to make the enemy patrol, chase the player and go back to where he was patrolling but I'm struggling with making the enemy go back to patrol and not just standing there.

Maybe I'm not understanding the possibilities this youtuber's method is giving but it seems to me that he's not precisely talking about my problem :/

Original thread: https://forums.rpgmakerweb.com/threads/enemy-patrol-then-chase-and-patrol-again.180304/