Ir para conteúdo
  • Cadastre-se

[Resolvido] [PEDIDO] Script Pally X distância dos bichos


Posts Recomendados

Com 3 SQM de distancia.

Const 

  SQM = 3 // Quantos SQM de distancia? 


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;  


UpdateWorld; 

KnightID := Self.Following; 

while not terminated do 

begin 

  UpdateWorld; 

  Knight := GetCreatureByID(KnightID); 

  if Knight <> nil then 

  if Knight.Z = self.z then 

  begin 

    if self.following then 

    if (abs(Self.X-Knight.X) < SQM + 1) and (abs(Self.Y-Knight.Y) < SQM + 1) then 

    begin 

      Knight.Following := false; 

      UpdateWorld; 

      Self.MoveTo(Self.X,Self.Y,Self.Z); 

    end; 

    if not self.following then 

    begin 

      if (abs(Self.X-Knight.X) > SQM) or (abs(Self.Y-Knight.Y) > SQM) then 

      Knight.Following := true; 

    end; 

    if (not self.following) and (abs(Self.X - Knight.X) < 2) and (ABS(Self.Y - Knight.Y) < 2) then 

    begin 

      Knight.Following := true; 

      sleep(100); 

      Knight.Following := false; 

      sleep(1000); 

    end; 

  end; 

  else self.displaytext('Target is not on the same floor!'); 

  else self.displaytext('Target losed!!!'); 

  sleep(100); 

end;

Link para o post
Compartilhar em outros sites

Cuidado com o flood brother, da próxima vez edite o seu último post...

Há um outro script aqui para distância, veja se funciona:

const

RampsID = [1950, 1952, 1954, 1956, 385, 1947, 434, 414, 604, 7020]

Wanted='Troll';// Escolha o nome do Monstro aqui para vc correr á 3 SQM dele

Wanted2='Troll Champions';// Escolha outro Monstro aqui para vc correr á 3 SQM

AttackAt = 16;//recomendavel deixar assim

//fixado em 100 nao toma a distância

function GetCreatureByID(ID: integer): TCreature;

var

x: integer;

Finished: boolean;

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;

var Tile: TTile;

begin

Result := True;

Tile := GetTileFromXYZ(X, Y, Z);

If (Tile <> nil) and (Tile.Count <> 0) then

for Z := 0 to Tile.Count - 1 do

begin

if Tile.Item[Z].Properties.Hole then Result := False;

else if Tile.Item[Z].Properties.Stairs then Result := False;

else if not Tile.Item[Z].Properties.Walkable then Result := False;

else

begin

for x := low(RampsID) to high(RampsID) do

begin

if Tile.Item[Z].ID = RampsID[x] then Result := False;

end;

end;

end;

end;

Function MoveFromRange: boolean;

begin

Result := True;

Creature := GetCreatureByID(Self.Attacking);

if Creature <> nil then

//northwest

if ((Creature.X-self.X = 2) and (Creature.Y-self.Y = 2)) or

((Creature.X-self.X = 2) and (Creature.Y-self.Y = 3)) or

((Creature.X-self.X = 3) and (Creature.Y-self.Y = 2)) or

((Creature.X-self.X = 3) and (Creature.Y-self.Y = 3)) or

//southwest

((Creature.X-self.X = 2) and (Creature.Y-self.Y = -2)) or

((Creature.X-self.X = 2) and (Creature.Y-self.Y = -3)) or

((Creature.X-self.X = 3) and (Creature.Y-self.Y = -2)) or

((Creature.X-self.X = 3) and (Creature.Y-self.Y = -3)) or

//northeast

((Creature.X-self.X = -2) and (Creature.Y-self.Y = 2)) or

((Creature.X-self.X = -2) and (Creature.Y-self.Y = 3)) or

((Creature.X-self.X = -3) and (Creature.Y-self.Y = 2)) or

((Creature.X-self.X = -3) and (Creature.Y-self.Y = 3)) or

//southeast

((Creature.X-self.X = -2) and (Creature.Y-self.Y = -2)) or

((Creature.X-self.X = -2) and (Creature.Y-self.Y = -3)) or

((Creature.X-self.X = -3) and (Creature.Y-self.Y = -2)) or

((Creature.X-self.X = -3) and (Creature.Y-self.Y = -3)) then

Result := False;

end;

begin

while not Terminated do

begin

UpdateWorld;

if Self.Attacking <> 0 then

begin

Creature := GetCreatureByID(Self.Attacking);

if Terminated=True then exit;

if (Creature <> nil) and (MoveFromRange) then

if (Creature.Health<=AttackAt) then

if (Creature.Name=Wanted) or (Creature.Name=Wanted2) then

//// Add more monsters here in the same format if you want to run from them

//// make sure to add them also to the constant list at the top

begin

//Northwest of Creature

if (Creature.X > Self.X) and (Creature.Y > Self.Y) then

begin

Tile:=GetTileFromXYZ(Self.X, Creature.Y + 1, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Self.X, Creature.Y + 1, Creature.Z)) then

begin

Self.MoveTo(Self.X, Creature.Y + 1, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 1, Self.Y, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 1, Self.Y, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 1, Self.Y, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y - 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y - 2, Creature.Z)=true) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y - 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y - 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y - 3, Creature.Z)=true) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y - 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y - 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y - 2, Creature.Z)=true) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y - 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y - 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y - 3, Creature.Z)=true) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y - 3, Creature.Z);

end;

end;

//Southwest of Creature

if (Creature.X > Self.X) and (Creature.Y < Self.Y) then

begin

Tile:=GetTileFromXYZ(Self.X, Creature.Y - 1, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Self.X, Creature.Y - 1, Creature.Z)) then

begin

