faq/stealth/sparring.txt · Last modified: 2020/12/14 08:05 (external edit)
 

Sparring

Includes Parrying, Tactics, Fencing, Swordsmanship, Macefighting, Wrestling, Healing, Anatomy.


Option 1

Via .options set % of healing with bandages.

Program Sparring;
{$Include 'all.inc'}

var
i : Integer;
n : TDateTime;
Weapon : array[1..3] of cardinal;

const
shield = $1B74; //Kite Shield
bandages = $0E21;
mybow = $13B2;
arrows = $0F3F; 

//Настройки
Archery = 0; //1 - to train Archery, 0 - no
UseAnatomy = 1; //1 - to train Anatomy, 0 - no
EnemyID = $00000000; //ID who to hit

//XY sparring location (.where)
ax = 1000;
ay = 1000;
//XY safe place
bx = 1001;
by = 1002;
minHP = 30; //less - step back
maxHP = 50; //more - get back to sparring

procedure weaptype;
begin
  Weapon[1] := $13F6; //Butcher knife
  Weapon[2] := $0F51; //Dager
  Weapon[3] := $13E3; //smitty humer
end;

procedure checkshields;
begin
  if (not dead) and (connected) then
  begin
    if (getquantity(findtype(shield,backpack)) > 0) and (gettype(ObjAtLayer(LhandLayer)) <> gettype(finditem)) then
    begin
      UnEquip(LHandLayer);
      wait(500);
      Equip(LhandLayer,finditem);
      wait(500);
    end;
    if (getquantity(findtype(shield,backpack)) < 0) and (gettype(ObjAtLayer(LhandLayer)) <> gettype(finditem)) then
    begin
      FindDistance := 2;
      FindType(shield, ground);
      if FindCount > 0 then
      begin
        MoveItem(FindItem,1,backpack,0,0,0);
      end;
    end;
  end;
end;

procedure checkhp;
begin
  if (HP < minHP) then newMoveXY(bx,by,true,0,true);
  if (HP > maxHP) then newMoveXY(ax,ay,true,0,true);
end;

procedure checkbandages;
begin
  FindType(bandages, backpack);
  if GetQuantity(FindItem) < 10 then
  begin
    FindDistance := 2;
    FindType(bandages, ground);
    MoveItem(FindItem, GetQuantity(FindItem),backpack,0,0,0);
  end;
end;

procedure Anatomy;
var
d, t: TDateTime;

begin
  d := StrToTime('0:00:11');
  if ((now - n) > d) or (n = 0) then
  begin
    t := now;
    WaitTargetSelf;
    UseSkill('Anatomy');
    if TargetPresent then CancelTarget;
    n := now;
  end;
end;

procedure CheckArrows;
begin
  FindDistance := 2;
  FindType(arrows, ground);
  if FindCount > 0 then
  begin
    MoveItem(FindItem,1000,backpack,0,0,0);
  end;
end;

Begin
  weaptype;
  while not dead do
  begin
    WaitConnection(2000);
    CheckSave;
    Hungry(1, BackPack);
    Attack(EnemyID);
    for i := 1 to 3 do
    begin
      checkhp; //step vack if HP is low
      checkshields; //search for shields in the bag and put them on, if there is none - search on the ground.
      checkbandages; //search for bandages on the ground
      if Archery = 1 then checkarrows; //search for arrows on the ground
      if UseAnatomy = 1 then Anatomy; //train Anatomy
      if (ObjAtLayer(RHandLayer) = 0) then
      begin
        if Archery = 0 then equipt(RHandLayer, Weapon[i]);
        if Archery = 1 then equipt(RHandLayer, mybow);
        wait(1000);
        i := i + 1;
        if (i > 3) then i := 1
      end;
    end;
  end;
end.
Option 2

Without archery, with one weapon, but with armor switch + healing in the script.

// Put fish, bandages, armor, shields and weapon. Works without autoheal.

Program Anatomy;

const
Enemy   = $000000;    // who to attack
tweapon = $0F5C;      // which weapon takes in the hand
tshield = $1B76;      // which shield to put on
bandage = $0E21;      // bandages

// Bellow full plate mail is used, but you can always switch to chain mail if STR less than 90
chest    = $1415;
legs     = $1411;
sholders = $1410;
gloves   = $1414;
gorget   = $1413;
helm     = $1412;

