How to add smart pathing for the player

Looking for a way to make the player have some sort of smart pathing that will auto walk around tiles you cant walk on.
You could try one of these script calls:

mvzscl-pathfinding.pngmvzscl-touchmove.png
These screenshots are from the MV / MZ Script Call List:

Alternatively you could look for a plugin that offers "pathfinding" or "path to" features, e.g.
You could try one of these script calls:

View attachment 343660View attachment 343661

These screenshots are from the MV / MZ Script Call List:

Alternatively you could look for a plugin that offers "pathfinding" or "path to" features, e.g.
How would I use these script calls? Like on an event? Im not sure I understand. I looked at the plug in but that ones for event pathing instead of player pathing
How would I use these script calls? Like on an event? Im not sure I understand.
Yes, you would apply the movement to the player using an event command.

$gameTemp.setDestination(4, 5) can be used in a Script command. It should mimic the player clicking on map tile (4, 5), which makes the player (try to) path to that tile. As noted, normal movement input can interrupt this.

The other two are for use in a move route, e.g. via the Set Movement Route command. A move route targets a character, which can be the player. One of the move route commands is labelled Script: that's where you would put the script call.
  1. this.moveStraight(this.findDirectionTo(4, 5))
    • As noted, this script call moves the character 1 step on a path to the specified tile: (4, 5) in this case. But you probably want the next one instead...

  2. var x = 4, y = 5; var d = this.findDirectionTo(x, y); if (!d || !this.canPass(this.x, this.y, d)) { this.forceMoveRoute({ list: [{ code: 0 }] }); this.setMovementSuccess(true); this._moveRouteIndex--; } else this.moveStraight(d);
    • As noted, this script call is designed to be used as the only command in a repeating move route. It will repeatedly move the character 1 step on the path until they are at the destination or the path is blocked. Then the move route will end.
These examples all used fixed coordinates: X = 4, Y = 5. If the destination moves around, then you'll need to replace those fixed numbers with something else. E.g. path to event ID 8:

var x = $gameMap.event(8).x, y = $gameMap.event(8).y; var d = this.findDirectionTo(x, y); if (!d || !this.canPass(this.x, this.y, d) { this.forceMoveRoute({ list: [{ code: 0 }] }); this.setMovementSuccess(true); this._moveRouteIndex--; } else this.moveStraight(d);

I looked at the plug in but that ones for event pathing instead of player pathing
😴 Oh, oops. Maybe someone else knows of a more suitable plugin~

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-smart-pathing-for-the-player.178528/