Smart Pathfinding

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
That was a command you had to do yourself?
 

djDarkX

Retro & Remastered Music Guru
Veteran
Joined
Jan 17, 2013
Messages
2,699
Reaction score
1,889
First Language
Music
Primarily Uses
RMMV
Yeah.  Essentially, I just had to command them to do places by setting up the pathing (setting coords on the map for them to get to) during a scene, have them go there, do their talking bits and either have them route back to the main actor (or have the main actor come back to them if he moved) or have "Gather Followers" if they clustered. I never expected the script to have it do all the work for me, just allow control over the followers and not have to do the move routes since memorizing paths and setting up branch conditions was always such a pain.
 

dragoonkain

Villager
Member
Joined
Oct 17, 2015
Messages
20
Reaction score
16
First Language
English
That was a command you had to do yourself?
Possibly OT question, but are you guys generally doing your cut-scenes with your main actor(s)? I have been doing my cut-scenes by turning Transparency ON and creating Event tiles to represent the people in the active cut-scene. Are there any drawbacks to that approach? 

I was envisioning an API like:

SmartPath Cutscene_Member_001 Cutscene_Spot_001 Auto_Cancel SmartFollow Cutscene_Member_002 Cutscene_Member_001 Auto_Cancel 1Essentially, "Cutscene_Member_001, traverse to Cutscene_Spot_001 and stop once you get there." "Now, Cutscene_Member_002, follow Cutscene_Member_001 and stop once he's stopped AND you're one tile away from him."

This wouldn't work terribly well if you're trying to do this with the "follower" actors, at least that I can tell. Your main PC can be referenced as event ID -1 but I'm not for sure about the others. 
 

terwilliker

Veteran
Veteran
Joined
Jul 25, 2014
Messages
49
Reaction score
1
Primarily Uses
Id imagine setting a group of people to go to a single place at one time or maybe go to a location and then go to the closest available region (identified by region number). Like a firedrill in school, all of the students leave via a certain path but then congregate in an outdoor area. Also have a home setting where you could tell them to go home and they find the path back to (home). If you have ever played the game FTL you can select home for people, then select a group and tell them all to go somewhere. When whatever is happening is over they can all go back to their current home location.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
@dragoonkain, personally I don't like followers and have disabled them in my game.  So the question isn't applicable to me, apart from making the plugin more useful to people :)
 

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,033
Reaction score
337
First Language
indonesian
first of all... nice script. this would come in handy.

any plan on making this script to be able to use in move route?

since move route didn't have plugin command. just script call :D .

it would be nice to have the event move to certain place using move route... so i don't have to manually activate it.

useful for those harvest moon like game where people have schedule. :D .
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
Sure - I'll see about adding it.
 

juliusdash

Warper
Member
Joined
Nov 12, 2015
Messages
1
Reaction score
0
First Language
English
This little plugin has made life so much better

I've made a couple of little tweaks I thought I would share in case they would come in handy for anyone. 

http://pastebin.com/muDmBdF9

First off the ability to reference events by name. I actually created a separate module for this but I included it in the pastebin. It adds a findEvent call to the gameInterpeter to allow you to query events by numerical ID or canonical name. You can either include the FindEventsByName script and SmartPath by event names or  you can not include it and just use the numbers. This version of SmartPath will only use the additional script if it's present.

e.g.:

SmartPath Lab_001_Hero Lab_001_ExitSmartPath -1 Field_001_CenterSmartPath 3 7I also added a plugin call for waiting until the smart path is reached. 

SmartPath <event_target> WAITI also added an auto-cancelling trigger to clear the auto-path target once it's reached. This is useful if you are controlling the player and want to stop targeting at the end of the path. If you don't clear his target then he will constantly try to re-acquire it every time you move. 

SmartPath <event_target> AUTO_CANCELIf your target is actually impassible for whatever reason I've also added a cancellation near (so if you're within 1 tile...)

SmartPath <event_target> AUTO_CANCEL_NEARNow if you have an event where you want the hero to walk to a given location, wait on him, do a cutscene or whatever, and then resume play you can do that like so:

Plugin Command: SmartPath -1 Event_LocationPlugin Command: SmartPath -1 Auto_CancelPlugin Command: SmartPath -1 WaitYou can also have some actions take place before the Wait if, for instance, you'd like to have a conversation but make sure the event waits for the target to reach its destination.
Nice, this is what I need :D a wait and auto_cancel thank you....

Anyway, there's some bug one the code itself, when I use the "AUTO_CANCEL_NEAR" plugin command it said that variable t is undefined so I fix into y and it work. Maybe you should update the code...
 

dragoonkain

Villager
Member
Joined
Oct 17, 2015
Messages
20
Reaction score
16
First Language
English
Nice, this is what I need :D a wait and auto_cancel thank you....

Anyway, there's some bug one the code itself, when I use the "AUTO_CANCEL_NEAR" plugin command it said that variable t is undefined so I fix into y and it work. Maybe you should update the code...
Thanks for pointing that out! I fixed it on my end at some point and totally forgot to update it here. I have updated the links to use github so if I make any other fixes to that fork they'll stay up to date. Cheers!
 

SquallStorm

Resident Persona 5 Hyper
Veteran
Joined
Feb 4, 2014
Messages
214
Reaction score
134
First Language
English
Primarily Uses
So I'm getting a very strange issue after using the plug in command for the player.  It works fine until the cutscene I'm using ends and the player again has control.  I try to move, and the player moves right back where the coordinates had the player move during the cutscene just prior.

