Treinar com Monk
Treinar com Monk

Const 
StopAt=50;//para de atacar qn tiver com 50% de vida 
AttackAt=60;// ataca monk/player com mais de 50% de Life 
TrainName=['Monk','FrinedName1','FriendName2'];//vc pode alterar caso nao seja em mundo pvp
var 
creature:tcreature;

function GetCreatureByNameHPHIGH(Name: string): 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].Name = Name then 
if Creatures.Creature[x].z=Self.Z then 
if Creatures.Creature[x].Health>AttackAt then 
begin 
Result := Creatures.Creature[x]; 
Exit; 
end; 
end; 
end; 
function Attacking: boolean; 
var 
x: integer; 
begin 
Result := False; 
for x := 0 to Creatures.Count - 1 do 
begin 
if x >= Creatures.Count then Break; 
if Creatures.Creature[x].Attacking then 
begin 
Result := True; 
Exit; 
end; 
end; 
end; 
function GetAttackedCreature: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].Attacking=true then 
begin 
Result := Creatures.Creature[x]; 
Exit; 
end; 
end; 
end;

 


begin

while not Terminated do 
begin 
UpdateWorld; 
if not attacking then 
begin 
For x:=low(TrainName) to high(trainName) do 
begin 
If self.attacking<>0 then break; 
Creature:=GetCreatureByNameHPHIGH(TrainName[x]); 
if Creature <> nil then 
creature.attacking:=true; 
sleep(100); updateworld; 
end;
end; 
if attacking then 
begin 
Creature:=GetAttackedCreature; 
if Creature <> nil then 
if creature.Health < StopAt then creature.attacking:=false; 
end; 
sleep(1000); 
end; 
end;