uo.set("finddistance","7")

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Unfogiven
Posts: 44
Joined: 2006-12-18 11:33:01

uo.set("finddistance","7")

Post by Unfogiven »

Проблема такая он идёт к мобу который находится за екраном !
А который бегает в 2 тайлох от чара он не трогает (
Cтавлю меньше uo.set("finddistance","7") например на 4 все равно он бежыт к мобу который где то там далеко

Code: Select all

sub atack()
var c, a, noto, ser, f=0
while 1==1
uo.warmode(1)
uo.deletejournal()
uo.set("finddistance","7")  ################
uo.findtype('0x0004','-1','ground')
uo.arm('1')
if uo.findcount() then
f=1
uo.attack('finditem')
while f==1
 uo.findtype('0x0004','-1','ground')
 go(uo.getx('finditem'),uo.gety('finditem'))
 uo.findtype('0x0004','-1','ground')
 wait(500)
 if uo.gethp()<55 then
   GHDrink()
 endif
 if uo.injournal('Body of Gargoyle') then
  f=0
 endif
 uo.deletejournal()
wend
endif
 rez()
   wait(2000)
         uo.FindType(0x0F78,'-1','lastcorpse')
    if uo.FindCount() then
      uo.moveitem('finditem','all')
      wait(750)
    end if
    uo.warmode(0)
   if not uo.hidden() then
    uo.useskill('Hiding')
    c=0
     while not uo.injournal('have hidden') and c<18
      wait(300)
      c=c+1
     wend
   endif
    uo.waittargetobject('lastcontainer')
    uo.setarm(11)
    wait(100)
    uo.useobject('sword')
    wait(1500)
    uo.arm(11)
    wait(1000)
   while uo.gethp()<190
   healing()
   wait(1000)
  wend
 endif
 uo.deletejournal()
wend
endsub

sub healing()
  if not uo.hidden() then
  uo.UseSkill('Meditation')
  endif
  uo.setarm('11')
  uo.bandageself()
  wait(1500)
  uo.arm('11')
  uo.attack('lastattack')
end sub
:?
Ururu
Posts: 479
Joined: 2007-02-21 20:15:57

Post by Ururu »

Можно попробовать искать постепенно увеличивая расстояние, либо искать всех и определять кто ближе.
Шард Антарес
Ururu
Unfogiven
Posts: 44
Joined: 2006-12-18 11:33:01

Post by Unfogiven »

Он берёт на вар ближайшего моба а идёт к далнему (
Denton
Posts: 82
Joined: 2004-07-14 22:56:46
Location: Украина, Одесса
Contact:

Post by Denton »

Так зачем два раза искать одного и того же монстра, если его id уже вбит в память после первого поиска?
Убери вторую строчку uo.findtype(.........) которая перед go(uo.getx('finditem'),uo.gety('finditem'))
ХХДЕНТОНХХ: Холодостойкий Хронометрирующий Дроид с Единым Наступательным Трансмутатором для Ограниченного Нападения и Хронометрированного Хищения
http://uokings.ru/news.php
Unfogiven
Posts: 44
Joined: 2006-12-18 11:33:01

Post by Unfogiven »

3 раза ишет
uo.findtype('0x0004','-1','ground')
Denton
Posts: 82
Joined: 2004-07-14 22:56:46
Location: Украина, Одесса
Contact:

Post by Denton »

тем более, один раз ищешь за цикл убийства одного монстра
ХХДЕНТОНХХ: Холодостойкий Хронометрирующий Дроид с Единым Наступательным Трансмутатором для Ограниченного Нападения и Хронометрированного Хищения
http://uokings.ru/news.php
Unfogiven
Posts: 44
Joined: 2006-12-18 11:33:01

Post by Unfogiven »

:!: хм

Code: Select all

uo.set("finddistance","5") 
uo.findtype('0x0004','-1','ground')
uo.arm('1')
if uo.findcount() then
f=1
uo.attack('finditem')
while f==1

Ето ишет и берёт на атаку
####################

Code: Select all

uo.findtype('0x0004','-1','ground') 
 go(uo.getx('finditem'),uo.gety('finditem'))

Ето ишет и идёт к ней ! Если убераеш 2 uo.findtype('0x0004','-1','ground')
перед go(uo.getx('finditem'),uo.gety('finditem')) [/code]
то он не знает куда идти !
Scripts Writer
Posts: 2259
Joined: 2005-04-19 18:00:29
Location: Московская область
Contact:

Post by Scripts Writer »

Unfogiven wrote::!: хм

Code: Select all

uo.set("finddistance","5") 
uo.findtype('0x0004','-1','ground')
uo.arm('1')
if uo.findcount() then
f=1
uo.attack('finditem')
while f==1

Ето ишет и берёт на атаку
####################

Code: Select all

uo.findtype('0x0004','-1','ground') 
 go(uo.getx('finditem'),uo.gety('finditem'))

Ето ишет и идёт к ней ! Если убераеш 2 uo.findtype('0x0004','-1','ground')
перед go(uo.getx('finditem'),uo.gety('finditem')) [/code]
то он не знает куда идти !


Когда 1 раз нашел, то ID заносится в finditem на всё время запуска скрипта или до следующего поиска по типу
Denton
Posts: 82
Joined: 2004-07-14 22:56:46
Location: Украина, Одесса
Contact:

Post by Denton »

т.е. первый поиск оставляешь, а два следующих убирай
ХХДЕНТОНХХ: Холодостойкий Хронометрирующий Дроид с Единым Наступательным Трансмутатором для Ограниченного Нападения и Хронометрированного Хищения
http://uokings.ru/news.php
Unfogiven
Posts: 44
Joined: 2006-12-18 11:33:01

Post by Unfogiven »

Да пробовал получатся так находит берёт на вар
Потом просто идёт кудато в сторону тоесть он не знает к кому подходить !
Okypok
Posts: 100
Joined: 2007-10-12 20:48:07

Post by Okypok »

Ой вей.

Code: Select all

sub find()
Var lastX,lastY,myX,myY,Victim,LastTimer,i,z
myX=UO.GetX()
myY=UO.GetY()
lastX=myX
lastY=myY
repeat
   UO.set('finddistance', 5)
   UO.findtype('0x000D','-1','ground')
        wait(100)
   if UO.FindCount()>0 then
           Victim=UO.GetSerial('finditem')
      repeat
                    if UO.GetDistance(Victim)>1 then
                        WalkN(0,0,Victim)
                    end if
                    UO.attack(Victim)
                    wait(1000)
                   
                    wait(100)
      until uo.dead() or uo.GetX(Victim)<1 or LastTimer+100<UO.Timer()
      
         end if
               wait(200)
                    loot()
                    wait(200)
          if Numb(myX-lastX)<=3 and Numb(myY-lastY)<=3 then
         GotoXY(lastX,lastY)
                   end if
         end if
   if UO.Weight>=UO.Str*4 then
           wait(500)
          UO.Ignore('finditem')
           unload()
    end if
until uo.dead()
end sub

sub Numb(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub



Ходилка под это дело на всякий случай:

Code: Select all

Sub WalkN(x,y,Target)
VAR i, StepSucess, dx, dy, Exit=0

    while Exit<>1

        ###---РАСЧЕТ ДВИЖЕНИЯ
        if Target<>"" then
            dx=UO.GetX(Target)-UO.GetX()
            dy=UO.GetY(Target)-UO.GetY()

            if UO.GetDistance(Target)<2 then
                Exit=1
            end if
        else
            dx=x-UO.GetX()
            dy=y-UO.GetY()
            if dx==0 AND dy==0 Then
                Exit=1
            end if
        end if

        if dx<>0 AND dy<>0 then
            if dx>0 AND dy>0 then
                StepSucess=Go(3,40,300)         # SE - DownArrow
                if StepSucess==-1 then
                    StepSucess=Go(7,38,300)     # WN - UpArrow
                    StepSucess=Go(1,39,300)     # NE - RightArrow
                    if StepSucess==-1 then
                        StepSucess=Go(5,37,300) # SW - LeftArrow
                    end if
                end if
            end if

            if dx>0 AND dy<0 then
                StepSucess=Go(1,39,300)         # NE - RightArrow
                if StepSucess==-1 then
                    StepSucess=Go(5,37,300)     # SW - LeftArrow
                    StepSucess=Go(3,40,300)     # SE - DownArrow
                    if StepSucess==-1 then
                        StepSucess=Go(7,38,300) # WN - UpArrow
                    end if
                end if
            end if

            if dx<0 AND dy>0 then
                StepSucess=Go(5,37,300)         # SW - LeftArrow
                if StepSucess==-1 then
                    StepSucess=Go(1,39,300)     # NE - RightArrow
                    StepSucess=Go(7,38,300)     # WN - UpArrow
                    if StepSucess==-1 then
                        StepSucess=Go(3,40,300) # SE - DownArrow
                    end if
                end if
            end if

            if dx<0 AND dy<0 then
                StepSucess=Go(7,38,300)         # WN - UpArrow
                if StepSucess==-1 then
                    StepSucess=Go(3,40,300)     # SE - DownArrow
                    StepSucess=Go(5,37,300)     # SW - LeftArrow
                    if StepSucess==-1 then
                        StepSucess=Go(1,39,300) # NE - RightArrow
                    end if
                end if
            end if
        end if

        if dx<>0 AND dy==0 then
            if dx>0 then
                StepSucess=Go(2,34,300)         # E - PgDown
                if StepSucess==-1 then
                    StepSucess=Go(3,40,300)     # SE - DownArrow
                    if StepSucess==-1 then
                        StepSucess=Go(1,39,300) # NE - RightArrow
                    end if
                    StepSucess=Go(2,34,300)     # E - PgDown
                end if
            end if

            if dx<0 then
                StepSucess=Go(6,36,300)         # W - Home
                if StepSucess==-1 then
                    StepSucess=Go(7,38,300)     # WN - UpArrow
                    if StepSucess==-1 then
                        StepSucess=Go(5,37,300) # SW - LeftArrow
                    end if
                    StepSucess=Go(6,36,300)     # W - Home
                end if
            end if
        end if


        if dx==0 AND dy<>0 then
            if dy>0 then
                StepSucess=Go(4,35,300)         # S - End
                if StepSucess==-1 then
                    StepSucess=Go(3,40,300)     # SE - DownArrow
                    if StepSucess==-1 then
                        StepSucess=Go(5,37,300) # SW - LeftArrow
                    end if
                    StepSucess=Go(4,35,300)     # S - End
                end if
            end if

            if dy<0 then
                StepSucess=Go(0,33,300)         # N - PgUp
                if StepSucess==-1 then
                    StepSucess=Go(1,39,300)     # NE - RightArrow
                    if StepSucess==-1 then
                        StepSucess=Go(7,38,300) # WN - UpArrow
                    end if
                    StepSucess=Go(0,33,300)     # N - PgUp
                end if
            end if
        end if

    wend

end sub

#################### ПОДПРОГРАММА ДЛЯ ХОДИЛКИ #########################

Sub Go(dir,key,walkwait)
VAR x,y, OldDir, w=30

    x=UO.GetX()
    y=UO.GetY()
    OldDir=UO.GetDir()
    if UO.GetDir()<>dir then
        UO.Press(key)
        wait(walkwait)
    end if

    UO.Press(key)
    wait(w)

    if x==UO.GetX() AND y==UO.GetY() AND OldDir<>UO.GetDir() then
        UO.Press(key)
        wait(w)
    end if

end sub
Image
Image
Post Reply