• 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

Voltseon submitted a new resource:

Voltseon's A-Star Pathfinding - Automatically move events to other events / locations

Download is in the top right by the way ;)

Have you ever wanted to make an event move to a specific location but had to calculate an entire 50 page long move route?
These days are over with VASP! All you have to do is call a simple script command with this plugin, you select the event and its destination and voila! This script will calculate the correct move route for you so you don't have to worry about it.

Does it work with the player as well?...

Read more about this resource...
 

Jos_Louis

Developer of Pokemon Soulstones
Member
Joined
Sep 3, 2020
Posts
147
Hi Voltseon and GolisopodUser,
This is a fantastic script in concept. I had a question before I downloaded it because I'm trying to think ahead about how to construct events given this fundamentally changes how to make certain move routes in events.

Q. Since the pathfinding is automatically calculated, would the pathfinding always be the same so long as it's the shortest route? (e.g. say you want the sprite to move 2 coordinates up and 2 coordinates to the left, will the sprite always go up two and left two in that order, or could it possibly go left two and up two (in that order)?
  • Note in my example, I am assuming that there is nothing obstructing either path, so the sprite would theoretically be indifferent to which path to take.
  • Also note I'm using a very small move route example here and I recognize the intent of the script is for much longer move routes.

Q. Given that in the past, we would have to painstakingly calculate the exact route to take, we could throw in a "Wait for Move Completion" at the end of the event. As this is now in the script itself, how can we make sure that the event has finished its pathfinding before we queue up the next sequence of events in the story?

I might have more questions but just wanted to know how to deal with this. Like I said, I haven't downloaded the script yet as curious to know how this will affect move route and eventing.
 
Last edited:
Hi Voltseon and GolisopodUser,
This is a fantastic script in concept. I had a question before I downloaded it because I'm trying to think ahead about how to construct events given this fundamentally changes how to make certain move routes in events.

Q. Since the pathfinding is automatically calculated, would the pathfinding always be the same so long as it's the shortest route? (e.g. say you want the sprite to move 2 coordinates up and 2 coordinates to the left, will the sprite always go up two and left two in that order, or could it possibly go left two and up two (in that order)?
  • Note in my example, I am assuming that there is nothing obstructing either path, so the sprite would theoretically be indifferent to which path to take.
  • Also note I'm using a very small move route example here and I recognize the intent of the script is for much longer move routes.

Q. Given that in the past, we would have to painstakingly calculate the exact route to take, we could throw in a "Wait for Move Completion" at the end of the event. As this is now in the script itself, how can we make sure that the event has finished its pathfinding before we queue up the next sequence of events in the story?

I might have more questions but just wanted to know how to deal with this. Like I said, I haven't downloaded the script yet as curious to know how this will affects move route and eventing.
It's good to ask these questions and am glad to hear you're interested in using the script.

For your first question, I really I am correct on this one as it has been a bit since I wrote the script. But it should prioritize up, left, right and down in that order. But only if its the shortest path. In your example it should move: Up, Left, Up, Left. That is the shortest path while prioritizing up from left when both paths are the same distance.

For your second question, when structuring your events you can quite simply replace where you would have your move route with the script call. It also has an WaitForComplete argument if you want to include that, which would be comparable to a move route followed up with a wait for completion. I am not sure whether you can use the normal wait for completion with the script call, I haven't tested that out yet. But if it's something this script is missing than I wouldn't mind taking a look at that.

If you have any more questions about the script feel free to ask them and Ill do my best to answer them. If it's missing a feature or something doesn't work right let me know!
 

Insomnia

Rookie
Member
Joined
Aug 4, 2021
Posts
8
Hi, Voltseon!

Thank you for your hard work on these scripts.

I have a couple of questions about this script:

When using the move_to_location command I had no problem at all but when trying to use the event_to_event command I just cannot seem to get it working.

The script I am having trouble with is: move_to_event(46, $game_player, true) which is supposed to move the event with the ID:046 right next to the player, right?

Is it that am misunderstanding the function of this script?

Thank you for reading. :)
 
Hi, Voltseon!

Thank you for your hard work on these scripts.

I have a couple of questions about this script:

When using the move_to_location command I had no problem at all but when trying to use the event_to_event command I just cannot seem to get it working.

The script I am having trouble with is: move_to_event(46, $game_player, true) which is supposed to move the event with the ID:046 right next to the player, right?

Is it that am misunderstanding the function of this script?

Thank you for reading. :)
You're right, it's an oversight I made with the destination of things. I'll try to fix this soon, thanks for reporting. Instead try using a workaround like having an empty event teleport to the player's location and move to that event, or storing the player's location and pathfind to those coordinates with move_to_location.
 

