Event handler while moving OnMoveEvent

This procedure is enough to insert in your code, it will automatically be called when disconnecting, death, and if the mob attacked (all this while moving)

procedure OnMoveEvent(Attacker: TL2Live; var BreakMove: Boolean);
begin
  while (Engine.Status <> lsOnline) do Delay(500);  // waiting until we come back    
  if (User.Dead) then begin    // if the char is dead
    Print('Died!');
    // cause actions to be done when dying
  end;    
  if (Attacker <> nil) then begin    // if we are attacked
    Print('We are attacked while running');
    // fighting off
  end;
end;

begin
  Delay(-1);
end.