From ZDoom Wiki
Jump to navigation Jump to search

A_Die [(str DamageType)]

Kills the calling actor if it is not already dead, setting its health value to 0 and sending it to its Death state. This has only an effect if the actor has the SHOOTABLE or VULNERABLE flag set.

If DamageType is provided, it determines what type of damage is inflicted upon the actor to kill it. This could be used to determine which Death state the monster uses as it dies.


This imp's days are numbered... It will walk around and fire at you normally. But all the while walking on borrowed time, slowly gaining the inventory "DeathTimer" with every action it takes. When the timer reaches 20, the imp will simulate having a violent heart-attack, then trigger A_Die, forcing it to enter its death state, regardless what its health previously was. For added effect, A_Jump is used in its see state giving it a small chance to cringe with chest-pain once in a while.

ACTOR DyingImp : DoomImp
    TROO A 0 A_GiveInventory("DeathTimer", 1) // A dummy inventory for tracking how long the imp has been searching.
    TROO A 0 A_JumpIfInventory("DeathTimer", 20, "HeartAttack") // Jump to the HeartAttack state when the timer reaches 20 
    TROO A 0 A_Jump(45, "Pain")
    TROO EF 8 A_FaceTarget
    TROO G 6 A_TroopAttack
    TROO A 0 A_GiveInventory("DeathTimer", 1) // Attacking the player only speeds up the process
    TROO A 0 A_JumpIfInventory("DeathTimer", 20, "HeartAttack")
    Goto See
    TROO H 2
    TROO H 2 A_Pain
    Goto See
    TROO H 2
    TROO HHHH 20 A_Pain
    TROO H 2 A_Die

This is the inventory item that the monster uses.

ACTOR DeathTimer : Inventory
  Inventory.MaxAmount 20
  Inventory.Amount 1