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.
Smart Pathfinding
JS Plugin Releases (RMMV)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
You just need to list me as Shaz on your game's credits page, as per the first post.
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?
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?
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.
If you can do that and let me know what you find, we'll take the next step.
Disabled every other plugin and the problem still stands.
I understand what I did wrong. I messed up with event pages. I'll open a thread to ask for help.
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 🙂
Just edit your previous post next time instead of posting twice in a row.
Glad you figured out the issue 🙂
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.
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.
@starcrescendo yeah, your syntax is incorrect. You are meant to replace 'eventID1' and 'eventID2' with the actual id of the events.
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.
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.
@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!
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.
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.


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.
--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.
That only gives me the error "Wait is not defined". I am using the DragoonKain customized verstion found here.
Sorry, your syntax was right. I think that you cannot apply the "wait" to the player character.
Hello everyone
Is there a way to get the number of steps needed to reach a specific position without any movement?
Is there a way to get the number of steps needed to reach a specific position without any movement?
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.
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.
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.
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.
Original thread: https://forums.rpgmakerweb.com/threads/smart-pathfinding.46761/