A_DamageChildren

From ZDoom Wiki
Jump to: navigation, search

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


Usage

Damages this actor's children by the specified amount. Negative values heal the children, instead. Remember that the actor to be damaged HAS to be spawned with A_SpawnItemEx with the master/child flag, provided they are not invulnerable.

Parameters

  • amount: amount of damage to inflict. Use a negative value to heal.
  • damagetype: the type of damage to inflict. Default is "None".
  • flags: the following flags can be combined using the | character between the constants names:
    • DMSS_FOILINVUL — the actor is damaged even if it is invulnerable.
    • DMSS_AFFECTARMOR — the actor's armor is not ignored when being damaged.
    • DMSS_KILL — kills the actor. For this to have an effect on invulnerable actors, DMSS_FOILINVUL has to be passed, as well.
    • DMSS_NOFACTOR — the affected actor's damage modifiers, if any, are ignored.
    • DMSS_FOILBUDDHA — the buddha effect is ignored when dealing the damage.
    • DMSS_NOPROTECT — the affected actor's protection powerups, if any, are ignored.
    • DMSS_EXFILTER — inverts the case of the class name filter; the calling actor's children are only damaged if their class name does not match the value passed to filter.
    • DMSS_EXSPECIES — inverts the case of the species filter; the calling actor's children are only damaged if their species does not match the value passed to species.
    • DMSS_EITHER — the calling actor's children are damaged if either of their class name or species matches the values passed to filter and species, respectively.
    • DMSS_INFLICTORDMGTYPE — ignores the specified damage type, and instead, uses the damage type of the actor doing the damage (inflictor).
  • filter: the actor class to damage. The calling actor's children are only damaged if their class name matches the specified filter class. Default is "None".
  • species: the actor species to damage. The calling actor's children are only damaged if their 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 infight with them). 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 actor is a variant of the doom imp, which will spawn clones of itself to attack you. If you attack the master, its painstate will trigger A_DamageChildren, with the "voodoo" damage type. This makes all the spawned clones of the monster become temporarily stunned with pain.

ACTOR VoodooLeaderImp : DoomImp
{
  Health 100
  Mass 1000
  PainChance 255
  States
  {
  Missile:
    TROO EF 8 A_FaceTarget
    TROO G 6 A_SpawnItemEx("SoldierImp", 50, 50, 60, 0, 0, 0, 0, SXF_SETMASTER)
    Goto See
  Pain:
    TROO H 2
    TROO H 1 A_Pain
    TROO H 1 A_DamageChildren(1, "Voodoo")
    Goto See
  }
}

Here is the soldier imp, the monster spawned by the voodoo leader imp.

ACTOR SoldierImp : DoomImp
{
  States
  {
  Pain.Voodoo:
    TROO H 2 A_Pain
    TROO H 50
    Goto See
  }
}

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.