From ZDoom Wiki
Jump to navigation Jump to search
For more information on this article, visit the A_Explode page on the Doom Wiki.

int A_Explode [(int damage [, int distance [, int flags [, bool alert [, int fulldamagedistance [, int nails [, int naildamage [, class<Actor> pufftype [, name damagetype]]]]]]]])]


Performs an explosive (radius) attack.


Note: Do not use the old actor property method of passing the parameters. Only use the parameters of this function directly. This page's reference to those actor properties is for documentation purposes, and not as a recommendation to their usage.
  • damage: How much damage is inflicted at the center of the explosion. If this is set to a value that is less than 0, the ExplosionDamage property is used for the damage. Default is -1.
  • distance: The area covered by the damage (damage inflicted drop linearly with distance). Note that a radius larger than 32767 extends beyond ZDoom's map space limitations, and will overflow with undesired results (such as becoming too small and damaging nothing). If damage is less than 0, the ExplosionRadius property is used for the radius. A radius value of 0 or less uses the same value which damage uses. Default is -1.
  • flags: Allows the alteration of the function's behavior. This parameter is ignored in favor of using the DontHurtShooter property if damage is less than 0. The following flags can be combined by using the | character between the constant names:
    • XF_HURTSOURCE — Hurts the source: if set, the source can be damaged by the explosion. Note that the source is not necessarily the calling actor. This flag is set by default. By using other flags or, if none of the other flags is desired, passing 0 to flags i.e. using 0 in place of the flag, this flag can be cleared.
    • XF_NOTMISSILE — Not a missile: if set, the calling actor is considered to be the source. By default, the calling actor is assumed to be a projectile, and the source is therefore considered to be the calling actor's target.
    • XF_EXPLICITDAMAGETYPE — The damagetype parameter will never change to the actor's damage type.
    • XF_NOSPLASH — No splash: if set, the explosion does not create any terrain splashes.
    • XF_THRUSTZ — Apply vertical thrust: if set, the attack pushes the victim vertically, in addition to horizontally. Normally, vertical thrust is applied without the need of this flag, but it could be disabled by setting the compat_explode1 compatibility flag. This flag overrides the compatibility flag.
  • alert: Whether or not the explosion rings the alarm. This parameter is always set to false if damage is less than 0, regardless of what is passed to it. Default is false.
  • fulldamagedistance: The area within which full damage is inflicted. Default is 0.
  • nails: The number of horizontal hitscan attacks performed in a ring, originating from the actor's center. A value of 30 emulates the A_NailBomb codepointer from SMMU, while still allowing to modify all other parameters from A_Explode. Default is 0.
  • naildamage: The amount of damage inflicted by the nail attack, if any. Default is 10.
  • pufftype: The name of the puff to use for the nail attack. If nothing is supplied, BulletPuff is used. Default is "BulletPuff".
  • damagetype: The damage type to use for the damage of this function rather than the actor's own damage type. If left as is without XF_EXPLICITDAMAGETYPE, will use the actor's damage type instead. Default is 'None'.

Return value

Returns the number of actors damaged. Actors that absorb the damage completely are not counted.


actor MyGrenade : Grenade
    Speed 17
    BounceFactor 0.4
    BounceCount 6

        QEX1 A 0 A_PlaySound("Weapon/GenericExplode", CHAN_WEAPON)
        QEX1 A 5 A_Explode(100, 128)
        QEX1 BCDE 5

Whenever this rocket explodes, it logs the number of actors which got damaged by its splash effect.

actor SmartRocket : Rocket
        MISL B 8 Bright A_LogInt(A_Explode)
        Goto Super::Death+1

See also