A_KillMaster

From ZDoom Wiki
Jump to: navigation, search

A_KillMaster [(string damagetype [, int flags [, string filter [, string species [, int src [, int inflict]]]]])]

Usage

Called by monsters to kill the monster that spawned this one. Currently the only function that sets the necessary information is A_SpawnItemEx. Optionally, a damagetype parameter can be given. Note that damage inflicted by this codepointer is not affected by damage factors.

Monsters spawned with A_CustomMissile are not affected by this. A_CustomMissile was never designed to spawn monsters.

Parameters

  • damagetype - If the actor dies, the actor will enter a death state based on damagetype if present (or pain state if using NODAMAGE).
  • flags - The following flags can be combined using the | character between name constants:
    • KILS_FOILINVUL - Kills monsters and/or missiles that have the INVULNERABLE flag.
    • KILS_KILLMISSILES - Causes missiles that are affected to enter their death state. Note that this follows the INVULNERABLE and NODAMAGE rules for monsters.
    • KILS_NOMONSTERS - Don't target monsters with this function. Alone, it makes the function do nothing, but can be combined with KILS_KILLMISSILES to only affect missiles.
    • KILS_FOILBUDDHA — the buddha effect is ignored when attempting to kill the actor.
    • KILS_EXFILTER — inverts the case of the class name filter; the calling actor's master is only killed if its class name does not match the value passed to filter.
    • KILS_EXSPECIES — inverts the case of the species filter; the calling actor's master is only killed if its species does not match the value passed to species.
    • KILS_EITHER — the calling actor's master is killed if either of its class name or species matches the values passed to filter and species, respectively.
  • filter: the actor class to kill. The calling actor's master is only killed if its class name matches the specified filter class. Default is "None".
  • species: the actor species to kill. The calling actor's master is only killed if its species matches the specified species filter. Default is "None".
  • src: Indicates the actor pointer responsible for dealing the damage. A monster dealing the damage should use AAPTR_DEFAULT, and missiles should use AAPTR_TARGET (so monsters can identify missiles belonging to their owners and give proper credit for the kill). Default is AAPTR_DEFAULT.
  • inflict: The actor doing the actual damage. By changing this, the actor's flags upon the pointed actor are taken into account instead of the calling actor's own.

Examples

The following is a variant of the doom imp, a monster spawned by a different monster with the master/child flag. If it gets killed with an attack with the "Curse" damage type, its death state will trigger A_KillMaster, killing the monster who spawned it.

ACTOR SoldierImp : DoomImp
{
  States
  {
  Pain.Voodoo:
    TROO H 2 A_Pain
    TROO H 50
    Goto See
  Pain.Curse:
    TROO H 2 A_Pain
    TROO H 2 A_DamageSiblings(15)
    Goto See
  Death:
    TROO I 8 A_DamageMaster(-25)
    TROO J 8 A_Scream
    TROO K 6
    TROO L 6 A_NoBlocking
    TROO M -1
    Stop
  Death.Curse:
    TROO I 8 A_KillMaster
    TROO J 8 A_Scream
    TROO K 6
    TROO L 6 A_NoBlocking
    TROO M -1
    Stop
  }
}

Children/Master/Siblings relationship codepointers
A_DamageChildren A_DamageMaster A_DamageSiblings A_DamageTarget A_DamageTracer
A_KillChildren A_KillMaster A_KillSiblings A_KillTarget A_KillTracer
A_RaiseChildren A_RaiseMaster A_RaiseSiblings
A_RemoveChildren A_RemoveMaster A_RemoveSiblings A_RemoveTarget A_RemoveTracer
Note: Raise and damage functions only work with monsters. Kill functions can be used on monsters and missiles.