A_Respawn

From ZDoom Wiki
Jump to navigation Jump to search

A_Respawn [(int flags)]

Respawns the calling actor at their initial starting point, and resets its stats in the process. This behaves similarly to if the actor was respawned on the Nightmare skill. If there is a solid object at the spawn point, the respawn will fail, unless the RSF_TELEFRAG flag is set (see below).

Parameters

  • flags: The following flags can be combined by using the pipe character | between the constant names to alter the behavior of the function:
    • RSF_FOG — The respawn fog is shown when the actor reappears. This is the default behavior if the flags parameter is omitted.
    • RSF_KEEPTARGET — The calling actor's target is preserved after respawning.
    • RSF_TELEFRAG — If a solid telefragable object is in the spawn spot, it will be telefragged and the respawn will be successful.

Examples

This imp will stay dead for 3 seconds before respawning. If it is killed normally it will respawn without fog, but if it is gibbed, it will respawn with one.

ACTOR ImmortalImp : DoomImp replaces DoomImp
{
  States
  {
  Death:
    TROO I 8
    TROO J 8 A_Scream
    TROO K 6
    TROO L 6 A_NoBlocking
    TROO M 105
    TROO M 0 A_Respawn(FALSE)
    Stop
  XDeath:
    TROO N 5
    TROO O 5 A_XScream
    TROO P 5
    TROO Q 5 A_NoBlocking
    TROO RST 5
    TROO U 105
    TROO U 0 A_Respawn
    Stop
  }
 }