A_CustomBulletAttack

From ZDoom Wiki
Jump to: navigation, search

A_CustomBulletAttack (float horz_spread, float vert_spread, int numbullets, int damageperbullet [, string pufftype [, float range [, int flags]]])
A_CustomBulletAttack (float horz_spread, float vert_spread, int numbullets, int damageperbullet [, string pufftype [, float range [, int flags [, int target]]]]) (New from 2.8.1)
A_CustomBulletAttack (float horz_spread, float vert_spread, int numbullets, int damageperbullet [, string pufftype [, float range [, int flags [, int target [, string missile [, float spawnheight [, float spawnofs_xy]]]]]]]) (development version 3c7e1e0 only)

Usage

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.

Parameters

  • 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. (development version 4750dfd only)
    • CBAF_PUFFMASTER: Only works when missile is used. Sets the puff as the missile's master. (development version 4750dfd only)
    • CBAF_PUFFTRACER: Only works when missile is used. Sets the puff as the missile's tracer. (development version 4750dfd only)

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

  • target: The actor to attack. This takes an actor pointer. Default is AAPTR_TARGET. (New from 2.8.1)
  • missile: The actor projectile to spawn. This actor faces the bullet puff and travels directly towards it. Default is none. (development version 3c7e1e0 only)
  • spawnheight: Offsets how high up from the base of the actor missile spawns. Default is 32. (development version 3c7e1e0 only)
  • 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. (development version 3c7e1e0 only)

Examples

ACTOR Sniper : ShotgunGuy
{
  States
  {
  Missile:
    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
  }
}