A_CustomBulletAttack
Jump to navigation
Jump to search
void A_CustomBulletAttack(double spread_xy, double spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", double range = 0, int flags = 0, int ptr = AAPTR_TARGET, class<Actor> missile = null, double Spawnheight = 32, double Spawnofs_xy = 0)
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
- double horz_spread
- The horizontal spread, in degrees.
- double vert_spread
- The vertical spread, in degrees.
- int numbullets
- The number of bullets to fire.
- int 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.
- class<Actor> pufftype
- The puff to spawn at the point of impact. Default is 'BulletPuff'.
- double range
- The maximum range of the bullets. Default is 0, which is interpreted as 2048.
- int flags
- Flags that modify the behavior of the function. (Multiple flags can be combined with
|
.)- 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.
- int ptr
- The actor to attack. This takes an actor pointer. Default is AAPTR_TARGET.
- class<Actor> missile
- The actor projectile to spawn. This actor faces the bullet puff and travels directly towards it. Default is none.
- double Spawnheight
- Offsets how high up from the base of the actor
missile
spawns. Default is 32.
- double 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.
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 } }