A_CustomMeleeAttack

From ZDoom Wiki
Jump to: navigation, search

A_CustomMeleeAttack [(int damage [, str meleesound [, str misssound [, str damagetype [, bool bleed]]]])]

Usage

A customizable melee attack for monsters. Causes the actor to execute a melee attack with the specified parameters.

The function calls A_FaceTarget and checks if the caller's target is within melee range, damaging it if it is and playing meleesound. If the target is outside melee range, however, misssound sound is played and no damage is dealt to the target. If there is no target, the function does nothing when it is called.

Both meleesound and missound are played on the weapon channel (CHAN_WEAPON).

Parameters

  • damage: The amount of damage to perform. This can be an exact value or an expression. Default is 0.
  • meleesound: The sound to make when the melee successfully hits. Default is "", for no sound.
  • misssound: The sound to make when the melee attack misses. Default is "", for no sound.
  • damagetype: The type of damage to do. Default is "Melee".
  • bleed: If true, target bleeds when hit. This only produces blood decals on nearby walls. Default is true.

Examples

This is the revenant's melee sequence:

 Melee:
   SKEL G 1 A_FaceTarget
   SKEL G 6 A_SkelWhoosh
   SKEL H 6 A_FaceTarget
   SKEL I 6 A_SkelFist
   goto See

The same sequence could be simulated this way:

 Melee:
   SKEL G 1 A_FaceTarget
   SKEL G 6 A_SkelWhoosh
   SKEL H 6 A_FaceTarget
   SKEL I 6 A_CustomMeleeAttack(random(1, 10) * 6, "skeleton/melee") // Does not make any sound when missing