ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: bluepits on December 26, 2011, 04:08:32 AM
-
Hello everone ive been having a bit of trouble to get the wither to work in the script. It will wither once on first spot then not wither at all. just moves to spot to spot Here is part of it maby someone can spot what i am doing wrong and help me fix this plz?
event Pathfind %spot1x %spot1y
wait 5s
if #charposx = %spot1x && #charposy = %spot1y
goto main
else
{
display Can not find starting point. Please go to Beach area and press play.
pause
goto firstspot
}
set %wither #TRUE
}
repeat
gosub NextSpot
return
}
gosub wither
}
wait 4s
return
sub wither
event macro 15 115 ; wither
return
sub NextSpot
if %spot = 1
{
move %spot2x %spot2y 3 10s
set %spot 2
return
}
if %spot = 2
{
move %spot3x %spot3y 3 10s
set %spot 3
return
}
if %spot = 3
{
move %spot4x %spot4y 3 10s
set %spot 4
return
}
if %spot = 4
{
move %spot5x %spot5y 3 10s
set %spot 5
return
}
if %spot = 5
{
move %spot6x %spot6y 3 10s
set %spot 6
return
}
if %spot = 6
{
move %spot7x %spot7y 3 10s
set %spot 7
return
}
if %spot = 7
{
move %spot8x %spot8y 3 10s
set %spot 8
return
}
if %spot = 8
{
move %spot9x %spot9y 3 10s
set %spot 9
return
}
if %spot = 9
{
move %spot10x %spot10y 3 10s
set %spot 10
return
}
if %spot = 10
{
move %spot11x %spot11y 3 10s
set %spot 11
return
}
if %spot = 11
{
move %spot1x %spot1y 3 10s
set %spot 1
return
}
-
When placing code please use the insert code option. Just makes it a little easier to read. From a quick glance, and not seeing the rest of the code, a few things stick out. First I see a Repeat but no Until. Also I see three right hand brackets but no left brackets to match.
set %wither #TRUE
}
repeat
gosub NextSpot
return
}
gosub wither
}
wait 4s
return
-
Here is a generic way of doing what you wanted. It will run to each spot, wither, then run to next spot, wither, nextspot etc etc etc... You need to plug in your x and y coords to x1 / y1 (spot1x / spot1y) , x2 y2, etc.
repeat
gosub pathfind_to_point x1 y1 ; where x1 is your #charposx destination 1, and y1 is #charposy destination 1
gosub wither
gosub pathfind_to_point x2 y2 ; where x2 is your #charposx destination 2, and y2 is #charposy destination 2
gosub wither
gosub pathfind_to_point x3 y3
gosub wither
gosub pathfind_to_point x4 y4
gosub wither
gosub pathfind_to_point x5 y5
gosub wither
gosub pathfind_to_point x6 y6
gosub wither
gosub pathfind_to_point x7 y7
gosub wither
gosub pathfind_to_point x8 y8
gosub wither
gosub pathfind_to_point x9 y9
gosub wither
gosub pathfind_to_point x10 y10
gosub wither
gosub pathfind_to_point x11 y11
gosub wither
until #charghost = yes
;--------------------
sub pathfind_to_point
;%1 #charposx
;%2 #charposy
repeat
set %safety_timer ( #scnt + 20 )
event pathfind %1 %2
wait 5
until ( #charposx = %1 && #charposy = %2 ) || ( #scnt >= %safety_timer )
if #charposx <> %1 && #charposy <> %2
{
display ok Can not find starting point. Please go to Beach area and restart script.
halt
}
return
;---------------------
sub wither
event macro 15 115 ; wither
wait 10
return
-
Thank you that help alot it work great with the rest. was kinda try to stay away from path finding but i think it helped plant a seed in my mind thx again
-
I would do something like this.
set %monsters AAA_BBB_CCCC
set %spot1x 1111
set %spot1y 2222
set %spot2x 1112
set %spot3y 2223
; ..............
repeat
repeat
for %i 1 11
{
gosub move %spot . %i . x %spot . %i . y 10
gosub wither
}
until #charghost = yes
until #charghost = yes
stop
Sub Move
if #charposx <> %1 && #charposy <> %2
{
set %_pathfind_fail #false
set %_jindex #jindex
set %timer_move ( #sCnt + %3 )
event pathfind %1 %2
repeat
{
if #jindex >= %_jindex
{
scanjournal %_jindex
if can't_get_there in #journal
set %_pathfind_fail #true
set %_jindex %_jindex + 1
}
}
until #charposx = %1 && #charposy = %2 || #scnt > %timer_move || %_pathfind_fail = #true
if #charposx <> %1 && #charposy <> %2
move %1 %2 a %10 , s
}
return
Sub wither
finditem %monsters G_4 ; whatever the radius is
while #findcnt > 0 && #mana > 20 ; just a guess
{
event macro 33 ; just a guess, i'm to lazy to look at the manual
wait 20 ; random wait
finditem %monsters G_4 ; whatever the radius is
}
return
the code is untested, just a thought..
-
Here is a generic way of doing what you wanted. It will run to each spot, wither, then run to next spot,
How about even more generic
set %monsters AAA_BBB_CCCC
set %spotx1 1111
set %spoty1 2222
set %spotx2 1112
set %spoty2 1112
set %spoty3 2223
set %spoty3 1112
repeat
for %C 1 3
{
gosub pathfind_to_point %Spotx . %c %Spoty . %c
gosub wither
}
until #charghost = yes
;--------------------
sub pathfind_to_point
;%1 #charposx
;%2 #charposy
repeat
set %safety_timer ( #scnt + 20 )
event pathfind %1 %2
wait 5
until ( #charposx = %1 && #charposy = %2 ) || ( #scnt >= %safety_timer )
if #charposx <> %1 && #charposy <> %2
{
display ok Can not find starting point. Please go to Beach area and restart script.
halt
}
return
;---------------------
sub wither
event macro 15 115 ; wither
wait 10
return