Event chase player using events

Hi guys!!

So I'm trying to make a system that, when an event sees the player, it chases him. Just like Eventchaseplayer Plugin by Yanfly, but using only events, since I can't use this plugin for reasons that it conflicts with other plugins that I'm currently using.

I got 50% of what I want to work, But there are some points that I can't solve by myself. One of them is how to make it so that when the event stops seeing the player, it stops the chase and returns to the initial position of the event.

And also, the chase is not perfect, because the event gets stuck in corners.
I try to use this script call, but things starts to lagging (I'm using AltimitMovement plugin so that's why it is lagging, when I turn it off it works fine, but this pixel movement is really important for my project):
Code:
$gameMap._events[this._eventId].moveStraight( $gameMap._events[this._eventId].findDirectionTo($gamePlayer.x, $gamePlayer.y));

So I have to use a different approach. Can someone help me with this?

I followed this tutorial by TheOdie, about line of sights, for my event:



First page and up like this:

Screenshot 2025-04-15 000715.png


The red portion was replaced by this:
Screenshot 2025-04-14 235840.png

There is more information about those script calls here

And I create a second event page that make the event chase the player:
Screenshot 2025-04-14 235914.png
line of sight can be tricky and I use a plugin for that.
for chasing part, you can use [this] simple plugin (not sure if it works with altimit).
If you're using Altimit use Dahlys Distance Calculator for line of sight. It's on the first or second page of the Altimit thread.

Edit: here
Post in thread 'Altimit Pixel Movement [0.50β]' https://forums.rpgmakerweb.com/index.php?threads/altimit-pixel-movement-0-50v.85408/post-788915

As for pathfinding, it's honestly one of RPG Maker's weak points. All the plugins use grid-based A*, and why other engines are better for fluid map movement that avoids obstacles with no lag with boids movement, navmeshes, etc. It's a processor intensive process and has a tendency to make the game lag if you use it.

That said TyrusWoo Follower Control has a pathfinding script call you can use on followers or events that works with Altimit. The Miyuki plugin does too.
If you use the Miyuki plugin you can fix the Dir8 error (from the comments)
To fix the Dir8 issue, change line 174 of the script from !Maki.Params.Dir8 to !Maki.AM.Dir8.
If you're using Altimit use Dahlys Distance Calculator for line of sight. It's on the first or second page of the Altimit thread.

Edit: here
Post in thread 'Altimit Pixel Movement [0.50β]' https://forums.rpgmakerweb.com/index.php?threads/altimit-pixel-movement-0-50v.85408/post-788915

As for pathfinding, it's honestly one of RPG Maker's weak points. All the plugins use grid-based A*, and why other engines are better for fluid map movement that avoids obstacles with no lag with boids movement, navmeshes, etc. It's a processor intensive process and has a tendency to make the game lag if you use it.

That said TyrusWoo Follower Control has a pathfinding script call you can use on followers or events that works with Altimit. The Miyuki plugin does too.
If you use the Miyuki plugin you can fix the Dir8 error (from the comments)
Thanks! I will try those plugins too. But the line of sight is pretty much solved using those script calls that I mentioned, it works fine with Altimit. I’m actually having trouble with the fact that I want the event to stop chasing the player after fell steps (or even after a certain time) and go back to his original position. Maybe a script that store his initial position on the map and make the event go back there.

Sorry if I didn't make that clear on my first post.
I want the event to stop chasing the player after fell steps (or even after a certain time) and go back to his original position. Maybe a script that store his initial position on the map and make the event go back there.
You'd do the same thing as I said in the other thread about Restart's alternative to Yanfly Event Chase. Have two separate event pages for the regular movement and the chase movement and have a toggle self switch script wrapped in the distance checking function.

All you're doing is using some pathfinding script call instead of Restart's goTowardsPlayer script call. Everything else is exactly the same
You'd do the same thing as I said in the other thread about Restart's alternative to Yanfly Event Chase. Have two separate event pages for the regular movement and the chase movement and have a toggle self switch script wrapped in the distance checking function.

All you're doing is using some pathfinding script call instead of Restart's goTowardsPlayer script call. Everything else is exactly the same
Well, I am very new into events, So I don't know how to make this to work. I did a lot already, and my brain kind hurts lol. I think I will step back and try to work in other things in my game, and then try other alternatives about this matter. But thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/event-chase-player-using-events.176963/