A_MonsterBulletAttack
From DoomWiki.org
A_MonsterBulletAttack(hspread, vspread, numbullets, damagebase, damagedice) is a generic monster bullet attack function that is part of the MBF21 specification. It has five parameters, using the values in the "Args" fields as arguments.
The first argument defines the maximum horizontal spread of the bullet attack, while the second sets the maximum amount for the vertical spread. Both of these will default to zero if not provided, resulting in no spread being applied to the attack (setting both values to 1 will yield the same result). The third argument defines how many bullets are being fired and will default to 1 if not provided. The fourth and fifth argument set the damage range for the attack, with the fourth argument controlling the base damage, while the fifth one supplies the damage multiplier. The base damage will default to 3 if not provided and the damage multiplier to 5 (mirroring A_PosAttack from the zombieman's attack animation). The damage is calculated using the following formula:
damage = (damagebase * random(1, damagedice))
The first two arguments have to be passed to the function in fixed point, meaning the intended value has to be multiplied by 65536 (FRACUNIT), while all the remaining ones use integer values, meaning the intended values can be input as is. The function also calls A_FaceTarget and plays the attack sound of the calling actor.
Example[edit]
The following is an example of how to set the A_MonsterBulletAttack
code pointer in a DeHackEd file using BEX syntax:
Frame 185 Args1 = 1474560 Args2 = 0 Args3 = 1 Args4 = 3 Args5 = 5 [CODEPTR] FRAME 185 = MonsterBulletAttack
Or using DECOHack syntax:
state 185 { POSS F 8 A_MonsterBulletAttack(22.5, 0, 1, 3, 5) Goto 186 }
The example above uses A_MonsterBulletAttack
to replace A_PosAttack in the zombieman's attack animation.
External links[edit]
- A_MonsterBulletAttack in the DSDA-Doom source code, hosted on GitHub.
- MBF21 specification, hosted on GitHub.