From ZDoom Wiki
Jump to: navigation, search

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


Damages the calling actor by the specified amount. Negative values heal the actor, instead.


  • 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. This flag is implied internally if the damage is a million or more.
    • 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 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 calling actor is only damaged if its species does not match the value passed to species.
    • DMSS_EITHER — the calling actor is damaged if either of 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 calling actor is only damaged if its class name matches the specified filter class. Default is "None".
  • species: the actor species to damage. The calling actor is only damaged 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 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.

Note: DMSS_FOILINVUL does not work on players or actors with NODAMAGE.


This example defines a new item, that when used will increase movement and attack speed at a cost of 25 health, similiar to stimpacks in Starcraft.

Actor StarcraftStimpack : CustomInventory
 Tag "Stimpack"
 Inventory.Amount 1
 Inventory.MaxAmount 25
 Inventory.PickupMessage "You found some stimpacks"
 Inventory.PickupSound "misc/i_pkup"
   SSTM A -1
   TNT1 A 0 A_JumpIfHealthLower(26, "NoUse") // Make Sure it won't kill the player
   TNT1 A 0 A_DamageSelf(25,"SelfDamage")
   TNT1 A 0 A_GiveInventory("PowerStimpackMove", 1)
   TNT1 A 0 A_GiveInventory("PowerStimpackAttack", 1)
   TNT1 A 0 

Actor PowerStimpackMove : PowerSpeed
 Powerup.Duration -15
Actor PowerStimpackAttack : PowerDoubleFiringSpeed
 Powerup.Duration -15

DamageType SelfDamage // New damage type to ignore armor
 Factor 1.0