From ZDoom Wiki
Jump to: navigation, search

A_FireBullets (angle spread_horz, angle spread_vert, int numbullets, int damage [, string pufftype [, int flags [, float range [, string missile [, float spawnheight [, float spawnofs_xy]]]]]])


Defines a custom hitscan attack for weapons. You have to specify the horizontal and vertical spread, the amount of bullets and the damage per bullet.

The first bullet fired in the Fire (not Hold) sequence normally ignores the spread and is always perfectly accurate. Setting numbullets to a negative value removes this effect.

When successfully called, the function plays the weapon's AttackSound sound, if present, on the weapon channel (CHAN_WEAPON) with normal attenuation.

Note: This function utilizes Player.AttackZOffset for positioning the origin of the bullet. Use this to adjust the height where bullets come from on the player for accuracy.


  • spread_horz - The random spread going right and left.
  • spread_vert - The random spread going up and down.
  • numbullets - The number of bullets this function spawns.
  • damage - The amount of damage to deal per bullet. Damage is multiplied by random(1,3). Damagetypes also have an influence on this.
  • pufftype - The actor to spawn at the puff's position when it hits. See BulletPuff for more details on spawning conditions.
  • flags - Can be combined with the | symbol.
    • FBF_EXPLICITANGLE: If set, the horizontal and vertical spread are used as explicitly stated, instead of being used as a range for random spread.
    • FBF_USEAMMO: If set, the attack uses ammo. (Set by default.)
    • FBF_NOFLASH: If set, the attack does not cause a weapon flash.
    • FBF_NOPITCH: If set, the vertical angle is not adjusted to aim at the target.
    • FBF_NORANDOM: If set, the damage is not multiplied by 1d3.
    • FBF_NORANDOMPUFFZ: If set, the random z offset given to the puff when spawned is disabled.
    • FBF_PUFFTARGET: Only works when missile is used. Sets the puff as the missile's target.
    • FBF_PUFFMASTER: Only works when missile is used. Sets the puff as the missile's master.
    • FBF_PUFFTRACER: Only works when missile is used. Sets the puff as the missile's tracer.

NOTE: The pointer flags will not work if the puff does not exist, i.e. spawning Blood instead of itself.

  • range - The maximum distance the bullets can hit something. Default is 8192.
  • missile: The actor projectile to spawn. This actor faces the bullet puff and travels directly towards it. Spawning a missile does not consume extra ammo. Default is none.
  • spawnheight: Offsets how high up from the base of the actor missile spawns. Default is 32.
  • spawnofs_xy: Offsets how far to the calling actor's right to spawn missile from (assuming one is viewing the actor from behind). Negative values spawn it to the left. Default is 0.


     TRIF A 5 Bright A_FireBullets(0, 0, 1, 45, "RiflePuff", FBF_USEAMMO|FBF_NORANDOM)
     TRIF B 5 Bright
     TRIG A 10
     TRIG B 0 A_ReFire
     Goto Ready