Self.MoveTo(Self.X, Creature.Y - 1, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 1, Self.Y, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 1, Self.Y, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 1, Self.Y, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y + 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 3, Creature.Y - 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 3, Creature.Y - 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 3, Creature.Y - 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 3, Creature.Y - 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 3, Creature.Y - 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 3, Creature.Y - 3, Creature.Z);

end;

end;

//Southeast of Creature

if (Creature.X < Self.X) and (Creature.Y < Self.Y) then

begin

Tile:=GetTileFromXYZ(Self.X, Creature.Y - 1, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Self.X, Creature.Y - 1, Creature.Z)) then

begin

Self.MoveTo(Self.X, Creature.Y - 1, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 1, Self.Y, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 1, Self.Y, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 1, Self.Y, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 2, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 2, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 2, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 2, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 2, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 2, Creature.Y + 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 3, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 3, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 3, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 3, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 3, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 3, Creature.Y + 3, Creature.Z);

end;

end;

//North of Creature

if (Creature.X = Self.X) and (Creature.Y > Self.Y) then

begin

Tile:=GetTileFromXYZ(Creature.X - 1, Self.Y, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 1, Self.Y, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 1, Self.Y, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 1, Self.Y, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 1, Self.Y, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 1, Self.Y, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 2, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 2, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 2, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 2, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 2, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 2, Creature.Y + 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 3, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 3, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 3, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X + 3, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X + 3, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X + 3, Creature.Y + 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y + 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y + 3, Creature.Z);

end;

end;

//West of Creature

if (Creature.X > Self.X) and (Creature.Y = Self.Y) then

begin

Tile:=GetTileFromXYZ(Self.X, Creature.Y - 1, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Self.X, Creature.Y - 1, Creature.Z)) then

begin

Self.MoveTo(Self.X, Creature.Y - 1, Creature.Z);

end;

Tile:=GetTileFromXYZ(Self.X, Creature.Y + 1, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Self.X, Creature.Y + 1, Creature.Z)) then

begin

Self.MoveTo(Self.X, Creature.Y + 1, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y - 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y - 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y - 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y + 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y + 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y + 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y + 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y + 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y + 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y + 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 2, Creature.Y - 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 2, Creature.Y - 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 2, Creature.Y - 3, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y - 2, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y - 2, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y - 2, Creature.Z);

end;

Tile:=GetTileFromXYZ(Creature.X - 3, Creature.Y - 3, Creature.Z);

if (Tile<>nil) and (TileIsWalkable(Creature.X - 3, Creature.Y - 3, Creature.Z)) then

begin

Self.MoveTo(Creature.X - 3, Creature.Y - 3, Creature.Z);

end;

end;

end;

//Diagonal if higher than Attackat health and 1sqm away

Creature := GetCreatureByID(Self.Attacking);

if Terminated=True then exit;

if (Creature <> nil) and (MoveFromRange) then

if (Creature.Health>AttackAt) then

if (Creature.Name=Wanted) or (Creature.Name=Wanted2) then

//// Add more monsters here in the same format if you want to be diagonal from them

//// make sure to add them also to the constant list at the top.

if (abs(Creature.X-self.X) <= 1) and (abs(Creature.Y-self.Y) <= 1) then

begin

if (Self.X<>Creature.X) and (Self.Y=Creature.Y) then

begin

Tile:=GetTileFromXYZ(Self.x,Self.y-1,self.z);

if Tile<>nil then

if TileIsWalkable(Self.x,Self.y-1,self.z) then

begin

Self.MoveUp;

Moved:=true;

end;

If (Moved=False) then

begin

Tile:=GetTileFromXYZ(Self.x,Self.y+1,self.z);

if Tile<>nil then

if TileIsWalkable(Self.x,Self.y+1,self.z) then

Self.MoveDown;

end;

end;

Moved:=false;

if (Self.X=Creature.X) and (Self.Y<>Creature.Y) then

begin

Tile:=GetTileFromXYZ(Self.x-1,Self.y,self.z);

if Tile<>nil then

if TileIsWalkable(Self.x-1,Self.y,self.z) then

begin

Self.MoveLeft;

Moved:=true;

end;

If (Moved=False) then

begin

Tile:=GetTileFromXYZ(Self.x+1,Self.y,self.z);

if Tile<>nil then

if TileIsWalkable(Self.x+1,Self.y,self.z) then

Self.MoveRight;

end;

end;

end;

end;

sleep(500);

end;

end;

Lembrando que você terá que editar aonde eu marquei em negrito, para o nome do monsters que você irá caçar, se quiser colocar mais de dois é só adicionar em baixo:

Wanted='Troll';

Wanted2='Troll Champions';

Wanted3='Nome do monsters';

Abraços.

Link para o post
Compartilhar em outros sites

Esses script que tem por ai na net já testei tudo.

Percebi uma limitação no NG, vou fazer uns testes aqui, com script para atacar os bichos e outro script para distancia.

Sem usar o autoattack do NG, porque ele coloca Auto Following.

Só que sem o autoattack ele não abre loot dos mostros ai precisa de outro script para abrir os corpos.

Enfim... não sei se vale a pena todo o trabalho.

Link para o post
Compartilhar em outros sites

É tenso isso no NG... Tenta usar outro bot, há alguns ae que já vem para você definir a distância do alvo. Um ótimo bot era o Elf, mas acabou =\

Abraços.

Link para o post
Compartilhar em outros sites
  • 2 weeks later...

Esse bot mantem distância do monstro? fica correndo dele? Sabe me informar quais bots fazem isso?

Que eu saiba, o NeoBot e o BBot .-.

O bbot, vc escolhe qntos sqm pra vc atacar o bixo ;D

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo