Go To Place
Moderators: Murderator+, Murderator
Go To Place
I need a script with a function that, given X and Y coordinates of the world, makes the character move to them. Of course the problem is avoid the obstacles. Anyone has something like that?
OR
-
- Expert!
- Posts: 359
- Joined: 2004-04-25 11:11:07
- Contact:
There is two ways:
1) Difficult, complex script with intelligence obstacle-avoiding system.
Also large 2d array with passability may be used...
2) Use bulid-in client pathfinding. Use special formula to unproject world's tile coords. to uo window coords and make a right double click (of course, this will allow you to go only to tile you see on your screen)
It is good idea to combine thease methods (if script fails to find the way to destination point - it will calculate some waypoints and use pathfinding to go across them (if desination tile is not on your screen, otherwise it will just go to destination)).
1) Difficult, complex script with intelligence obstacle-avoiding system.
Also large 2d array with passability may be used...
2) Use bulid-in client pathfinding. Use special formula to unproject world's tile coords. to uo window coords and make a right double click (of course, this will allow you to go only to tile you see on your screen)
It is good idea to combine thease methods (if script fails to find the way to destination point - it will calculate some waypoints and use pathfinding to go across them (if desination tile is not on your screen, otherwise it will just go to destination)).
Без труда не выловишь и рыбку из пруда,
А без пруда не выловишь её и с трудом...
А без пруда не выловишь её и с трудом...
like this?
Code: Select all
sub Move(x,y)
var cx,cy,e=0,dir=1,M="-40-231-657"
while dir<>0
cx=uo.getx()
cy=uo.gety()
dir=(cy<y)+2*(cy>y)+4*(cx<x)+8*(cx>x)
if dir<>0 then
MoveK(val(M[dir]))
if cx==uo.getx() && cy==uo.gety() then
e=e+1
if e>=2 then
stack_solving()
endif
if e==40 then
return 0
endif
else
e=0
endif
endif
wend
return 1
endsub
sub MoveK(dir)
var x,y,time,Key="06172435"
if UO.GetDir()<>dir then
UO.Press(val(Key[dir])+33)
time=500
if UO.GetDir()<>dir then
if time==0 then
return 0
endif
wait(5)
time=time-5
endif
endif
x=UO.GetX()
y=UO.GetY()
time=500
UO.Press(val(Key[dir])+33)
while x==UO.GetX() && y==UO.GetY() && time>0
time=time-5
wait(5)
wend
return time>0
end sub
sub stack_solving()
uo.print("Son Incastrato!Stuck Solving Scelgo Te!")
uo.press(36)
uo.press(36)
uo.press(36)
uo.press(35)
uo.press(35)
end sub
I'm interested in what u wrote, but i think the code has been modified by the forum.. it's unusable. Could you send me it via mail? It's robyfonzypubbl@yahoo.it. Thanks.
OR