A_WeaponMeleeAttack

From DoomWiki.org

A_WeaponMeleeAttack(damagebase, damagedice, zerkfactor, sound, range) is a generic weapon melee 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 sets the base damage for the attack, while the second arguments determines the damage multiplier; the former will default to 2 and the latter to 10 if not provided. The damage is calculated using the following formula:

damage = (damagebase * random(1, damagedice))

The third argument gives the damage multiplier for the berserk, which will default to 1.0 if not provided, resulting in no damage increase. The fourth argument defines the sound that is played when an attack lands, with no sound being played by default. Lastly, the fifth arguments sets the melee range for the attack, which if not provided (or set to zero) will default to the value in the "Melee range" field in the player's definition.

The third and fifth argument has 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.

Example[edit]

The following is an example of how to set the A_WeaponMeleeAttack code pointer in a DeHackEd file using BEX syntax:

Frame 6
Args1 = 2
Args2 = 10
Args3 = 655360
Args4 = 83
Args5 = 4194304

[CODEPTR]
FRAME 6 = A_WeaponMeleeAttack

Or using DECOHack syntax:

state 6
{
 PUNC G 4 A_WeaponMeleeAttack(2, 10, 10.0, "punch", 64.0)
 goto 7
}

The example above uses A_WeaponMeleeAttack to replace A_Punch in the player's fist animation.

External links[edit]