ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: xapcx on September 06, 2009, 03:56:26 PM

Title: Pathfinding question
Post by: xapcx on September 06, 2009, 03:56:26 PM
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
Title: Re: Pathfinding question
Post by: Superslayer on September 06, 2009, 04:02:21 PM
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
Title: Re: Pathfinding question
Post by: xapcx on September 06, 2009, 04:04:44 PM
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
Title: Re: Pathfinding question
Post by: Scrripty on September 06, 2009, 04:16:19 PM
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...?
Title: Re: Pathfinding question
Post by: xapcx on September 06, 2009, 04:23:14 PM
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