A_DamageMaster

From ZDoom Wiki
Jump to navigation Jump to search

void A_DamageMaster (int amount [, name damagetype [, int flags [, class<Actor> filter [, name species [, int src [, int inflict]]]]]])

Usage

Damages the calling actor's master actor by the specified amount. Negative amounts heal it, instead. This function cannot damage player actors which are under the effect of god2, and they still survive with one point of health if under the effect of buddha2.

Parameters

  • amount: the amount of damage to inflict. Negative amounts heal. An amount of one million or higher is treated specially, and results in killing the actor regardless of health or any damage modifiers that may be in effect.
  • 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. For this flag to work, an inflictor is required (see inflict below). This flag is ignored if the actor is a player.
    • DMSS_FOILBUDDHA — if the damage is enough to kill the actor, it dies even if it is under the effect of buddha. For this flag to work, an inflictor is required (see inflict below). This flag is ignored if the actor is a player.
    • DMSS_NOPROTECT — damage bypasses the damage-modifying capability of items in the actor's inventory. A protection powerup is an example of such items.
    • DMSS_NOFACTOR — damage bypasses the the actor's damage factors.
    • DMSS_AFFECTARMOR — damage does not bypass the damage-absorbing capability of items in the actor's inventory. An armor is an example of such items.
    • DMSS_KILL — inflicts an amount of damage which is equal to the sum of the actor's current health and amount, killing the actor under normal conditions. This flag bypasses the actor's damage factors and the damage-absorbing capability (but not the damage-modifying one) of items in the actor's inventory.
    • DMSS_EXFILTER — inverts the case of the class name filter; the actor is only damaged if its class name does not match the value passed to filter.
    • DMSS_EXSPECIES — inverts the case of the species filter; the actor is only damaged if its species does not match the value passed to species.
    • DMSS_EITHER — the actor is damaged if either its 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 actor is only damaged if its class name matches the specified class. Default is null(ZScript only)/"None"(DECORATE only).
  • species: the actor species to damage. The actor is only damaged if its species matches the specified species. Default is "None".
  • src: the actor responsible for the damage (source). This is an actor pointer. If this is set to AAPTR_NULL, the actor is damaged without a source. Default is AAPTR_DEFAULT, which is the calling actor itself.
  • inflict: the actor doing the damage (inflictor). This is an actor pointer. If this is set to AAPTR_NULL, the actor is damaged without an inflictor (note that doing so renders both DMSS_FOILINVUL and DMSS_FOILBUDDHA ineffective). Default is AAPTR_DEFAULT, which is the calling actor itself.

Examples

This "leader" imp spawns clones of itself as a form of attack. Upon a clone's death, it gets damaged.

actor LeaderImp : 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
    }
}

actor SoldierImp : DoomImp
{
    States
    {
    Death:
        TROO I 8 A_DamageMaster(25)
        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.