Insomnia

Rookie
Member
Joined
Aug 4, 2021
Posts
8
You're right, it's an oversight I made with the destination of things. I'll try to fix this soon, thanks for reporting. Instead try using a workaround like having an empty event teleport to the player's location and move to that event, or storing the player's location and pathfind to those coordinates with move_to_location.
Thanks!
I am going to try one of those methods and hopefully they work.
 

Oak

Rookie
Member
Joined
Sep 6, 2021
Posts
3
Hi, thanks for taking the time to make this. I'm very new to RPM and PE so hopefully I didn't miss anything major.

I've followed the installation instructions as best as I can, but I can't manage to get it to work. The plugin doesn't show up in the debug output alongside the others, and the game crashes once the script is triggered, making me think I goofed somewhere in the installation. Haven't managed to figure out what went wrong so here we are. I made sure to extract it with Winrar just in case, and copy-pasted the Plugin folder into the project file (the one w/ the game .exe)

Do any of these have compatibility issues as far as you're aware?
-v19.1 Hotfixes
-Overworld Shadows EX
-Luka's Scripting Utilities
-Following Pokemon EX
-Elite Battle: DX

Below are the debug output and crash reports.
[Pokémon Essentials version 19.1]
[Generation 8 Project v1.1.0]
[v19.1 Hotfixes 1.0.6]
[EBDX v1.2.3]

