A_DamageMaster

From ZDoom Wiki
Jump to: navigation, search

A_DamageMaster (int amount, [string type])


Damages this actor's master by the specified amount. Negative values heal the master, instead. Remember that the actor that uses this HAS to be spawned with A_SpawnItemEx with the master/child flag.


  • amount: Amount of damage to inflict. Use a negative value to heal.
  • type: The type of damage to inflict.

Examples

The following actor is a variant of the doom imp, which will spawn clones of itself to attack you. If you kill one of the clones that it spawns, it triggers A_DamageMaster, and heals the leader imp for 25 health.

ACTOR VoodooLeaderImp : DoomImp
{
  Game Doom
  SpawnID 5
  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
  Death:
    TROO I 8
    TROO J 8 A_Scream
    TROO K 6 A_KillChildren
    TROO L 6 A_NoBlocking
    TROO M -1
    Stop
  XDeath:
    TROO N 5
    TROO O 5 A_XScream
    TROO P 5 A_KillChildren
    TROO Q 5 A_NoBlocking
    TROO RST 5
    TROO U -1
    Stop
  }
}

Here is the soldier imp, the monster spawned by the voodoo leader imp. When one is killed, it heals the leader, so doing so is not advised.

ACTOR SoldierImp : DoomImp
{
  States
  {
  Pain.Voodoo:
    TROO H 2 A_Pain
    TROO H 50
    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
  }
}

Children/Master/Siblings relationship codepointers
A_DamageChildren A_DamageMaster A_DamageSiblings
A_KillChildren A_KillMaster A_KillSiblings
A_RaiseChildren A_RaiseMaster A_RaiseSiblings
A_RemoveChildren A_RemoveMaster A_RemoveSiblings
Note: These functions only work with monsters.
Personal tools
Namespaces

Variants
Actions
Navigation
ACS
DECORATE
ZDoom mods
Toolbox