A_MonsterProjectile
From DoomWiki.org
A_MonsterProjectile(type, angle, pitch, hoffset, voffset) is a generic monster projectile 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 actor that is to be spawned as a projectile using the actor's DeHackEd number; if not provided, no projectile will be spawned. The second argument determines the angle in degrees at which the projectile is fired relative to the direction the calling actor is facing (negative value = angle to the right, positive value = angle to the left). The third argument sets the pitch in degrees of the projectile relative to the calling actor (negative value = upward, positive value = downward). The fourth argument sets the horizontal offset of the projectile relative to the calling actor in map units (negative value = to the left, positive value = to the right). Finally, the fifth argument sets the vertical offset relative to the default projectile firing height of the calling actor in map units (negative value = below, positive value = above). All arguments except the first one will default to zero if not provided and must be passed in fixed point, meaning the intended value has to be multiplied by 65536 (FRACUNIT), while all remaining ones use integer values, meaning the intended values can be input as is. Note also that the projectile's tracer is always set to the calling actor's target, same as with a revenant's homing missile.
Example[edit]
The following is an example of how to set the A_MonsterProjectile
code pointer in a DeHackEd file using BEX syntax:
Frame 341 Args1 = 7 Args2 = 0 Args3 = 0 Args4 = 0 Args5 = 0 [CODEPTR] FRAME 341 = MonsterProjectile
Or using DECOHack syntax:
state 341 { SKEL K 10 A_MonsterProjectile(7, 0, 0, 0, 0) Goto 342 }
The example above uses A_MonsterProjectile
to replace A_SkelMissile in the revenant's ranged attack animation.
External links[edit]
- A_MonsterProjectile in the DSDA-Doom source code, hosted on GitHub.
- MBF21 specification, hosted on GitHub.