I am having an issue and I'd like to know if anyone of you could help.
I am developing a PVM script to use with the DLL client. For instance, I'd like to press F10 and get my stealth a procedure.
The problem I am having is that I can't keep a certain value stored in a var. For exemple, I would like to develop a procedure to get my enemy ID and keep it for the others procedures. However, as soon as the procedure to get the target's ID is terminated, the var "Enemy" gets blank.
Here's what i've got so far (the procedure "Target" is the one that keeps the lasttarget ID as the enemy ID):
Code: Select all
Program PVM;
const
QtdItens = 3;
IDArma = $4012F1A4;
var
Enemy : cardinal;
mItem, mCorpo : cardinal;
Item : array[1..QtdItens] of cardinal;
procedure Itens;
Begin
Item[1] := $0EED; // Gold
Item[2] := $1BD1; // Pena
Item[3] := $0DF8; // Wool
End;
procedure Armar;
Begin
Disarm;
UOSay('.equipweapon');
UOSay('.equiparmor');
If (not WarMode) then SetWarMode(True);
Attack(LastTarget);
ClientPrint(GetName(LastTarget));
ClientPrint(IntToStr(GetHP(WarTargetID)));
End;
procedure EquipBow;
Begin
UseObject(FindType($13B1, Backpack));
If (not WarMode) then SetWarMode(True);
Attack(LastTarget);
ClientPrint(GetName(LastTarget));
ClientPrint(IntToStr(GetHP(WarTargetID)));
End;
procedure Target;
Begin
Cast('Magic Arrow');
WaitForTarget(3000);
Enemy := LastTarget;
ClientPrint(GetName(LastTarget));
End;
procedure Paralyze;
Begin
If TargetPresent then CancelTarget;
Cast('Paralyze');
TargetToObject(Enemy);
Armar;
End;
procedure Poison;
Begin
If TargetPresent then CancelTarget;
Cast('Poison');
WaitTargetObject(Enemy);
Armar;
End;
procedure Murar;
Begin
Cast('Wall of Stone');
WaitTargetTile(0, GetX(Enemy), GetY(Enemy), GetZ(Enemy));
Armar;
End;
procedure TotalMana;
Begin
UseObject(FindTypeEx($0F0E, $0388, Backpack, True));
End;
procedure DeadlyPoison;
Begin
If TargetPresent then CancelTarget;
UOSay('.equipweapon');
UseSkill('Poisoning');
WaitTargetObject(IDArma);
WaitForTarget(5000);
WaitTargetObject(FindTypeEx($0F0E, $07A8, BackPack, True));
End;
procedure Meditation;
Begin
Useskill('Meditation');
End;
procedure Stealth;
Begin
UseSkill('Stealth');
End;
procedure OpenDoor;
Begin
OpenDoor;
End;
procedure Loot;
var
i : integer;
Begin
Itens;
FindDistance := 2;
mCorpo := FindType($2006, Ground);
UseObject(mCorpo);
Wait(500);
For i := 1 to QtdItens do
Begin
mItem := FindType(Item[i], mCorpo);
If (mItem <> 0) then
Begin
Wait(200);
MoveItem(mItem, GetQuantity(mItem), Backpack, 0, 0, 0);
Wait(500);
End;
End;
End;
procedure CarveMeat;
var
i : integer;
Begin
Itens;
FindDistance := 1;
mCorpo := FindType($2006, Ground);
UseObject(ObjAtLayer(RHandLayer));
Wait(500);
TargettoObject(mCorpo);
Wait(500);
UseObject(mCorpo);
Wait(500);
For i := 1 to QtdItens do
Begin
mItem := FindType(Item[i], mCorpo);
If (mItem <> 0) then
Begin
Wait(200);
MoveItem(mItem, GetQuantity(mItem), Backpack, 0, 0, 0);
Wait(500);
End;
End;
End;
procedure MostrarHP;
Begin
ClientPrint(IntToStr(GetHP(Enemy)));
End;
procedure FlameStrike;
Begin
If TargetPresent then CancelTarget;
Cast('Flame Strike');
WaitTargetObject(Enemy);
Armar;
End;
procedure Heal;
Begin
If TargetPresent then CancelTarget;
Cast('Heal');
WaitTargetObject(Self);
Armar;
End;
Begin
End.
All the others procedures that uses the Enemy var fails (the paralyze spell do not find a target, for exemple).
I am sure I'm doing something wrong. Can any one help?
Thank you in advance!