Smart Pathfinding

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,436
Reaction score
12,957
First Language
English
Primarily Uses
RMMV
I would never use the download option, because the file names on pastebin are not named correctly.  I would always click the 'Raw' link, copy it and paste it into Notepad++ or something like that, and then save it manually.  And even if you do download the .js file, it's still just a text file.  There is no virus.
 

KillerGin

Freddie
Veteran
Joined
Dec 18, 2015
Messages
368
Reaction score
209
First Language
English
Primarily Uses
N/A
Hey @Shaz My demo is ready! If you want to check it out please do so. Also let me know how I can give you proper credit for your work. I will make the necessary arrangements
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,436
Reaction score
12,957
First Language
English
Primarily Uses
RMMV
You just need to list me as Shaz on your game's credits page, as per the first post.
 

va2k0r

Veteran
Veteran
Joined
Feb 26, 2016
Messages
13
Reaction score
0
First Language
English
Primarily Uses
Hello Shaz, my first post here.
I found a bug in your otherwise great script: every time I teleport my character outside the map and then back to it all the events running this script are stuck. I worked around this limit copying locations inside the same map when necessary but I found another, game breaking bug: when I save the game and then load it the events run to the position where the player was when saving and then get stuck again.
My game was almost done so I'm kinda stuck myself. I can send you the game if necessary. Any chance we might find a solution together?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,436
Reaction score
12,957
First Language
English
Primarily Uses
RMMV
that is strange - are you using any other plugins?  Can you disable all except this one and see if the issue still happens?  If it doesn't happen any more, enable the other plugins one by one, saving and testing after each one.  When the problem happens again, the last plugin that you enabled will be the one that is causing this behaviour (in conjunction with this plugin, of course).


If you can do that and let me know what you find, we'll take the next step.
 

va2k0r

Veteran
Veteran
Joined
Feb 26, 2016
Messages
13
Reaction score
0
First Language
English
Primarily Uses
Disabled every other plugin and the problem still stands.
 

va2k0r

Veteran
Veteran
Joined
Feb 26, 2016
Messages
13
Reaction score
0
First Language
English
Primarily Uses
I understand what I did wrong. I messed up with event pages. I'll open a thread to ask for help.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,436
Reaction score
12,957
First Language
English
Primarily Uses
RMMV
va2k0r, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


Just edit your previous post next time instead of posting twice in a row.


Glad you figured out the issue :)
 

starcrescendo

Stargazer
Veteran
Joined
Mar 13, 2012
Messages
201
Reaction score
47
First Language
English
Primarily Uses
Hi Shaz,


I cannot get this plugin to work at all. I don't know what I'm doing wrong! I named it SmartPath.js and placed it in the JS folder and activated it like any other plugin. I have even disabled all my other plugins (if "turning them off" should stop any plugin conflicts?) It just skips any movement with your plugin and goes onto the next thing.


Can you confirm the syntax? I am using:


SmartPath eventId14 eventId11


After hitting "Plugin Command..." and typing that in the window. As I was unsure, I also tried "SmartPath 14 11" and "SmartPath eventID14 eventID11" but nothing is working. I'm sure its something obvious that I'm missing here. Could you please lend a hand?


I also attached a screenshot of everything described above.


 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,436
Reaction score
12,957
First Language
English
Primarily Uses
RMMV
@starcrescendo yeah, your syntax is incorrect.  You are meant to replace 'eventID1' and 'eventID2' with the actual id of the events.

Code:
SmartPath 11 14
is all you need to enter.  Then you'll need to have a loop that waits until she's at the right spot (or time it then add a Wait X Frames to give her time to get there).  Note that if the player interacts with her from above, she will not be able to move at all.  If you're going to allow that, you should add, before the SmartPath, a check to see if the NPC is facing up, and if so, make the player step aside, wait for completion, and then do the smartpath.
 
Last edited by a moderator:

starcrescendo

Stargazer
Veteran
Joined
Mar 13, 2012
Messages
201
Reaction score
47
First Language
English
Primarily Uses
@Shaz That was it! (Of course that was it, you're the creator of the plugin...) Thank you for the help. I'm not for the scientific method so I got rid of the table, changed the command syntax I was using, and put in a long wait and it is working now so I'm not sure what fixed it (but probably a combination!) thank you!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,436
Reaction score
12,957
First Language
English
Primarily Uses
RMMV
what fixed it is using numbers instead of words in the plugin parameters :)   As long as you'd interacted with the NPC over the table, just the plugin command change would have got it working for you.
 

