Pathfinding for actor

I want the player to go to a particular spot after a short dialogue. My problem is that I cannot be sure where the player will be when this happens, so I cannot use a set route move command. In my previous (Ace) games I had a pathfinder script but the only one I can find for MZ is just for events to move to the player, so no good for this.

Is there a JS script call I can use, or something in the VS plugins that I've missed?

Thank you
Hiya!

Visustella's Events and Movement core does indeed have this functionality--though you access it through the 'move route' command and it enter it via there in the 'script' part rather than a plugin command.


Refer to the 'Move To' part a bit further below from this header, where you can enter the coordinates and such.
@FrigidGaze I had looked there and had thought that the reference to moving the "unit" meant that it was only for NPCs.
I've just tried it and the player does indeed move to the correct position, but once he gets there the engine then executes the 'Gather Followers' command so all the actors scrunch up onto the same tile. Do you know if there is a way to stop that happening?
Heyo.

There are a couple of pathfinding plugins you might be interested in:

Shaz's Smart Pathfinding for MV but works in MZ:

Spoiler: Script Calls
Code:
// Make Player go to X/Y
$gamePlayer.setTarget(null, X, Y);

//Make Player go to target event
const target = $gameMap.event(ID)
$gamePlayer.setTarget(target);

//Make event go to target event
const event = $gameMap.event(ID);
const target = $gameMap.event(ID)
event.setTarget(target);

//Make event go to player
const event = $gameMap.event(ID);
event.setTarget($gamePlayer);

//Cancel Pathfinding script calls. Use whichever you want.
$gamePlayer.clearTarget();
$gamePlayer.setTargetAutoCancel('on');
$gamePlayer.setTargetAutoCancel('near');

//Cancel Pathfinding script calls. Use whichever you want.
const event = $gameMap.event(ID);
event.clearTarget();

Gabe's Better Follower Controls for MZ:
@Silenity Thanks for the suggestions. I won't be able to look at them until tomorrow now, but once I test them I may get back to you.
Perhaps this won't work for whatever reason, but why not simply spread them out at the end of your event by command?
Alternative, non-plugin option - assign a repeating move route, with a single Script command:

const x = 5, y = 6; const d = this.findDirectionTo(x, y); if (!d || !this.canPass(this.x, this.y, d)) { this.forceMoveRoute({ list: [{ code: 0 }] }); this.setMovementSuccess(false); } else this.moveStraight(d);
Replace 5 and 6 with the destination X and Y coordinates, respectively. The route will automatically stop repeating when the character reaches their destination or cannot find an unobstructed path. This uses the built-in touch-movement pathfinding.
@Plasmaballs As far as I am aware, there is no "ungather followers" command. The only way that I know of to spread them out again is for the party leader to carry on moving.

@caethyril That works to perfection. The player will move to the opposite side of an obstruction instead of frantically going from side to side trying to find a find a way through - which is what the VS plugin option does. Once again many thanks for coming to the rescue.
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/pathfinding-for-actor.157192/