Anyway to fix this?  This plugin isn't required and I'm not above manually programming move routes, I just like the niceness of the plugin.

For references sake I'm using the MBS Smooth Scroll and Galenmareth's No Move Route Speed Up plugins and I've turned them both off and the issue persists.

Edit:  I've tried it in a fresh project with no other plug ins and the issue persists.  If it can't be fixed I'll do without I suppose.  :/
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
Can you send me a copy of the files in the data folder from your fresh project?


Edit - are you using my original version, or the edited version by dragoonkain?
 
Last edited by a moderator:

solaris1111

Veteran
Veteran
Joined
Jan 1, 2014
Messages
115
Reaction score
19
First Language
French
Primarily Uses
So I'm getting a very strange issue after using the plug in command for the player. It works fine until the cutscene I'm using ends and the player again has control. I try to move, and the player moves right back where the coordinates had the player move during the cutscene just prior.

Anyway to fix this? This plugin isn't required and I'm not above manually programming move routes, I just like the niceness of the plugin.

For references sake I'm using the MBS Smooth Scroll and Galenmareth's No Move Route Speed Up plugins and I've turned them both off and the issue persists.

Edit: I've tried it in a fresh project with no other plug ins and the issue persists. If it can't be fixed I'll do without I suppose. :/
That happened to me today! You just need to used tha5 plugin command at the end of the cutscene : smartpath -1 cancel
 
Last edited by a moderator:

Roguedeus

It's never too late to procrastinate...
Veteran
Joined
Mar 19, 2013
Messages
527
Reaction score
106
First Language
English
Primarily Uses
N/A
Shaz, I am having a small issue with interaction between this plugin and Yanfly's Event Chase Player...

Specifically, I have an event that chases the player until it engages in a battle, after which (when its defeated) it walks back to its original location using this plugin.

It returns fine. But when Yanfly's plugin triggers again, it never travels more than 1 square before ping ponging back and forth endlessly between its original loc and the step it took.

The reason I'm need it this way is that I am using another plugin that saves all event locations. If I don't have the event travel back to its original place, it will just stay where it was last killed.

The event location plugin is estriole's - Save Map Event.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
Once you give it a location, it will keep moving to that location until you tell it not to. So you can either monitor for when it reaches its home location and use the plugin command to cancel the pathfinding, or you could try the modified version mentioned later in the thread, which I think may have the ability to auto-cancel after reaching the destination.
 

Roguedeus

It's never too late to procrastinate...
Veteran
Joined
Mar 19, 2013
Messages
527
Reaction score
106
First Language
English
Primarily Uses
N/A
Once you give it a location, it will keep moving to that location until you tell it not to. So you can either monitor for when it reaches its home location and use the plugin command to cancel the pathfinding, or you could try the modified version mentioned later in the thread, which I think may have the ability to auto-cancel after reaching the destination.
Ah. That makes sense. I must have missed that detail! /facepalm
 

MinisterJay

Villager
Member
Joined
Nov 12, 2013
Messages
17
Reaction score
17
First Language
English
Hello Shaz.  i am working on a digital board game and this is a wonderful plugin option.  Is there a way for the player, event -1, to ignore ALL events between host event and final destination event.  From each event encountered, at the end there is a die roll, so there are six possible events that the destination event could be.  If the roll is > 1, then other events may have to be passed through.

Thanks,

Jay
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
Not on its own. It just uses the default logic to determine whether a tile can be walked on.


Is it an option to have multiple pages for your events, each with the same sprite, and set the higher numbered page to THROUGH, and conditioned by the variable (dice roll) being larger than the number that would result in that event being the target? That should allow the player to walk through them on their way to a different event.
 

KlausAidon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
55
Reaction score
15
First Language
English
Primarily Uses
Shaz, I'm having trouble getting your script to work. I'm actually trying to combine it with Whitesphere's Stealth script, to make a more robust stealth system. I want an event, when Self-Switch C is switched, to begin to move towards the location the player was last when the switch was flipped. I store the player's XY coords into variables, but I can't figure out how to get the event to move towards the coordinates. On top of this, I'd also need the event's self switch to turn off once it reaches its destination, returning to it's default state, and thus resuming it's 'patrol'.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,467
Reaction score
12,017
First Language
English
Primarily Uses
RMMV
If you have the location in variables, you can use $gameVariables.value(x) and $gameVariables.value(y) as the destination (replacing the x and y with the variable id).


There is no "turn off" once the destination is reached. But look at the modded version, also posted in this thread, as I think it does have a "cancel action" type of option that you could use for that purpose.
 

KlausAidon

Veteran
Veteran
Joined
Oct 15, 2012
Messages
55
Reaction score
15
First Language
English
Primarily Uses
I'm getting a Syntax error. Says "GameVariables" is not defined.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

i deleted anime only family guy from now on
I've discovered Stardew Valley and now I'm an addict. To think that one person designed this...
There a thread out there that tells us the best way to open an RPG that isn't 'the protag gets out of bed'?
Updated my state Stacker Script on itch.io, github is down for some reason (probs just me).
Wife watching Locke and Key. This show is so bad!! You can't just acclimate to discovering magic or magical worlds in less than 60 seconds.

Forum statistics

Threads
94,335
Messages
920,035
Members
124,093
Latest member
JosephTucker
Top