From ZDoom Wiki
Jump to: navigation, search

A_BFGSpray [(string flashtype [, int numrays [, int damagecnt]])]
A_BFGSpray [(string flashtype [, int numrays [, int damagecnt [, float angle [, float distance [, float vrange [, int explicit_damage]]]]]])] (development version 68c4819 only)


  • flashtype - Spawns a fan of hitscan attacks based on the actor specified.
  • numrays - Spawns this many of the specified actor across an angle of 90 degrees with the target in the center. Default is 40, i.e. one tracer every 2.25°.
  • damagecnt - The count of iterations to calculate the damage for original BFG formula; it will add N random values from 1 to 8 together based on this value. Default is 15.
  • angle - Determines the field of view. Any actors within this angle are subject to being sprayed and damaged. Default is 90 (which is the player's FOV). (development version 68c4819 only)
  • distance - Determines how far the function should search for monsters from the calling actor. Default is 1024. (development version 68c4819 only)
  • vrange - Determines maximum vertical angle to autoaim at, in degrees. Default is 32. (development version 68c4819 only)
  • explicit_damage - If greater than 0, the tracers deal this exact amount of damage and the damage parameter is ignored. Default is 0. (development version 68c4819 only)

Performs the secondary BFG attack. This consists of a fan of numrays hitscan attacks across an angle of 90 degrees with the target in the center. If no amount is given it will use 40 as a default, i.e. one tracer every 2.25°. The vertical range is 64° (32° in each direction of up/down), which is a bit less than the normal autoaim of 70° for primary attacks. The attack originates from the shooter of the missile and covers a distance of 1024. Any shootable actor beyond that is not harmed. The amount of damage is specified with the third parameter. Note that A_BFGSpray uses a unique method to determine damage. It adds a number of random values between 1 and 8. With this parameter you specify the amount of random numbers to be added. The default is 15. If explicit_damage is specified and is greater than 0, each tracer does that exact amount. The damage parameter is ignored in this case. Default is 0. (development version 68c4819 only)

At the position of each shootable actor that is hit an actor of type flashtype is spawned. If none is specified it will use the standard BFG flash.

Angle, distance and vertical range are no longer hard-coded into the function and can be set if one desires. They default to 90, 1024 and 32, respectively. (development version 68c4819 only)

Note that this function will create unpredictable effects if used on a non-missile.

Currently, BFG flash actors have been slightly expanded upon to allow custom damage types to be applied to them, much like other weapon puffs. Note that the EXTREMEDEATH flag still has no effect on this, however, so modders must use DamageType "Extreme" for it to work properly.

If PUFFGETSOWNER is used, however, it will use the calling actor's owner as the inflictor -- meaning if the owner has EXTREMEDEATH, then it will actually enact that flag. Specifically, if a BFG ball shot from a player calls A_BFGSpray and the sprays have the PUFFGETSOWNER flag, it relies upon the player's actor to determine causing extreme death or not.

In addition, a flash with the MTHRUSPECIES flag set prevents this function from having any effect on actors with the same species as the flash's own. (development version 9a09fbd only) (As of (development version 85449a6 only), the actors' species needs to match the shooter's, not the flash's)


Because of the unique behavior of the BFG, this function has very limited use in custom projects. The only built-in class that makes use of it is the BFGBall, which is fired by the BFG, and triggers the function upon exploding.

    BFE1 AB 8 Bright
    BFE1 C 8 Bright A_BFGSpray
    BFE1 DEF 8 Bright