Facebook
From Schichtleiter, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 203
  1. var
  2. LockID:integer;
  3.  
  4. function GetCreatureByID(ID: integer): TCreature;
  5. var
  6. x: integer;
  7. begin
  8. Result := nil;
  9. for x := 0 to Creatures.Count - 1 do
  10. begin
  11. if x >= Creatures.Count then Break;
  12. if Creatures.Creature[x].ID = ID then
  13. begin
  14. Result := Creatures.Creature[x];
  15. Exit;
  16. end;
  17. end;
  18. end;
  19.  
  20. begin
  21. updateworld;
  22. while self.attacking=0 do
  23. begin
  24. sleep(200);
  25. updateworld;
  26. end;
  27. LockID:=self.attacking;
  28. while not terminated do
  29. begin
  30. updateworld;
  31. ProcessEvents;
  32. if ((self.attacking)<>(LockID)) and ((self.attacking)<>(0)) then
  33. LockID:=Self.Attacking;
  34. If Self.Attacking=0 then
  35. begin
  36. Creature:=GetCreatureByID(LockID);
  37. If Creature<>nil then Creature.Attacking:=true;
  38. end;
  39.  
  40. sleep(100);
  41. end;
  42. end;