[SOLVED] [VX] Using Path Finding with Variables

TengHu

Abscond Games
Veteran
Joined
Mar 16, 2012
Messages
469
Reaction score
120
First Language
English
Primarily Uses
RMVX
This has been solved. Read the bottom of this post if you are having the same problem.

I'm using Near Fantastica's Path Finder v1 for RPG Maker VX by PK8.

What I'm trying to achieve is the player pressing a button and an event goes to his location.

The problem is that whenever I use the method in the picture (using the variables), the event doesn't move. But when I use exact coordinates, the event moves.

Here's my set up of the event.



This is basically a Parallel Process event that handles the whole thing.

The commented out (#) section in the Script Call works but the uncommented section isn't functional.

I'm trying to figure out why my method doesn't work. Or if it even can work.

Can anyone help please?

.:EDIT:.

Just in case if anyone is wondering why I'm not using the "Move Toward Player" function is because the event sometimes gets stuck when it's moving; i.e. in corners and when there is a non-passibility tile/event between the event and the player.



SOLVED SECTION

I'm going to post my response to PK8's post here. I don't want to cause a necropost either.

I know it's a necropost but I think I now know why.

I'm not sure if you ever resolved it, but the reason it is occurring is because you are directly targeting something impassable (the player's current coordinates). Try randomly subtracting or adding one of the variables by 1 and see if it works.
That could work but let's say if the player is next to a wall, it might cause the same problem.

Thankfully, I found a script called Listra Pathfinder Module by Bunga Tepi Jalan. It fixes the problem.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I don't see any reason why one would work and not the other.

Is your character, and the event, in the same place when you try it with each method? Does your character move at all while this is happening? Do you see the icons pop up each time (ie - is it JUST the movement that's not happening, or ANY of that block)?

What happens if you get rid of variables altogether and use this instead? :



Code:
$game_map.events[2].find_path($game_player.x, $game_player.y)
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Print out what the x and y values are right before the find_path call. Is it the same as the hardcoded values?
 

TengHu

Abscond Games
Veteran
Joined
Mar 16, 2012
Messages
469
Reaction score
120
First Language
English
Primarily Uses
RMVX
Is your character, and the event, in the same place when you try it with each method?

Does your character move at all while this is happening?

Do you see the icons pop up each time (ie - is it JUST the movement that's not happening, or ANY of that block)?

What happens if you get rid of variables altogether and use this instead? :



Code:
$game_map.events[2].find_path($game_player.x, $game_player.y)
Yes

Yes and no. Tried both moving and not moving.

Yes. Just the movement isn't working.

Will try this and let you know. Got a syntax error.

Print out what the x and y values are right before the find_path call. Is it the same as the hardcoded values?
Did this. And yes the values are.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Will try this and let you know. Got a syntax error.
Are you sure you typed it in correctly?

Since it's likely that you've gone over a single line, make sure the line break occurs after a ( or ,

Something like this:



Code:
$game_map.events[2].find_path(
$game_player.x, $game_player.y)
If you have the break after ] or . it will give a syntax error.
 

TengHu

Abscond Games
Veteran
Joined
Mar 16, 2012
Messages
469
Reaction score
120
First Language
English
Primarily Uses
RMVX
Copy and pasted it and still got the syntax error. :/
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Can you post a screenshot of your event showing the commands? Does the error message give you any other information - any class/line numbers?
 

TengHu

Abscond Games
Veteran
Joined
Mar 16, 2012
Messages
469
Reaction score
120
First Language
English
Primarily Uses
RMVX
Error was a false alarm. I made a backup event and forgot to set it off.

Fixed it but still doesn't work. :'(
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
So, what, using $game_player.x and $game_player.y no longer gives you an error, but the event still won't move?

Do you have a move route on the event, or is it set to parallel process or something like that?
 

TengHu

Abscond Games
Veteran
Joined
Mar 16, 2012
Messages
469
Reaction score
120
First Language
English
Primarily Uses
RMVX
So, what, using $game_player.x and $game_player.y no longer gives you an error, but the event still won't move?
Correct. No error but still doesn't work.

Do you have a move route on the event, or is it set to parallel process or something like that?
Parallel process. But I'll try a move route instead.

Just tried Move Route and it doesn't work.

Thanks for the help but I think I might give up on this one.

Just tested staying next to the event when pressing Q and it works BUT it's not consistent. And it only works when you're one tile next to the event.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
So you've got this code ON the event? I would create a new event with a parallel process, put the logic in that, and take it out of the event you want to be moving, and change it so it's not parallel process.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Have you verified that find_path method is actually getting the right values?

And that it is actually executing? And what the return values are?
 

PK8

I sense there's something in the wind...
Veteran
Joined
Mar 17, 2012
Messages
1,220
Reaction score
152
Primarily Uses
I know it's a necropost but I think I now know why.

I'm not sure if you ever resolved it, but the reason it is occurring is because you are directly targeting something impassable (the player's current coordinates). Try randomly subtracting or adding one of the variables by 1 and see if it works.
 

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top