ax = 0000;              // coordinate 1 where the character is going to fight
ay = 0000;              // coordinate 2 where the character is going to fight
bx = 0000;              // coordinate 1 where the character is going to step back to heal when HP is low
by = 0000;              // coordinate 2 where the character is going to step back to heal when HP is low

{$Include 'all.inc'}


procedure checkall;
begin
  if (not dead) and (connected) then
  begin
    //hands
    if (getquantity(findtype(tweapon,backpack)) > 0) and (gettype(ObjAtLayer(RhandLayer)) <> gettype(finditem)) then
    begin
      addtosystemjournal('Weapon Change, осталось '+inttostr(findcount-1));
      UnEquip(RHandLayer);
      wait(500);
      Equip(RhandLayer,finditem);
      Wait(500);
    end;
    if (getquantity(findtype(tshield,backpack)) > 0) and (gettype(ObjAtLayer(LhandLayer)) <> gettype(finditem)) then
    begin
      addtosystemjournal('Shield Change, осталось '+inttostr(findcount-1));
      UnEquip(LHandLayer);
      wait(500);
      Equip(LhandLayer,finditem);
      wait(500);
    end;
    //armor
    if (getquantity(findtype(chest,backpack)) > 0) and (gettype(ObjAtLayer(TorsoLayer)) <> gettype(finditem)) then
    begin
      addtosystemjournal('Chest change, осталось '+inttostr(findcount-1));
      UnEquip(TorsoLayer);
      wait(500);
      Equip(TorsoLayer,finditem);
      wait(500);
    end;

    if (getquantity(findtype(legs,backpack)) > 0) and (gettype(ObjAtLayer(LegsLayer)) <> gettype(finditem)) then
    begin
      addtosystemjournal('Legs Change, left '+inttostr(findcount-1));
      UnEquip(LegsLayer);
      wait(500);
      Equip(LegsLayer,finditem);
      wait(500);
    end;

    if (getquantity(findtype(sholders,backpack)) > 0) and (gettype(ObjAtLayer(ArmsLayer)) <> gettype(finditem)) then
    begin
      addtosystemjournal('Sholders Change, left '+inttostr(findcount-1));
      UnEquip(ArmsLayer);
      wait(500);
      Equip(ArmsLayer,finditem);
      wait(500);
    end;
    if (getquantity(findtype(gloves,backpack)) > 0) and (gettype(ObjAtLayer(GlovesLayer)) <> gettype(finditem)) then
    begin
      addtosystemjournal('Gloves Change, left '+inttostr(findcount-1));
      UnEquip(GlovesLayer);
      wait(500);
      Equip(GlovesLayer,finditem);
      wait(500);
    end;

    if (getquantity(findtype(gorget,backpack)) > 0) and (gettype(ObjAtLayer(NeckLayer)) <> gettype(finditem)) then
    begin
      addtosystemjournal('Gorget Change, left '+inttostr(findcount-1));
      UnEquip(NeckLayer);
      wait(500);
      Equip(NeckLayer,finditem);
      wait(500);
    end;
    if (getquantity(findtype(helm,backpack)) > 0) and (gettype(ObjAtLayer(HatLayer)) <> gettype(finditem)) then
    begin
      addtosystemjournal('Helm Change, left '+inttostr(findcount-1));
      UnEquip(HatLayer);
      wait(500);
      Equip(HatLayer,finditem);
      wait(500);
    end;
  end;
end;

procedure checkbandages;
begin
  if (count($0E21) < 45) and (not dead) then
  begin
    MoveItem(FindType($0E21,backpack),50,backpack,0,0,0);
    wait(500);
  end;
end;


procedure checkhp;
begin
  while (HP < 100) do  // if HP is lower than 100, attempt to start self-healing.
  begin
    if (HP < 80) then newMoveXY(bx,by,true,0,true);  // if lower than 80, step back.
    UseType(bandage, $FFFF);
    WaitTargetSelf;
    wait(1000);
  end;
  newMoveXY(ax,ay,true,0,true);
end;


Begin
  SetARStatus(true);
  moveThroughNPC := 1;
  while true do
  begin
    SetWarMode(True);
    while not Dead do
    begin
      Hungry(1,backpack);
      checkhp;
      checkall;
      Attack(Enemy);
      checkhp;
      If TargetPresent Then CancelTarget;
      UseSkill('Anatomy');
      WaitTargetSelf;
      Wait(1000);
      checkbandages;
      If TargetPresent Then CancelTarget;
    end;
  end;
End.
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki