ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Grandewd on September 23, 2014, 01:36:18 PM

Title: Is my logic sound here?
Post by: Grandewd on September 23, 2014, 01:36:18 PM
Hi all,

I'm using the code below to make certain I get to the coords in event pathfind.  It seems to work fine, but wondering if there are any issues doing it like this:

Code: [Select]
top:
event pathfind 2149 1415 -23 3s
wait 1s
if #charposx <> 2149 && #charposy <> 1415
   {
    wait 10
    goto top
   }
else
halt
Title: Re: Is my logic sound here?
Post by: TrailMyx on September 23, 2014, 03:37:01 PM
Most pathfind function work like this.  Sometimes you can put a timer in there to make sure you actually make it to where you're going.  If you don't make it to the coords in a given amount of time, you can try another set of coords.  Just something to think about.
Title: Re: Is my logic sound here?
Post by: Grandewd on September 24, 2014, 10:19:06 AM
Hey TM...
Yea, you're right about alternative coords and waits of course.  If I were pathfinding around a dungeon or somewhere where unexpected stuff might get in the way, then I'd have alternatives.  Most my pathfind scripts are for running around my 5 houses, etc. so I generally know there's no reason to not get there.....
 ;)
Title: Re: Is my logic sound here?
Post by: manwinc on September 28, 2014, 02:22:55 AM
Usually you will want to use A Move Command with event pathfind as your backup plan. This will give you smoother Movement across Uneven Z Terrains( Like in T2a)


Move %X %Y 0 3s
if #Charposx <> %X || #Charposy <> %Y
{
Event Pathfind %X %Y
set %Time_Limit #scnt + 5
While ( #Charposx <> %X || #Charposy <> %Y ) && %Time_Limit > #Scnt
wait 1 
}

Untested code, but just showing concept of Move with a backup Pathfind.