- TibiaBot NG Problem z Botem NG

Status
Zamknięty.

Dura

User
Zarejestrowany
Dołączył
Grudzień 6, 2009
Posty
24
Liczba reakcji
0
Witam. Mam taki problem, ?e jak posta? zaznaczy potwora no podbiega do niego i sie czasem zacina, no jak by kto? m?g? mi wyt?umaczy? jak zrobi? ?eby nie podbiega? tylko jak zobaczy np. demona to stanie w miejscu i b?dzie sta? i bi? a jak go ?abie to ?eby szed? dalej

jak u?ywam takiego skrypty ?eby zaznacza? potwora

PHP:
Const
  MonsterList = ['Demon]
function GetCreatureByName: TCreature;
var
  x: integer;
begin
  Result := nil;
  for x := 0 to Creatures.Count - 1 do
  begin
    if x >= Creatures.Count then Break;
    if Creatures.Creature[x].Z = Self.Z then
    for i := low(MonsterList) to high(monsterlist) do
    if Creatures.Creature[x].Name = MonsterList[i] then
    begin
      Result := Creatures.Creature[x];
      Exit;
    end;
  end;
end;
While not terminated do
begin
  UpdateWorld;
  C := GetCreatureByName;
  if C <> nil then
  if not self.attacking then
  C.Attacking := true;
  sleep(100);
end;
 
Odp: Problem z Botem NG

Z tego co widz?, to u?ywasz skryptu kt?ry zamie?ci?em kilka godzin wcze?niej nie zwracaj?c uwagi do czego on s?u?y. Skrypt kt?ry aktualnie posiadasz s?u?y do wyznaczania w jakiej kolejno?ci ma zabija? pewne potworki np. Na pierwszym miejscu ustawiasz Dragon Lord'a, a na drugim dragona i je?eli b?dzie Ci? bi? dragon i dl, to bot automatycznie zacznie atakowa? bosa czyli dl ;). Spr?buj u?y? nast?puj?cego skryptu:

Kod:
function GetCreatureByID(ID: integer): TCreature;    
var    
  x: integer;    
begin    
  Result := nil;    
  for x := 0 to Creatures.Count - 1 do    
  begin    
    if x >= Creatures.Count then Break;    
    if Creatures.Creature[x].ID = ID then    
    begin    
      Result := Creatures.Creature[x];    
      Exit;    
    end;    
  end;    
end;    


function GetTileFromXYZ(X, Y, Z: integer): TTile;    
begin    
  Result := nil;    
  if abs((Self.X - 7) - X) > 14 then Exit;    
  if abs((Self.Y - 5) - Y) > 11 then Exit;    
  if Self.Z <> Z then Exit;    
  Result := Screen.Tile[abs((Self.X - 7) - X), abs((Self.Y - 5) - Y)];    
end;    


function TileIsWalkable(X, Y, Z: integer): boolean;  
const Ramps = [1950, 1952, 1954, 1956, 385, 1947, 434, 414, 604] 
var Tile: TTile;    
begin    
  Result := True;  
  Tile := GetTileFromXYZ(X, Y, Z);  
  If (Tile <> nil) and (Tile.Count <> 0) then    
    for i := 0 to Tile.Count - 1 do    
    begin    
      if Tile.Item[i].Properties.Hole then Result := False;    
      else if Tile.Item[i].Properties.Stairs then Result := False;    
      else if not Tile.Item[i].Properties.Walkable then Result := False; 
      else for j := Low(Ramps) to High(Ramps) do if Tile.Item[i].ID = Ramps[j] then Result := False;    
    end;    
end;    



while not Terminated do  
begin  
  UpdateWorld;  
  if Self.Attacking then  
  begin  
    Monster := GetCreatureByID(Self.Attacking);  
    if Monster <> nil then  
      Case Monster.Direction of  
        0:begin  
            if (Self.X = Monster.X) and (Self.Y = Monster.Y-1) and (Self.Z = Monster.Z) then  
            begin  
              if TileIsWalkable(Monster.X-1, Monster.Y-1, Monster.Z) then Self.MoveTo(Monster.X-1, Monster.Y-1, Monster.Z);  
              else  
              if TileIsWalkable(Monster.X+1, Monster.Y-1, Monster.Z) then Self.MoveTo(Monster.X+1, Monster.Y-1, Monster.Z);  
            end;  
          end;  
        1:begin  
            if (Self.X = Monster.X+1) and (Self.Y = Monster.Y) and (Self.Z = Monster.Z) then  
            begin  
              if TileIsWalkable(Monster.X+1, Monster.Y-1, Monster.Z) then Self.MoveTo(Monster.X+1, Monster.Y-1, Monster.Z);  
              else  
              if TileIsWalkable(Monster.X+1, Monster.Y+1, Monster.Z) then Self.MoveTo(Monster.X+1, Monster.Y+1, Monster.Z);  
            end;  
          end;  
        2:begin  
            if (Self.X = Monster.X) and (Self.Y = Monster.Y+1) and (Self.Z = Monster.Z) then  
            begin  
              if TileIsWalkable(Monster.X-1, Monster.Y+1, Monster.Z) then Self.MoveTo(Monster.X-1, Monster.Y+1, Monster.Z);  
              else  
              if TileIsWalkable(Monster.X+1, Monster.Y+1, Monster.Z) then Self.MoveTo(Monster.X+1, Monster.Y+1, Monster.Z);  
            end;  
          end;  
        3:begin  
            if (Self.X = Monster.X-1) and (Self.Y = Monster.Y) and (Self.Z = Monster.Z) then  
            begin  
              if TileIsWalkable(Monster.X-1, Monster.Y-1, Monster.Z) then Self.MoveTo(Monster.X-1, Monster.Y-1, Monster.Z);  
              else  
              if TileIsWalkable(Monster.X-1, Monster.Y+1, Monster.Z) then Self.MoveTo(Monster.X-1, Monster.Y+1, Monster.Z);  
            end;  
          end;  
      end;  
  end;  
  Sleep(250);  
end;

Z tego co wiem s?u?y on do stania na ukos od potwor?w :D.

Pozdrawiam.
 
Odp: Problem z Botem NG

Witam. M?g?by? si? troszk? wysili? i poszuka? tematu, a nie zak?adasz takie, kt?re by?y ju? omawiane. Link -> Zacina si? posta?.
 
Ostatnia edycja:
Odp: Problem z Botem NG

Vexiver to co ty mi da?e? za link to jus czyta?em i nie o to mi chodzi, tylko o to ?eby mi nie podbiega? do potwora
 
Odp: Problem z Botem NG

To, co napisa? u?ytkownik tego forum w tamtym temacie jest odpowiedzi? na twoj? pro?b?. Pozwol? sobie powt?rzy? s?owa u?ytkownika: Zak?adka "Options" ->> "Advenced" ->> "Enable Autocache". Tam b?dzie enable albo disable, nie jestem pewny. Pozdrawiam.
 
Status
Zamknięty.
Back
Do góry