A_RemoveMaster

From ZDoom Wiki
Jump to: navigation, search

A_RemoveMaster [(int flags [, string filter [, string species]])]

Usage

Called by monsters to completely remove the monster that spawned this one. Currently the only function that sets the necessary information is A_SpawnItemEx.

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

This function can target actors that are non-monsters, but only by using flags.

Parameters

  • flags: the following flags can be combined using the | character between name constants:
    • RMVF_MISSILES - Allows removal of missiles associated with the pointer.
    • RMVF_NOMONSTERS - The function will not remove monsters and simply skip them. By default, before the introduction of assigning masters to missiles, similar functions would only work on monsters. To ensure consistency, only monsters are allowed for removal by default.
    • RMVF_MISC - Allows removal of things that are neither missile nor monster.
    • RMVF_EVERYTHING - Overrides all other flags. Disables discrimination and removes the actor of any type regardless of what it is.
    • RMVF_EXFILTER — inverts the case of the class name filter; the calling actor's master is only removed if its class name does not match the value passed to filter.
    • RMVF_EXSPECIES — inverts the case of the species filter; the calling actor's master is only removed if its species does not match the value passed to species.
    • RMVF_EITHER — the calling actor's master is removed if either of its class name or species matches the values passed to filter and species, respectively.
  • filter: the actor class to remove. The calling actor's master is only removed if its class name matches the specified filter class. Default is "None".
  • species: the actor species to remove. The calling actor's master is only removed if its species matches the specified species filter. Default is "None".

Examples

The following is a variant on the doom imp, a monster spawned by a different monster using the master/child flag. If it dies from the damage type "Banish", its death state triggers A_RemoveMaster, completely removing 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 A_KillSiblings
    TROO L 6 A_NoBlocking
    TROO M -1
    Stop
  Death.Banish:
    TROO I 8 A_RemoveMaster
    TROO J 8 A_Scream
    TROO K 6 A_RemoveSiblings
    TROO L 6 A_NoBlocking
    TROO M 6
    TNT1 A -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.