Forum o bocie TibiaNG oraz ElfBotNG
Ucieczka w wyznaczone miejsce gdy ktos nas zaatakuje oraz powrot gdy ktos nas przesunie. Na poczatku idziemy w miejsce gdzie ma uciekac i wpisujemy w dowolnym kanale "destpos" (wielkosc liter ma znaczenie, no i oczywiscie bez "") powinno nam wyswietlic jaki jest X,Y,Z miejsca ucieczki, a potem idziemy w miejsce ktore ma byc startowa pozycja i wpisujemy "startpos". Od tej chwili jezeli ktos nas zaatakuje, bot ucieknie w miejsce w ktorym wpisalismy "destpos", a jezeli sie ruszymy, albo ktos nas przesunie (oczywiscie z wylaczeniem ucieczki) bot wroci na miejsce w ktorym wpisalismy "startpos"). Zeby skonczyc, albo stopujemy skrypt w Scripterze (w dolnym prawym rogu sa pokazane uruchomione skrypty, klikamy prawym na nazwe i "stop script") albo piszemy "stop" tez w obojetnym kanale.
[hide]
var koniec,startPos,destPos:boolean; destX,destY,destZ:integer; startX,startY,startZ:integer; function GoToPos(x,y,z:integer):boolean; var i:integer; begin return:=false; self.moveto(x,y,z); for i:=0 to 10 do begin if (self.x=x) and (self.y=y) and (self.z=z) then begin return := true; exit; end; sleep(500); end; end; procedure Event_Attacked(ID: integer); var i:integer; begin if (startpos=true) and (destpos=true) then begin for i:=1 to 5 do begin if GoToPos(destX,destY,destZ) then begin koniec:=true; exit; end; end; end; end; procedure getDestPos; begin destX := self.x; destY := self.y; destZ := self.z; self.displaytext('DestX='+inttostr(destX)+'; destY='+inttostr(destY)+'; destZ='+inttostr(destZ)); destPos:=true; end; procedure getStartPos; begin startX := self.x; startY := self.y; startZ := self.z; self.displaytext('StartX='+inttostr(startX)+'; startY='+inttostr(startY)+'; startZ='+inttostr(startZ)); startPos:=true; end; procedure Event_Message(Channel: integer; Name, Text: String); begin if name=self.name then case text of 'stop': koniec:=true; 'destpos': getDestPos; 'startpos': getStartPos; end; end; procedure checkpos; var i:integer; begin if ((self.x<>startX) or (self.y<>startY) or (self.z<>startZ)) then begin GoToPos(startX,startY,startZ) end; end; begin koniec :=false; destpos := false; startpos:=false; while not koniec do begin updateworld; ProcessEvents; if (startpos=true) and (destpos=true) then begin updateworld; checkpos; end; sleep(1000); end; end;[/hide]
Offline