ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Ketchup on July 13, 2017, 05:12:34 PM

Title: Pathfinding issue
Post by: Ketchup on July 13, 2017, 05:12:34 PM
Having an issue with it returning to the spot but still spamming pathfinding, if anyone can point me in the direction of what I need to add to make it return to the spot and stop trying to pathfind I would muchly appreciate it, thanks!
Code: [Select]
sub findattack1
finditem %target G_15
if #findcnt < 1
event pathfind 6788 3444
{
if #finddist > 1
event pathfind #findx #findy #findz
gosub attackmob
}
until #findcnt < 1
return
Title: Re: Pathfinding issue
Post by: The Ghost on July 13, 2017, 05:27:38 PM
OK few question.

1)  event pathfind 6788 3444  < ------   why you hard code those number. 
2) what are you trying to pathfind too monster or location.

not tested  this is some a few chance I will made. but it missing stuff.
Code: easyuo
  1. sub findattack1
  2. finditem %target G_15
  3. if #findcnt = 0
  4.   event pathfind 6788 3444  :   <  why this hard code
  5.       {
  6.       if #finddist > 0 ; if monster is 1 or more title move to him
  7.       event pathfind #findx #findy #findz    ; <  this is not work because you haven't set up at reference point.
  8.       gosub attackmob
  9.       }
  10. until #FindCNT = 0  ; if no more monster exit
  11. return
  12.  

Title: Re: Pathfinding issue
Post by: Ketchup on July 13, 2017, 05:29:37 PM
Excuse me if I'm a bit noob, still trying to learn
1.Not even sure what hard code is haha
2. it's a location
To add the run to mob actually works in my script its just when returning to the location it just keeps pathfinding instead of just doing it once, I want my script to be able to do other subs while it is stationary but the pathfinding spam is killing it
Title: Re: Pathfinding issue
Post by: The Ghost on July 13, 2017, 05:37:59 PM
Hard code mean that  the value can't chance, unless you do. 

event pathfind 6788 3444  :   <  this  is hard code.

 event PathFind #FindX #FindY ; Moves to the assign target. Land/ground/ mobile

Since you have provide only 1 location, that why you move their and spam work. because it a loop. 

if you want to see the flow of your sub without hitting pause you this
   Event sysmessage ( add word here)     
  This will display a msg in the bottom left of your screen


Now serious question.  You are trying to kill a target and go back to you starting point.
Title: Re: Pathfinding issue
Post by: Ketchup on July 13, 2017, 05:40:41 PM
yeah just simply run to a target, kill it and run back to a point, I want to add my own subs when it's back at the point doing nothing
Title: Re: Pathfinding issue
Post by: The Ghost on July 25, 2017, 01:43:56 PM
Ketchup,  did you read this http://www.scriptuo.com/index.php?topic=14053.msg115325#msg115325
you have a few example of script how to use move and pathfind.