A_Explode

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


Actor

int A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class<Actor> pufftype = "BulletPuff", name damagetype = "none")

Usage

Performs an explosive (radius) attack.

Parameters

  • int 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.
Note: The default value of the ExplosionDamage property is 128.
  • int 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 distance is less than 0, the ExplosionRadius property is used for the radius. In this case, if the ExplosionRadius property is set to a value less than 0, it'll use the same value as the ExplosionDamage property.
Note: The default value of the ExplosionRadius property is -1, which means it uses the same value as ExplosionDamage.
  • int 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_HURTSOURCEThis flag is set by default. Hurts the source: if set, the source can be damaged by the explosion. Note that the source is not necessarily the calling actor. To unset the flag, either use 0 for the flags argument, or pass other flags to it without passing this one.
  • 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 — If set, the damagetype parameter will never change to the actor's damage type.
  • XF_NOSPLASH — Disables splash: if set, the explosion does not create any TERRAIN splashes.
  • XF_THRUSTZ — Applies 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.
  • XF_THRUSTLESS — The explosion produces no thrust whatsoever, only dealing pure damage. This can be used to supplement the native thrusting with a custom implementation. (New from 4.11.0)
  • XF_NOALLIES — The explosion does not affect any actors friendly to the source of the explosion. Only works with FRIENDLY monsters and players. Keep in mind that XF_HURTSOURCE still needs to be off to not affect the source. (New from 4.11.0)
  • XF_CIRCULAR — Changes the shape of the explosion from the vanilla cuboid shape into a spherical shape. (New from 4.11.0)
  • bool 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.
  • int fulldamagedistance
The area within which full damage is inflicted. Default is 0.
  • int 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 function from SMMU, while still allowing to modify all other parameters from A_Explode. Default is 0.
  • int naildamage
The amount of damage inflicted by the nail attack, if any. Default is 10. If nails is 0, this, obviously, has no effect.
  • class<Actor> pufftype
The name of the puff class to use for the nail attack. If nothing is supplied, BulletPuff is used. Default is "BulletPuff".
  • name 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.

Examples

class MyGrenade : Grenade
{
    Default
    {
        Speed 17;
        BounceFactor 0.4;
        BounceCount 6;
    }

    States
    {
    Death:
        QEX1 A 0 A_StartSound("Weapon/GenericExplode", CHAN_WEAPON);
        QEX1 A 5 A_Explode(100, 128);
        QEX1 BCDE 5;
        Stop;
    }
}


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

class SmartRocket : Rocket
{
    States
    {
    Death:
        MISL B 8 Bright A_LogInt(A_Explode);
        Goto Super::Death+1;
    }
}

See also