Auto assist for specified characters

The script automatically targets the same objects that the specified characters done. If the first character has no target, the script will assist by the next one.

uses SysUtils, Classes;

procedure AssistThread();
const
  ASSIST_DELAY = 500;
  ASSISTER_NAMES = 'Nickname1; Nickname2; ';
var
  Assister: TPlayer;
  Target: TLive;
begin    
  Print('AssistThread started ...');
  while Delay(500) do begin
    if (Status = lsOnline) then begin
      Assister:= GetAssister(ASSISTER_NAMES);
      if Assigned(Assister) then Target:= Assister.Target;
      if Assigned(Target) and (User.Target <> Target) then begin
        Print(Format('New target: %s | %n', [Target.Name, User.DistTo(Target)]));
        Engine.SetTarget(Target);
      end;
    end;
  end; 
end;

function GetAssister(Names: String): TPlayer;
var
  i, j: Integer;
  SL: TStringList;
  Player: TPlayer;
begin
  Result:= nil; 
  SL:= TStringList.Create();
  try
    SL.Text:= StringReplace(Names, ';', #13#10, [rfReplaceAll]);
    for i:= 0 to SL.Count-1 do begin
      for j:= 0 to Players.Count-1 do begin
        Player:= Players(i);
        if (Player.Valid) and (Player.Target <> nil)
        and (Player.Target <> Player) and (Player.Target <> User) then begin
          Result:= Player;
          Break;
        end;
      end;
    end;
  finally
    SL.Free();
  end;
end;

begin
  Script.NewThread(@AssistThread);
  //...
  Delay(-1);
end.
ArcheAngel Bot classes structure
  • Классы
    • TGameControl
    • TPaxEngine
    • TGameObject
      • TItem
        • TAucItem
      • TZoneItem
      • TSpawn
        • TLive
          • TNpc
            • TMount
          • TDoodad
          • TPlayer
            • TUser
      • TMailItem
      • TEffect
        • TBuff
        • TSkill
          • TCast
    • TGameList
      • TSpawnList
        • TPlayers
        • TMobs
        • TMounts
        • TDoodads
        • TNpcs
      • TInventory
      • TSkills
      • TSlotList
      • TZoneList
      • TBuffs
      • TMail
      • TAuction
    • TChatMessage
    • TAccount
    • TAccounts
    • THistoryMessage
    • TMessages