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]]]]]])] (New from 2.8.1)


Performs the secondary, "tracer" attack of the BFG9000. Note that this function will create unpredictable effects if used on a non-missile.

The tracer actors (flashtype) which are spawned by the function could have custom damage types 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.

(New from 2.8.1): A tracer with the MTHRUSPECIES flag set prevents this function from having any effect on actors with the same species as the shooter's own.


  • flashtype: The actor to spawn at the position of each shootable actor that is hit. Default is "BFGExtra".
  • 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). (New from 2.8.1)
  • distance: Determines how far the function should search for monsters from the calling actor. Default is 1024. (New from 2.8.1)
  • vrange: Determines maximum vertical angle to autoaim at, in degrees. Default is 32. (New from 2.8.1)
  • explicit_damage: If greater than 0, the tracers deal this exact amount of damage and damagecnt is ignored. Default is 0. (New from 2.8.1)


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