[SOLVED] [VX] Using Path Finding with Variables

● ARCHIVED · READ-ONLY
Started by Scintilla 13 posts View original ↗
  1. 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.

    25k5saw.jpg

    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.

    PK8 said:
    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.
  2. 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)
  3. Print out what the x and y values are right before the find_path call. Is it the same as the hardcoded values?
  4. Shaz said:
    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.

    Tsukihime said:
    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.
  5. rgangsta said:
    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.
  6. Copy and pasted it and still got the syntax error. :/
  7. Can you post a screenshot of your event showing the commands? Does the error message give you any other information - any class/line numbers?
  8. Error was a false alarm. I made a backup event and forgot to set it off.

    Fixed it but still doesn't work. :'(
  9. 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?
  10. Shaz said:
    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.

    Shaz said:
    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.
  11. 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.
  12. 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?
  13. 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.