• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Voltseon's A-Star Pathfinding

Resource Voltseon's A-Star Pathfinding 1.2

Gardenette

Cooltrainer
Member
Joined
May 30, 2022
Posts
156
Update. It's a passability thing. I turned Through on for the event and now it works... not desirable to have Through on though. I'm certain the terrain is passable. I walk around on it just fine, and I can get the event to walk around on it through PBMoveRoute without turning on Through
 

5050Shauna

Just kinda of figuring it out as I go along.
Member
Joined
May 22, 2023
Posts
7
Hey I've been havign this error below, does anyone know whats causing it?

[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Script error in event 3 (coords 13,8), map 33 (Murport Warehouse)
Exception: NameError
Message: uninitialized constant Interpreter::WaitForComplete

***Full script:
move_to_location($game_player, 10, 9, WaitForComplete)

Backtrace:
(eval):1:in `execute_script'
033:Interpreter:143:in `eval'
033:Interpreter:143:in `execute_script'
034:Interpreter_Commands:1112:in `command_355'
034:Interpreter_Commands:116:in `execute_command'
033:Interpreter:133:in `block in update'
033:Interpreter:90:in `loop'
033:Interpreter:90:in `update'
[Following Pokemon EX] Refresh.rb:268:in `update'
032:Scene_Map:160:in `block in update'
 
Hey I've been havign this error below, does anyone know whats causing it?

[Pokémon Essentials version 20.1]
[v20.1 Hotfixes 1.0.7]

Script error in event 3 (coords 13,8), map 33 (Murport Warehouse)
Exception: NameError
Message: uninitialized constant Interpreter::WaitForComplete

***Full script:
move_to_location($game_player, 10, 9, WaitForComplete)

Backtrace:
(eval):1:in `execute_script'
033:Interpreter:143:in `eval'
033:Interpreter:143:in `execute_script'
034:Interpreter_Commands:1112:in `command_355'
034:Interpreter_Commands:116:in `execute_command'
033:Interpreter:133:in `block in update'
033:Interpreter:90:in `loop'
033:Interpreter:90:in `update'
[Following Pokemon EX] Refresh.rb:268:in `update'
032:Scene_Map:160:in `block in update'
1685049066327.png

You're not supposed to literally put the variable names there, you're supposed to put the values they represent. (like how you didn't literally write "EventID", you put the event ID) WaitForComplete is supposed to be either true or false.
 

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
*Edit: I removed the look_at_event following the move_event and it works perfect. Is there anyway to run them together with them interferring with each other?
 

Jaete

Novice
Member
Joined
Aug 11, 2023
Posts
31
Hello, i'm new here so first things first: Thank you for this wonderful script! It is a lifesaver. Or worksaver, at least 😅

Now i want to give a contribuition before i ask for some help. As some already noticed, VASP it's currently not working for Essentials v21.1. I've, however, figured out what's the incompatibility issue and it's pretty simple. Since there's no official update, i wanted to help you guys with this.

Basically, the only thing that has changed between versions which conflicts with the script it's the movement command names. You know: Move Up, Move Down, etc.; So I wanted to help you with how to update.

First, you have to open the script itself, on the Plugins folder. Plugins > Voltseon's A-Star Pathfinding > 001_VASP. Open with VSCode if possible or other code editor.

Then you'll use the search function, Ctrl + F, and write: PBMoveRoute (This is not case sensitive but it's the green one - or other color - that we're looking for).

You'll notice that your's different than mine on the following screenshot.

1691792019496.png


Yours should be like: PBMoveRoute::TurnDown; PBMoveRoute::TurnUp, etc. Basically, the Essentials v21.1 changed how these names are spelled on the root script for character movement and that makes a huge difference.

What you'll have to do is change every PBMoveRoute command name to match the new spelling for these commands. You can find the new ones directly on the scripts, on RMXP. They should be at the Overworld script, right below the [[Overworld]]. Then you hit Ctrl + F again and search for PBMoveRoute. So TurnDown becomes TURN_DOWN, and it follows this pattern. Words sepparated with underscore and all caps. If you do it correctly, the plugin should run perfectly fine now.

Right! Now, about the help that i need:
What i need it's not very much about the plugin itself, just an little light on how the base script for essentials works. Maybe i shouldn't be asking here... Anyway:

If i use the move_to_event function, when trying to make the player pathfind to an event, it works pretty fine. But if i try to do the opposite, the event trying to pathfind to the player, it just freezes. And i know why: Because the player coordinates is where the player are standing at the moment, therefore it's blocked and the event cannot reach there.

The thing is: I've also tried to use the move_to_location and pick the player coordinates to use as parameters, but the same happens. Afterall, it's the same logic: The player are standing at the final destination, therefore it's blocked, therefore the pathfinder can't reach.

I've then tried to overcome this with the following: instead of picking the player coordinates, i just pick the player X axis + 1. So it should try to pathfind to the next right tile. And it works! But i can't rely on hardcoded, because if the tile directly at the player's right it's also blocked, the problem remains. However, i've tried to overcome this by making a verification and set two different pathfindings based on if the right tile around the player it's blocked. (Now i've realized that i'll need to make four of these verifications, but anyway...)

Then we've finally come to my problem: the script passable?() keeps returning true even when i've verified that i've not messed up on the selected tile. I've tried to use the $game_map.passable? instead of the game_character one, which actually should be the right one to use, but i don't know what exactly are all the parameters.

The function: "passable?(x, y, d, self_event=nil)" needs 3 or 4 parametes. What the the D stands for? That's my question. Thank you if you at least read until here, even if you can't help me.

EDIT: I've read this again and thought that i could've not have been clear about my issue. Thing is: the script passable?() when called directly from the event page uses the Game_Character.passable?(), which only needs two arguments: x and y coordinates of the targeted tile. This one is that keeps returning true even if the tile is selected correctly and that tile is not passable.

The Game_Map.passable?() is different, needing all 3 or 4 arguments (since one's already set by default). And since i don't know what the D stands for, i don't know what to put in that parameter.
 
Last edited:

drdoom76

Cooltrainer
Member
Joined
Aug 1, 2023
Posts
212
Hello, i'm new here so first things first: Thank you for this wonderful script! It is a lifesaver. Or worksaver, at least 😅

Now i want to give a contribuition before i ask for some help. As some already noticed, VASP it's currently not working for Essentials v21.1. I've, however, figured out what's the incompatibility issue and it's pretty simple. Since there's no official update, i wanted to help you guys with this.

Basically, the only thing that has changed between versions which conflicts with the script it's the movement command names. You know: Move Up, Move Down, etc.; So I wanted to help you with how to update.

First, you have to open the script itself, on the Plugins folder. Plugins > Voltseon's A-Star Pathfinding > 001_VASP. Open with VSCode if possible or other code editor.

Then you'll use the search function, Ctrl + F, and write: PBMoveRoute (This is not case sensitive but it's the green one - or other color - that we're looking for).

You'll notice that your's different than mine on the following screenshot.

View attachment 20107

Yours should be like: PBMoveRoute::TurnDown; PBMoveRoute::TurnUp, etc. Basically, the Essentials v21.1 changed how these names are spelled on the root script for character movement and that makes a huge difference.

What you'll have to do is change every PBMoveRoute command name to match the new spelling for these commands. You can find the new ones directly on the scripts, on RMXP. They should be at the Overworld script, right below the [[Overworld]]. Then you hit Ctrl + F again and search for PBMoveRoute. So TurnDown becomes TURN_DOWN, and it follows this pattern. Words sepparated with underscore and all caps. If you do it correctly, the plugin should run perfectly fine now.

Right! Now, about the help that i need:
What i need it's not very much about the plugin itself, just an little light on how the base script for essentials works. Maybe i shouldn't be asking here... Anyway:

If i use the move_to_event function, when trying to make the player pathfind to an event, it works pretty fine. But if i try to do the opposite, the event trying to pathfind to the player, it just freezes. And i know why: Because the player coordinates is where the player are standing at the moment, therefore it's blocked and the event cannot reach there.

The thing is: I've also tried to use the move_to_location and pick the player coordinates to use as parameters, but the same happens. Afterall, it's the same logic: The player are standing at the final destination, therefore it's blocked, therefore the pathfinder can't reach.

I've then tried to overcome this with the following: instead of picking the player coordinates, i just pick the player X axis + 1. So it should try to pathfind to the next right tile. And it works! But i can't rely on hardcoded, because if the tile directly at the player's right it's also blocked, the problem remains. However, i've tried to overcome this by making a verification and set two different pathfindings based on if the right tile around the player it's blocked. (Now i've realized that i'll need to make four of these verifications, but anyway...)

Then we've finally come to my problem: the script passable?() keeps returning true even when i've verified that i've not messed up on the selected tile. I've tried to use the $game_map.passable? instead of the game_character one, which actually should be the right one to use, but i don't know what exactly are all the parameters.

The function: "passable?(x, y, d, self_event=nil)" needs 3 or 4 parametes. What the the D stands for? That's my question. Thank you if you at least read until here, even if you can't help me.

EDIT: I've read this again and thought that i could've not have been clear about my issue. Thing is: the script passable?() when called directly from the event page uses the Game_Character.passable?(), which only needs two arguments: x and y coordinates of the targeted tile. This one is that keeps returning true even if the tile is selected correctly and that tile is not passable.

The Game_Map.passable?() is different, needing all 3 or 4 arguments (since one's already set by default). And since i don't know what the D stands for, i don't know what to put in that parameter.
I've ran into the a lot of the same issues. What are you doing to call player X axis + 1, if you don't mind me askin?
 

Jaete

Novice
Member
Joined
Aug 11, 2023
Posts
31
I've ran into the a lot of the same issues. What are you doing to call player X axis + 1, if you don't mind me askin?
Don't mind at all.

You just need to use $game_player.x + 1 as a parameter for the X-axis, the same for the Y-axis.

Your line would be something like move_to_location(EventID, $game_player.x + 1, $game_player.y, true if you want to wait for completion). Work really well for cutscenes or when you have a defined coordinate for the event to move and will be always the same and never blocked. In my case, as I'm trying to make a stealth system, I'm in real need of the answer that I've asked.

Anyway, hope that this helps!
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
674
Hello, i'm new here so first things first: Thank you for this wonderful script! It is a lifesaver. Or worksaver, at least 😅

Now i want to give a contribuition before i ask for some help. As some already noticed, VASP it's currently not working for Essentials v21.1. I've, however, figured out what's the incompatibility issue and it's pretty simple. Since there's no official update, i wanted to help you guys with this.

Basically, the only thing that has changed between versions which conflicts with the script it's the movement command names. You know: Move Up, Move Down, etc.; So I wanted to help you with how to update.

First, you have to open the script itself, on the Plugins folder. Plugins > Voltseon's A-Star Pathfinding > 001_VASP. Open with VSCode if possible or other code editor.

Then you'll use the search function, Ctrl + F, and write: PBMoveRoute (This is not case sensitive but it's the green one - or other color - that we're looking for).

You'll notice that your's different than mine on the following screenshot.

View attachment 20107

Yours should be like: PBMoveRoute::TurnDown; PBMoveRoute::TurnUp, etc. Basically, the Essentials v21.1 changed how these names are spelled on the root script for character movement and that makes a huge difference.

What you'll have to do is change every PBMoveRoute command name to match the new spelling for these commands. You can find the new ones directly on the scripts, on RMXP. They should be at the Overworld script, right below the [[Overworld]]. Then you hit Ctrl + F again and search for PBMoveRoute. So TurnDown becomes TURN_DOWN, and it follows this pattern. Words sepparated with underscore and all caps. If you do it correctly, the plugin should run perfectly fine now.

Right! Now, about the help that i need:
What i need it's not very much about the plugin itself, just an little light on how the base script for essentials works. Maybe i shouldn't be asking here... Anyway:

If i use the move_to_event function, when trying to make the player pathfind to an event, it works pretty fine. But if i try to do the opposite, the event trying to pathfind to the player, it just freezes. And i know why: Because the player coordinates is where the player are standing at the moment, therefore it's blocked and the event cannot reach there.

The thing is: I've also tried to use the move_to_location and pick the player coordinates to use as parameters, but the same happens. Afterall, it's the same logic: The player are standing at the final destination, therefore it's blocked, therefore the pathfinder can't reach.

I've then tried to overcome this with the following: instead of picking the player coordinates, i just pick the player X axis + 1. So it should try to pathfind to the next right tile. And it works! But i can't rely on hardcoded, because if the tile directly at the player's right it's also blocked, the problem remains. However, i've tried to overcome this by making a verification and set two different pathfindings based on if the right tile around the player it's blocked. (Now i've realized that i'll need to make four of these verifications, but anyway...)

Then we've finally come to my problem: the script passable?() keeps returning true even when i've verified that i've not messed up on the selected tile. I've tried to use the $game_map.passable? instead of the game_character one, which actually should be the right one to use, but i don't know what exactly are all the parameters.

The function: "passable?(x, y, d, self_event=nil)" needs 3 or 4 parametes. What the the D stands for? That's my question. Thank you if you at least read until here, even if you can't help me.

EDIT: I've read this again and thought that i could've not have been clear about my issue. Thing is: the script passable?() when called directly from the event page uses the Game_Character.passable?(), which only needs two arguments: x and y coordinates of the targeted tile. This one is that keeps returning true even if the tile is selected correctly and that tile is not passable.

The Game_Map.passable?() is different, needing all 3 or 4 arguments (since one's already set by default). And since i don't know what the D stands for, i don't know what to put in that parameter.
From what I understand looking at the code, "d" may stand for direction.
1692049914930.png

As you see, the x and y positions are modified depending on the d value and the par numbers seem to match with the values used by rpg maker to define direction. (Don't know why the 5 is skipped, though).
1692050081916.png
 

Jaete

Novice
Member
Joined
Aug 11, 2023
Posts
31
From what I understand looking at the code, "d" may stand for direction.
View attachment 20169
As you see, the x and y positions are modified depending on the d value and the par numbers seem to match with the values used by rpg maker to define direction. (Don't know why the 5 is skipped, though).
View attachment 20170
Yeah, I've thought for a moment that it could be like this. Didn't fit very well in my head, though. Why direction would be necessary to verify if a tile is passable anyway? Maybe because of the 4-direction passability? Yeah, could be.

By the way, the 5 is skipped because the engine uses the Numpad as a D-pad (with 4 or 8 directions). 8 = up, 2 = down, etc. 5 doesn't move as it's the very center. Just a fun fact thrown away. 😉

Thank you, Lin! Very appreciated!
 

Thunderbird games

Novice
Member
Joined
Jan 1, 2022
Posts
47
hello, i keep getting this error anyone know how to fix it
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.3]
[EBDX v1.4.1 (E21)]

Script error in event 34 (coords 28,18), map 6 (home)
Exception: NameError
Message: uninitialized constant PBMoveRoute::Left

***Full script:
move_to_location($game_player,17,18, true)

Backtrace:
[Voltseon's A-Star Pathfinding] 001_VASP.rb:371:in `calc_move_route_inverted'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:242:in `block in calc_sorted_path'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:239:in `loop'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:239:in `calc_sorted_path'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:228:in `calc_path'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:104:in `move_to_location'
(eval):1:in `execute_script'
Interpreter:138:in `eval'
Interpreter:138:in `execute_script'
Interpreter_Commands:1177:in `command_355'
 
hello, i keep getting this error anyone know how to fix it
[Pokémon Essentials version 21.1]
[v21.1 Hotfixes 1.0.3]
[EBDX v1.4.1 (E21)]

Script error in event 34 (coords 28,18), map 6 (home)
Exception: NameError
Message: uninitialized constant PBMoveRoute::Left

***Full script:
move_to_location($game_player,17,18, true)

Backtrace:
[Voltseon's A-Star Pathfinding] 001_VASP.rb:371:in `calc_move_route_inverted'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:242:in `block in calc_sorted_path'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:239:in `loop'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:239:in `calc_sorted_path'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:228:in `calc_path'
[Voltseon's A-Star Pathfinding] 001_VASP.rb:104:in `move_to_location'
(eval):1:in `execute_script'
Interpreter:138:in `eval'
Interpreter:138:in `execute_script'
Interpreter_Commands:1177:in `command_355'
This script hasn’t been updated to v21 yet.
 

WolfTaiko

Ex-Ace Gamer
Member
Joined
Jul 30, 2020
Posts
224
I had an idea of using this script in a particular way but I don’t know if it’s feasible.

My idea is to have it try to go to a specific coordinate (the player’s coordinate but I think I alright know that ima try to store that in a variable and tell the event to go to the location using the variable) but is there a way to limit the amount of steps it takes to get to the location, like only taking the first two steps of that path to the location, or the first four for a different event.(Preferably able to change how many steps it takes depending on the event.)
 

Brisken

Rookie
Member
Joined
Jan 15, 2024
Posts
5
Just a heads up, this method does indeed work, but you have to make sure EVERYTHING using PBMoveRoute is in this format, this includes:
wait->WAIT
changefreq->CHANGE_FREQUENCY
switchon->SWITCH_ON
etc. etc. All the movement calls can be found in the Overworld script under [[Overworld]] in the Event Movement section. Just replace the ones in thje plugin script with the closet matching one and it should work really well.
 
Back
Top