Hihobloodhitcontrol

This script will simply change your attacking mode to Offensive if you didnt hit loot after X seconds.
Once blood hit detected,you will switch back to offensive mode.
For saftly there is a system to check how many creatures around you and if it goes over Y creatures,you switch to Offensive mode.

Const 
MaxCreatures=2; //if there are more creature than that,you would change to strong weapon 
Wait=10;//Check if after X seconds there was no damage 
function CreatureScreen : integer; 
var 
x:integer; 
begin 
Result:=0; 
for x := 0 to Creatures.Count - 1 do 
  begin 
    if x >= Creatures.Count then Break; 
    if (Creatures.Creature[x].Z=Self.Z) then 
    if (Creatures.Creature[x].NPC=true) then 
    if (ABS(Creatures.Creature[x].X-Self.X)=1) or ((Creatures.Creature[x].X-Self.X)=0) then 
    Result:=Result+1; 
   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 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 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; 

var 
Creature:TCreature; 
TempHP:integer; 
Attacked:boolean; 
begin 
Attacked:=false; 
TempHP:=0; 
while not Terminated do 
     begin 
     Updateworld; 
     if (CreatureScreen<=MaxCreatures)then begin Self.Defensive; Self.DisplayText('Defensive ON'); sleep(1000); end; 
     If Attacking and (CreatureScreen<MaxCreatures) then 
                 begin 
                 Creature:=GetAttackedCreature; 
                 if Creature.Health>=TempHP then 
                    begin 
                    TempHP:=Creature.Health; 
                    sleep(1000); 
                    While Creature.Health>=TempHP do 
                       begin 
                       Creature:=GetAttackedCreature; 
                       if Creature= nil then break; 
                       Self.Offensive; 
                       sleep(1000); 
                       updateworld; 
                       Self.DisplayText('No blood-Offensive ON'); 
                       end; 
                    Self.DisplayText('Blood detected-Defensive ON'); 
                    Self.Defensive; 
                    end 
                    else 
                      TempHP:=Creature.Health; 
                 end else 
     if not (CreatureScreen<=MaxCreatures) then begin Self.DisplayText('Many Creatures on screen-Offensive On'); 
     Self.Offensive; end; 
     Sleep(Wait*1000); 
     end; 
end;
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License