TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,841
Reaction score
9,224
First Language
Indonesian
Primarily Uses
N/A
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
 

starcrescendo

Stargazer
Veteran
Joined
Mar 13, 2012
Messages
213
Reaction score
46
First Language
English
Primarily Uses
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". :rhappy:

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. :)
 
Last edited:

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
5,956
Reaction score
2,331
First Language
Dutch
Primarily Uses
RMMV
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 :p

if it can walk around those obstacles as well, it is a pretty neat plugin for MZ :)
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,841
Reaction score
9,224
First Language
Indonesian
Primarily Uses
N/A
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.
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,196
Reaction score
816
First Language
Polish
Primarily Uses
RMMZ
Is there an option to "clear" path after it reached the point?
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,196
Reaction score
816
First Language
Polish
Primarily Uses
RMMZ
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.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,841
Reaction score
9,224
First Language
Indonesian
Primarily Uses
N/A
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.
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,196
Reaction score
816
First Language
Polish
Primarily Uses
RMMZ
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.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,841
Reaction score
9,224
First Language
Indonesian
Primarily Uses
N/A
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?
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,196
Reaction score
816
First Language
Polish
Primarily Uses
RMMZ
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.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,841
Reaction score
9,224
First Language
Indonesian
Primarily Uses
N/A
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?
 

GHNeko

Sega Stockholm Syndrome.
Veteran
Joined
May 28, 2018
Messages
37
Reaction score
2
First Language
English
Primarily Uses
RMMZ
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?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,841
Reaction score
9,224
First Language
Indonesian
Primarily Uses
N/A
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.
 

GHNeko

Sega Stockholm Syndrome.
Veteran
Joined
May 28, 2018
Messages
37
Reaction score
2
First Language
English
Primarily Uses
RMMZ
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.
 

OktoberLove

Veteran
Veteran
Joined
Feb 11, 2019
Messages
63
Reaction score
25
First Language
English
Primarily Uses
RMMV
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

Veteran
Veteran
Joined
Feb 11, 2019
Messages
63
Reaction score
25
First Language
English
Primarily Uses
RMMV

Latest Threads

Latest Profile Posts

ScreenShot_8_7_2022_0_23_50.png
Unleash the hype beam...
hjyI4gQ.png


Made an attachment for the HUD that I can control the visibility of with switches. This tracks the current amount of items needed to finish a quest. Once you meet the requisite, it turns into "complete" because I figured it would be a good way to tell the player they're done. Also it stops numbers from going off of the UI.

Tortoise attacks black shoes. Hope everyone is doing well. :)
Banging my head on a wall balancing.
Game Making Every Day #13 :kaosalute:

Forum statistics

Threads
124,312
Messages
1,162,707
Members
163,114
Latest member
pinomedio
Top