A_FireBullets

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]]])


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.

  • flags:
    • 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. (New from 2.7.1)

The damage formula is damage * 1d3 (unless the FBF_NORANDOM flag is set). For example, if damage is 4, the possible results are 4, 8 or 12. The average damage actually dealt by each bullet will therefore be damage * 2.

Optionally you can specify a puff type that is spawned when hitting a wall or a non-bleeding actor. The puff also determines the damage type of the attack.

range specifies the maximum distance of the attack.

Examples

Fire:
     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