Merte

Warper
Member
Joined
Mar 28, 2016
Messages
2
Reaction score
0
First Language
English
Primarily Uses
OK. Maybe I'm an idiot, but I just can't seem to get the WAIT command to work. I want the hero to move to a specific x y location, and then show a message when he arrives. The problem is that it seems to skip the WAIT command and display the message instantly while the hero is walking. Am I doing something wrong? I've attached an image to show how I've set up the commands.

smart path test.png
 

terwilliker

Veteran
Veteran
Joined
Jul 25, 2014
Messages
49
Reaction score
1
Primarily Uses
All of my events walk to the wall and stare through it to the event they want to get to on the other side. Is there any way to have them actually walk through the doorway or make a path that goes around objects?


--updated--


so I added OrangePathfinding and upped the searchLimit to 30 and it seems to work now. Looks like it is tied into the complexity of my map.
 
Last edited by a moderator:

Merte

Warper
Member
Joined
Mar 28, 2016
Messages
2
Reaction score
0
First Language
English
Primarily Uses
The second line should just be SmartPath Wait and only if you are using the DragoonKain customized version of this plugin.
That only gives me the error "Wait is not defined". I am using the DragoonKain customized verstion found here.
 

terwilliker

Veteran
Veteran
Joined
Jul 25, 2014
Messages
49
Reaction score
1
Primarily Uses
Sorry, your syntax was right. I think that you cannot apply the "wait" to the player character. 
 

Johan Liebert

Villager
Member
Joined
Apr 6, 2016
Messages
12
Reaction score
1
First Language
French
Primarily Uses
Hello everyone 


Is there a way to get the number of steps needed to reach a specific position without any movement?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,436
Reaction score
12,957
First Language
English
Primarily Uses
RMMV
Not really, because it works a step at a time, re-executing the findDirectionTo command after every step.  In addition, the target itself may be moving, so if there are 4 steps between at the start, it might not stay that way.


You could try $gameMap.distance(a, b, c, d) where a and b are the x/y coordinates of the event and c and d are the x/y coordinates of the target (you will likely use a formula to get those rather than hardcoding them) which MIGHT give you a close estimate of how many steps are required, but I don't know how that would handle obstacles that you might have to walk around, and again you still have the possible movement of the target issue.  This plugin is not necessary for that function to work.
 

boornakaka

Warper
Member
Joined
Jul 20, 2016
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Hello All,


I've just come across this plugin and have sent the following message to dragoonkain concerning his mod. If anyone could help me out, I think that my request would make a good addition to this script. One that I will definitely use.


I've recently downloaded your KCL_SmartPath Plugin for RPG Maker MV. It works great. Regretfully, I am not experienced with javascript and am in no position to edit your script to have it do what I want it to do. I'm hoping that you could take some time to help me.


The function I am looking for is around the Auto_Cancel_Near function. Ultimately, I need to be able to determine how many spaces away "near" actually is. By default you have it set to 1. Could you modify your script to allow me to input on a case by case basis how far away from the target event you are when the pathfinding cancels?


Having a plugin command along the lines of "SmartPath -1 Auto_Cancel_Near X" X being the number I can input being calculated as being near using the following formula "Math.abs(this.x - x) + Math.abs(this.y - y) = X"


I'm not sure how much of a tall order this is as I'm just a beginner with coding but, a response with your intentions would be greatly appreciated.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts

https://s12.directupload.net/images/200715/34vwhkoz.png Finally have a concept I am happy with, now I just have to decide wheather I really want to do it as vector art.
I just keep coming up with weird ideas, and then spend the time trying to make sense out of it.:kaocry:
Hi, Erm... My name is zozobie! I just had a snack.
Face masks are to be compulsory when inside shops in England from the 24th of July. People can be fined £100 if they fail to comply.

Forum statistics

Threads
99,692
Messages
968,072
Members
131,381
Latest member
3dprintindex
Top