Author Topic: Pathfinding question  (Read 3297 times)

0 Members and 1 Guest are viewing this topic.

Offline xapcxTopic starter

  • Jr. Member
  • **
  • Posts: 30
  • Activity:
    0%
  • Reputation Power: 0
  • xapcx has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Pathfinding question
« on: September 06, 2009, 03:56:26 PM »
0
I have an issue when i use pathfinding to move in my script.  If the z axis changes levels, i get the "can't get there from here" message above my head.  As a work around, I use an incremental %i to just cancle out of the pathfind.  Does anyone have any suggestions on how I could fix this?  Here is my move code i use:

Sub moveNow
  set %x %movex
  set %y %movey
  set %z %movez
  set %i 0
  while ( #CHARPOSX <> %x || #CHARPOSY <> %y ) && %i < 5
  {
  event pathfind %x %y
  wait 5
  set %i ( %i + 1 )
  }
Return
Code: [Select]
Sub moveNow
  set %x %movex
  set %y %movey
  set %z %movez
  set %i 0
  while ( #CHARPOSX <> %x || #CHARPOSY <> %y ) && %i < 5
  {
  event pathfind %x %y
  wait 5
  set %i ( %i + 1 )
  }
Return

Offline Superslayer

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Re: Pathfinding question
« Reply #1 on: September 06, 2009, 04:02:21 PM »
0
I think you need to also have a Z coordinate when pathfinding.  As you currently have:

event pathfind %x %y

It should probably read:

event pathfind %x %y %z

If you know the exact xy location you want to get to, you can do a Tile Get for the position and set your %Z to #TileZ

Offline xapcxTopic starter

  • Jr. Member
  • **
  • Posts: 30
  • Activity:
    0%
  • Reputation Power: 0
  • xapcx has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Re: Pathfinding question
« Reply #2 on: September 06, 2009, 04:04:44 PM »
0
I will look into the tile get command, I have never used it. 

With the event pathfind, %x %y, it works just fine as long as there is not a 2 level change in z from one tile to the next.  I will try it again with the %z

Scrripty

  • Guest
Re: Pathfinding question
« Reply #3 on: September 06, 2009, 04:16:19 PM »
0
I will look into the tile get command, I have never used it. 

With the event pathfind, %x %y, it works just fine as long as there is not a 2 level change in z from one tile to the next.  I will try it again with the %z

You can only event pathfind to places that are ON your screen too, I'm sure you know that, but I'm just reiterating. :)  Your spots that you are pathfinding TOO have to be fairly close.   I'm not sure what happens if you try to get to a spot that's too far away... I think it gives you the same message...?

Offline xapcxTopic starter

  • Jr. Member
  • **
  • Posts: 30
  • Activity:
    0%
  • Reputation Power: 0
  • xapcx has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Re: Pathfinding question
« Reply #4 on: September 06, 2009, 04:23:14 PM »
0
I will look into the tile get command, I have never used it. 

With the event pathfind, %x %y, it works just fine as long as there is not a 2 level change in z from one tile to the next.  I will try it again with the %z

You can only event pathfind to places that are ON your screen too, I'm sure you know that, but I'm just reiterating. :)  Your spots that you are pathfinding TOO have to be fairly close.   I'm not sure what happens if you try to get to a spot that's too far away... I think it gives you the same message...?

Yup exact same message if the spot is off of the screen

Tags: