A_CustomPunch
From ZDoom Wiki
A_CustomPunch (int damage [, bool norandom [, int flags [, string pufftype, [float range[, float lifesteal]]]]])
Defines a custom punch attack. Damage can either be random or fixed and it is possible to specify whether ammo is used or the puff that is spawned when hitting the wall or a non-bleeding actor. It is also possible to define the maximum distance of the attack and its capacity to steal life from the target.
- Damage can be a number or expression. If the second argument, norandom, is false then whatever number is given in damage is then the base damage for Doom's native punch damage randomizer whose formula is damage * random(1,8). If you want the number in damage to be the final damage output of the punch, or to use your own custom expression, set norandom to true.
- Flags The following flags can be combined by using the | character between the constant names: (New from 2.5.0)
- CPF_USEAMMO — Use ammo: the attack drains ammo as indicated by the appropriate Weapon.AmmoUse property.
- CPF_DAGGER — Act like a PunchDagger: Monsters with the SEESDAGGERS flag are woken up if they see the attack, even if the weapon has the WEAPON.NOALERT flag. This replicates an element of A_JabDagger.
- CPF_PULLIN — Pull in: Successful hit pulls the player forward like Doom's Chainsaw or Heretic's Gauntlets. It's important to note that a successful melee attack, regardless of this flag, will always turn the player's facing angle towards their struck target but the player's velocity will only be affected if the flag is set.
- PuffType is the puff actor to use when striking a wall or non-bleeding actor. The default is BulletPuff.
- Range is the range of the attack. The default value is 64 (actually the value is 0, but since a range of 0 would be a worthless attack A_CustomPunch will interpret a range of 0 as 64.)
- Lifesteal, if positive, is the value used as a factor for giving back the inflicted damage as hit points to the actor using the calling weapon. (New from 2.5.0)
Please note that the Berserk powerup will not work with A_CustomPunch. However, you can emulate the effect using A_JumpIfInventory and A_SelectWeapon.
Examples
Fire:
KNIF B 4
KNIF C 4 A_CustomPunch (20,0,0,0,0,0) // 20*random(1,8) since norandom is false, uses no ammo, will
// spawn BulletPuffs, has a range of 64, and doesn't steal life.
KNIF D 5
KNIF C 4
KNIF B 5 A_ReFire
goto Ready
Fire:
SWRD B 4
SWRD C 4 A_CustomPunch (random(4,8)*10,1,0,"SwordPuff",96,0) // Uses a custom damage formula, spawns
// custom puffs, and has a longer range of 96
SWRD D 4
SWRD C 6
SWRD B 6 A_ReFire
goto Ready