//By Ash Katchup at 30 nov 2008
//Remember: This script use your Right Hand (--->)
Const
MonsterNames = ['Frost Dragon']; //Monster's list to attack with all
RuneId = 3155; //Id of the rune to use on monster
UseRune = 1 //0-Off, 1-On
WeaponId = 8082; //Id of weapon to use when attacking this monster
EquipWeapon = 0; //0-Off, 1 -On
OldWeaponId = 3280; //Id of weapon to use when NOT attacking this monster
function NeedAtk(Name:string):integer;
var
x:integer;
begin
Result:=1000;
for x:=Low(MonsterNames) To High(MonsterNames) do begin
if MonsterNames[x]=Name then Result:=x;
end;
end;
function GetCreatureByName(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].Z <> Self.Z then Continue;
If Creatures.Creature[x].Id = Id then begin
Result := Creatures.Creature[x];
Exit;
end;
end;
end;
function GetItemFromOpenBackpack(ID: integer): TItem;
var
x: integer;
y: integer;
begin
Result := nil;
for x := 0 to Self.Containers.Count - 1 do
begin
if x >= Self.Containers.Count then Break;
for y := 0 to Self.Containers.Container[x].Count - 1 do
begin
if y >= Self.Containers.Container[x].Count then Break;
if Self.Containers.Container[x].Item[y].ID = ID then
begin
Result := Self.Containers.Container[x].Item[y];
Exit;
end;
end;
end;
end;
While Not Terminated do begin
updateworld;
if (Self.Attacking <> nil) then begin
Creature:=GetCreatureByName(Self.Attacking);
If Creature <> nil then begin
If NeedAtk(Creature.Name) <> 1000 then begin
If EquipWeapon = 1 then begin
Weapon:= GetItemFromOpenBackpack(WeaponId);
if (Self.RightHand.Id <> WeaponId) and (Weapon <> nil) then
Weapon.MoveToBody(Self.RightHand,0);
end;
If UseRune = 1 then begin
Self.Containers.UseItemWithCreature(RuneId, Creature);
Sleep(2000);
end;
end else begin
Weapon:= GetItemFromOpenBackpack(OldWeaponId);
If (Weapon <> nil ) and (Self.RightHand.Id <> OldWeaponId) then
Weapon.MoveToBody(Self.RightHand,0);
end;
end;
end;
end;
Zakładki