A_FireBullets (double spread_xy, double spread_z, int numbullets, int damageperbullet [, class<Actor> pufftype = "BulletPuff" [, int flags = FBF_USEAMMO [, double range = 0 [, class<Actor> missile = null [, double spawnheight = 32 [, double spawnofs_xy = 0]]]]]])
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.
If numbullets is 1 and this is the first bullet fired in the Fire (not Hold) sequence, the bullet is fired with perfect accuracy, ignoring the specified spread. If numbullets is 0, however, the bullet is always fired with perfect accuracy. Setting numbullets to a negative value removes this effect while firing a single bullet only.
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_xy - The random spread going right and left.
- spread_z - The random spread going up and down.
- numbullets - The number of bullets this function spawns.
- damageperbullet - The amount of damage to deal per bullet. Damage is multiplied by random(1, 3). Damage types can be applied through the puff actor used by the attack.
- pufftype - The actor to spawn at the puff's position when it hits. BulletPuff is used by default. See Puff for details on the behavior and spawning conditions of puffs.
- flags - Can be combined with the | symbol.
- FBF_USEAMMO: If set, the attack uses ammo. This flag is set by default if the flags parameter. Passing 0 as the flags argument (or passing other flags without adding this one) will disable it.
- 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_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, for example if the attack hits a bleeding actor, and Blood is spawned instead. Puffs can be forced to always spawn with ALWAYSPUFF and PUFFONACTORS flags (which requires a custom puff actor).
- range - The maximum distance the bullets can hit something. The default value of 0 is interpreted as the PLAYERMISSILERANGE constant, which is equal to 8192.
- missile: The actor projectile to spawn. This actor faces the point of hitscan impact and travels directly towards it. Spawning a missile does not consume extra ammo. Default is null (no projectile is spawned).
- 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.
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