From ZDoom Wiki
Jump to navigation Jump to search

void A_CustomBulletAttack (float horz_spread, float vert_spread, int numbullets, int damageperbullet [, string pufftype [, float range [, int flags [, int ptr [, string missile [, float Spawnheight [, float Spawnofs_xy]]]]]]])


A customizable hitscan attack for monsters. Fires a number of bullets with the specified damage and spread. The bullet puff and range can also be specified, as well as whether the actor uses its current target for aiming purposes.


  • horz_spread: The horizontal spread, in degrees.
  • vert_spread: The vertical spread, in degrees.
  • numbullets: The number of bullets to fire.
  • damageperbullet: The amount of damage each bullet does. Unless the NORANDOM flag is set, this is multiplied by a random value between 1 and 3.
  • pufftype: The puff to spawn when a wall is hit. Default is "BulletPuff".
  • range: The maximum range of the bullets. Default is 0, which is interpreted as 2048.
  • flags:
    • CBAF_AIMFACING: If set, the attack will be fired in the direction the actor is currently facing, rather than at the actor's current target.
    • CBAF_NORANDOM: If set, the damage per bullet is not randomized.
    • CBAF_EXPLICITANGLE: If set, the horizontal and vertical spread are used as explicitly stated, instead of being used as a range for random spread.
    • CBAF_NOPITCH: If set, the vertical angle is not adjusted to aim at the target.
    • CBAF_NORANDOMPUFFZ: If set, the random z offset given to the puff when spawned is disabled.
    • CBAF_PUFFTARGET: Only works when missile is used. Sets the puff as the missile's target.
    • CBAF_PUFFMASTER: Only works when missile is used. Sets the puff as the missile's master.
    • CBAF_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.

  • ptr: The actor to attack. This takes an actor pointer. Default is AAPTR_TARGET.
  • missile: The actor projectile to spawn. This actor faces the bullet puff and travels directly towards it. 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.


ACTOR Sniper : ShotgunGuy
    SPOS E 2 A_FaceTarget
    SPOS E 0 A_PlaySound("weapons/sshotf")
    SPOS F 3 Bright A_CustomBulletAttack(2, 2, 1, 20)
    SPOS E 5
    Goto See