Script para Trocar de Arma

Const
MonsterList1 = ['Ghoul']
MonsterList2 = ['Fire Elemental']
Weapon1_ID = 651 //Weapon for MonsterList1
Weapon2_ID = 3350 //Weapon for MonsterList2
Weapon3_ID = 8090 //Weapon for all other crap

function GetItemFromOpenBackpack(ID: integer): TItem;
var
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;

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 GetCreatureByName(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
begin
Result := Creatures.Creature[x];
Exit;
end;
end;
end;

function IsCreatureVisible(Name: string): 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].Name = Name then
begin
if Creatures.Creature[x].Visible then
begin
Result := True;
Exit;
end;
end;
end;
end;

while not terminated do
begin
Continue := 0;
UpdateWorld;
Creature := GetCreatureByID(Self.Attacking);
if Creature <> nil then
begin
for i := low(MonsterList1) to high(MonsterList1) do
begin
if MonsterList1[i] = Creature.Name then
Continue := 1;
end;
if Continue then
begin
Weapon := GetItemFromOpenBackpack(Weapon1_ID);
if Self.RightHand.ID <> Weapon1_ID then
begin
if Weapon = nil then
self.DisplayText('Weapon1 wasnt found in open backpack!');
else
Weapon.MoveToBody(Self.RightHand,0);
end;
end;
else
begin
for m := low(MonsterList2) to high(MonsterList2) do
begin
if MonsterList2[m] = Creature.Name then
Continue := 1;
end;
if Continue then
begin
Weapon := GetItemFromOpenBackpack(Weapon2_ID);
if Self.RightHand.ID <> Weapon2_ID then
begin
if Weapon = nil then
self.DisplayText('Weapon2 wasnt found in open backpack!');
else
Weapon.MoveToBody(Self.RightHand,0);
end;
end;
else
if Self.RightHand.ID <> Weapon3_ID then
begin
Weapon := GetItemFromOpenBackpack(Weapon3_ID);
if Weapon <> nil then
Weapon.MoveToBody(Self.RightHand,0);
else Self.DisplayText('Weapon3 wasnt found in opened backpack!');
end;
end;
end;
sleep(100);
end;

0 comentários: