Theo - Pathfinding, Move Route Generator

About:
This plugin generates the shortest move route for you.
Because you're too lazy to do it yourself.

Preview:
pathfind2.gif


Download:
Save as a new JS file

Terms of Use:
Read here

P.S:
The code is kinda fragile. Tell me if something is broken, I'll try to fix it.

I hope you find this useful
I love the idea of this plugin but I can't seem to get it to work right. Throwing this out there just in case it's "broken". 🙂

I would like to have two characters (one being the player, two being an NPC) walking to a specific location (each to their own tile) but right in front of each other. The map is 50x50, in case that matters. I set the player to move to 18,5 and the NPC to move to 18,6.


If I set the move events to Wait for Completion, one moves, and then the other follows only after they have completely reached the end of their path. I'd like them to seemingly follow each other.

If I set the first one to NOT Wait for Completion, and then set the other to Wait for Completion, which is how I usually do the Move Events, the second one moves one tile and then blocks the path and the player cannot move at all so it just starts running the cutscene (event though "Skip if Can't Move" is NOT even checked.

Is this possible with this plugin?

See my move event below:

Code:
◆Set Movement Route:Fat Cat  (Wait)
:                  :◇Script:this.generatePath(18, 5)
◆Set Movement Route:Player (Wait)
:                  :◇Wait:10 frames
:                  :◇Speed:3
:                  :◇Script:this.generatePath(18, 6)
◆Set Movement Route:Fat Cat (Wait)
:                  :◇Turn Down
◆Show Balloon Icon:Player, Silence (Wait)
◆Text:???, SF_Actor3(4), Window, Bottom
:    :So\..\..\.. Do you have it?
◆Set Movement Route:Fat Cat (Wait)
:                  :◇Turn Down
:                  :◇1 Step Backward
:                  :◇Turn Up
:                  :◇Wait:5 frames
:                  :◇Turn Down
◆Text:???, Evil(1), Window, Bottom
:    :Hold on\.. We'll speak in the back. Just give me a minute
:    :to prepare a room.
◆Show Balloon Icon:Player, Anger (Wait)
◆Text:???, SF_Actor3(4), Window, Bottom
:    :\..\..\..You OWN this place. You really need to clear
:    :up a room?
◆Text:???, Evil(1), Window, Bottom
:    :Yes. Surprisingly, I make money by filling my rooms, not
:    :keeping them empty for random low-life hackers to squat in.
◆Set Movement Route:Fat Cat (Wait)
:                  :◇Through ON
:                  :◇Move Up
:                  :◇Transparent ON
◆Show Balloon Icon:Player, Anger (Wait)
◆Text:???, SF_Actor3(4), Window, Bottom
:    :"Lowlife?!" That hurts my self-esteem. Well, better have
:    :a look around. Maybe I'll play a slot.
◆Fadeout Screen
◆Control Self Switch:A = ON


I've double and triple checked the path in game IS passable. The player has a 10 second pause because I thought perhaps they were getting held up bumping into each other. That doesn't seem to help. I've also tried combinations of the Movement Route options of "Repeat Movements" "Skip if Cannot Move" and "Wait for Completion" but have been unable to get this to work.

There are random NPCs walking around, I recall an old plugin for VXAce that calculated the whole route at the start instead of continually finding its path which led to the characters pausing at the start of the route for a long time, or getting held up while walking if the path changed. Does this plugin recalculate the path continually?

Just trying to make sense of this all. I'm on the MZ bandwagon but one welcome improvement of being able to see the move events on the map is kind useless if they get held up by a random NPC walking in the way which is why I turned to this plugin!


This works fine. It seems they don't like small corridors. I tried making the path an extra tile wider and you can literally watch them dosey-do around each other continually. That was the issue all along. There was one "choke point" that caused them to glitch out and I guess when it calculated the route it just said "f*** it" and glitched out. 🙂
I dont have MZ or can test this, but I wonder if it works for lava tiles too
that can burn the player or if it goes around those things as well?

or just straight through it 😛

if it can walk around those obstacles as well, it is a pretty neat plugin for MZ 🙂
This does not check floor damage. So, yeah... no.
This also does not assume that the one that moves is the player.
It just simply a move route generator, for the player, and the event.
Is there an option to "clear" path after it reached the point?
Is there an option to "clear" path after it reached the point?
What do you mean?
It reached the point, and it still tries to reach it, instead of turn it off (pathfinding). It also caused a bug, because the event go on other event with "same as" priority.
It reached the point, and it still tries to reach it
While it didn't happen during the initial test when I made the plugin, after looking back at the code, the chance is totally there, even though it shouldn't generate a new path when it already reached the point.

Are you using this in the autonomous move route or event command?
Do you have a map with a specific setup for the event that could replicate the issue?

It also caused a bug, because the event go on other event with "same as" priority.
If the event that has the same priority moves and blocked the calculated path, then yes, this could happen. The plugin does not have "Look another way if blocked". Unless if it wasn't the case.
If the event that has the same priority moves and blocked the calculated path, then yes, this could happen. The plugin does not have "Look another way if blocked". Unless if it wasn't the case.
Um no, the other event do not move at all. It's a static chest. I'm using this as a move route in autonomous movement.
I'm using this as a move route in autonomous movement.
This is probably why.
The plugin is adjusted for a one-time move route (using event command) rather than a looped (autonomous movement) which is expected to generate a new path for each loop.

Are you expecting it to use this to make the event chases the player, by any chance?
This is probably why.
The plugin is adjusted for a one-time move route (using event command) rather than a looped (autonomous movement) which is expected to generate a new path for each loop.

Are you expecting it to use this to make the event chases the player, by any chance?
No, I tried to create simply patch for event other that player, from point X to Y(chest), and then, stop him. But I don't know how. That's why I wanted to clear the path after reaching the point.
No, I tried to create simply patch for event other that player, from point X to Y(chest), and then, stop him. But I don't know how. That's why I wanted to clear the path after reaching the point.
Can't it be done using event command, rather than autonomous movement?
This is probably why.
The plugin is adjusted for a one-time move route (using event command) rather than a looped (autonomous movement) which is expected to generate a new path for each loop.

Are you expecting it to use this to make the event chases the player, by any chance?
Actually is this capable of constantly chasing the player? If so, is it also possible to assign 2 separate behaviors based on player location within the map?
Actually is this capable of constantly chasing the player? If so, is it also possible to assign 2 separate behaviors based on player location within the map?
For constantly chasing the player, use this instead

For separate behavior, use page switching when you want different behavior. Probably combine it with an event sensor or something.
For constantly chasing the player, use this instead

For separate behavior, use page switching when you want different behavior. Probably combine it with an event sensor or something.
Oh fantastic. I spent a bunch of time trying to create some rudimentary path finding through eventing and regioning so I'm glad this will help cut down on the mundane eventing that goes into that. I appreciate it homie.
I keep getting this error while using this.gotoEvent(x):

TypeError
[2,4,6,8].shuffle is not a function or its return value is not iterable
@OktoberLove It is most likely a compatibility issue.
Try a modified version if it solves your problem.
@OktoberLove It is most likely a compatibility issue.
Try a modified version if it solves your problem.
That worked but now there's a slight freeze every time the command is executed in the parallel event.

Original thread: https://forums.rpgmakerweb.com/threads/theo-pathfinding-move-route-generator.133547/