Exception: RuntimeError
Message: Script error in event 5 (coords 13,0), map 48 (Player's House):
Exception: NameError
Message: uninitialized constant Interpreter::Mom

***Full script:
move_to_location(Event-Mom, 7, 10,
false)


Backtrace:
(eval):1:in `execute_script'
003_Interpreter.rb:137:in `eval'
003_Interpreter.rb:137:in `execute_script'
004_Interpreter_Commands.rb:1030:in `command_355'
004_Interpreter_Commands.rb:116:in `execute_command'
003_Interpreter.rb:127:in `block in update'
003_Interpreter.rb:87:in `loop'
003_Interpreter.rb:87:in `update'
002_Scene_Map.rb:157:in `block in update'
002_Scene_Map.rb:155:in `loop'


Backtrace:
003_Interpreter.rb:189:in `rescue in execute_script'
003_Interpreter.rb:135:in `execute_script'
004_Interpreter_Commands.rb:1030:in `command_355'
004_Interpreter_Commands.rb:116:in `execute_command'
003_Interpreter.rb:127:in `block in update'
003_Interpreter.rb:87:in `loop'
003_Interpreter.rb:87:in `update'
002_Scene_Map.rb:157:in `block in update'
002_Scene_Map.rb:155:in `loop'
002_Scene_Map.rb:155:in `update'
Thanks in advance.
 

Attachments

  • DebugOutput.PNG
    DebugOutput.PNG
    20.7 KB · Views: 183

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319
I've followed the installation instructions as best as I can, but I can't manage to get it to work.
You've followed the installation instructions, but not the usage instructions. You need to put the event's ID number, because that's what the script needs to locate the event. "Event-Mom" doesn't mean anything to the code. You can check an events ID number by looking at the "ID:XXX" in to top bar of the event editor.
If you are having trouble recompiling the Plugins, then try deleting "PluginScripts.rxdata" from your game's Data folder and then run the game in Debug mode.
 

Oak

Rookie
Member
Joined
Sep 6, 2021
Posts
3
You've followed the installation instructions, but not the usage instructions. You need to put the event's ID number, because that's what the script needs to locate the event. "Event-Mom" doesn't mean anything to the code. You can check an events ID number by looking at the "ID:XXX" in to top bar of the event editor.
If you are having trouble recompiling the Plugins, then try deleting "PluginScripts.rxdata" from your game's Data folder and then run the game in Debug mode.
After fixing these and spending far too many minutes of tinkering I've sort of made progress. The player will follow the script, the event will not. It doesn't crash or anything, it just skips over it. See anything wrong here?
 

Attachments

  • EventPage.PNG
    EventPage.PNG
    43.1 KB · Views: 171

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319
After fixing these and spending far too many minutes of tinkering I've sort of made progress. The player will follow the script, the event will not. It doesn't crash or anything, it just skips over it. See anything wrong here?
Is the Position x=7 and y=10 passable? Is the Mom event already at the position x=7 and y=10? Does this happen with any other event or just the mom event?
 

Oak

Rookie
Member
Joined
Sep 6, 2021
Posts
3
After some sleep and some more tinkering I managed to get it to work! It was mostly adjusting coordinates, since I hadn't realized the top-left-most was 0 and not 1. Woops. Thanks again for all the help, I'm glad I've got this figured out.
 

Jos_Louis

Developer of Pokemon Soulstones
Member
Joined
Sep 3, 2020
Posts
147
I downloaded the latest v1.1.1 of this yesterday.

It seems to be working ok but whenever I use the look_at_event or look_at_location commands, I run into undefined method errors.

I don't think those two are working. I posted some screenshots of my errors in the Game Dev cafe discord.
 

Jos_Louis

Developer of Pokemon Soulstones
Member
Joined
Sep 3, 2020
Posts
147
Not sure if either developer of this script is monitoring this thread but I don't think the look_at_event and look_at_location commands are working. I get this following relatively simple event move command. I can't see any syntax errors and the error message appears to say that this method isn't defined in the code anywhere:

Error with look_at_location:
Expand Collapse Copy
[2021-10-30 11:07:58 -0400]
[Pokémon Essentials version 19.1]
[Generation 8 Project v1.1.0]

Exception: RuntimeError
Message: Script error in event 11 (coords 33,30), map 110 (Europa Lake):
Exception: NoMethodError
Message: undefined method `look_at_location' for #<Interpreter @event_id: 11>

***Full script:
look_at_location($game_player, 32, 32)


Backtrace:
(eval):1:in `execute_script'
033:Interpreter:137:in `eval'
033:Interpreter:137:in `execute_script'
034:Interpreter_Commands:1030:in `command_355'
034:Interpreter_Commands:116:in `execute_command'
033:Interpreter:127:in `block in update'
033:Interpreter:87:in `loop'
033:Interpreter:87:in `update'
032:Scene_Map:157:in `block in update'
032:Scene_Map:155:in `loop'


Backtrace:
033:Interpreter:189:in `rescue in execute_script'
033:Interpreter:135:in `execute_script'
034:Interpreter_Commands:1030:in `command_355'
034:Interpreter_Commands:116:in `execute_command'
033:Interpreter:127:in `block in update'
033:Interpreter:87:in `loop'
033:Interpreter:87:in `update'
032:Scene_Map:157:in `block in update'
032:Scene_Map:155:in `loop'
032:Scene_Map:155:in `update'

This is my event for context. It's designed as a blocker covering 4 tiles wide that if a player steps on either, it will cause them to move back and look at another coordinate on the map. The move_to_location works just fine, but the look_at_location is where it throws an error. I tested it out with look_at_event, and that also similarly breaks.

1635607245305.png
 
Last edited:

Jos_Louis

Developer of Pokemon Soulstones
Member
Joined
Sep 3, 2020
Posts
147
Hi there,

I'm unsure if this is a bug or not, but I have the following situation.

If the player approaches the following NPC in front of the door from spot #1, I want the player's character to move to coordinate 2 (54,14 on the map). Instead, for whatever reason it gets stuck at coordinate 3?

1640308094221.png


Here is my event. As you will see, I want to make sure irrespective of whether the player approaches the NPC from the left or from below him, he still lands up in coordinate 54,14.

1640308279549.png


I have checked to make sure the tile is passable and my character can walk in front of it no problem. Note, the script doesn't hang at all or throw any bug and just carries on through the rest of the event commands like normal. For whatever reason, the player just stays at coordinate 3 on the map, rather than moving to his final destination.

I'm not sure if you guys would have any idea if there is some sort of bug associated with VASP? For the time being, I'm using a manual workaround of saving the player's X and Y coordinates in a conditional branch to make sure they move to the desired location but would prefer if I can use VASP to do all my pathfinding for me.
 

KRLW890

The Beast
Member
Joined
Oct 11, 2022
Posts
61
I've been having some issues with this plugin. What I'm trying to do is replace a follower with an identical event, remove the follower, and then move that event to a specific location--I'm using this plugin to account for the event's unknown starting position. Sometimes it works fine, but other times, even though there is a possible route to the destination (by going to the left of the minecarts), it just ignores the y position. Setting "through ON" for the event doesn't help. I've included an example of it working properly (to show what I want) and improperly below. Is there something I can do or is this an error in the plugin?

(please excuse the placeholder sprites)


Edit: I'm on Essentials v20.1
 
Last edited:

Gardenette

Cooltrainer
Member
Joined
May 30, 2022
Posts
156
I'm also on 20.1 and getting mixed results with the script.
Everything seems to work fine except for move_to_event where $game_player is the destination event.
This work:
1676145459012.png


but this does not for a different event for which I know there is a possible route
1676145491144.png


The event just doesn't move at all in the latter case.
 
Back
Top