Travar o Follow na ultima pessoa


var
LockID:integer;

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;

begin
updateworld;
while self.following=0 do
begin
sleep(200);
updateworld;
end;
LockID:=self.following;
while not terminated do
begin
updateworld;
ProcessEvents;
if ((self.following)<>(LockID)) and ((self.following)<>(0)) then
LockID:=Self.Following;
Creature:=GetCreatureByID(LockID);
if (Creature<>nil) and (Self.Following=0) then
if Creature.z=self.z then
Creature.following:=true;
sleep(100);
end;
end;