From ZDoom Wiki
Jump to navigation Jump to search
For more information on this article, visit the A_Saw page on the Doom Wiki.

A_Saw [(string fullsound [, string hitsound [, int damage [, string pufftype [, int flags [, float range [, float spread_xy [, float spread_z [, float lifesteal [, int lifestealmax [, string armorbonustype]]]]]]]]]])]


Doom's chainsaw attack for weapons. For monsters, use A_M_Saw.


  • fullsound: The sound that plays if the attack doesn't hit anything. Defaults to "weapons/sawfull".
  • hitsound: The sound that plays if the weapon hits a target. Defaults to "weapons/sawhit".
  • damage: The amount of damage to deal, with the following calculation:
if (damage == 0) damage = 2;
damage *= (random() % 10 + 1);
For example, if damage is 5, the damage dealt will be between 5 and 50. Note that it is not possible to have this function deal 0 damage, since 0 means "use the default value" which is 2.
  • pufftype: The puff to spawn if the attack hits a wall or invulnerable actor. Defaults to "BulletPuff".
  • flags: The following flags can be combined by using the | character between the constant names:
    • SF_NORANDOM — No random: Disables damage randomization.
    • SF_RANDOMLIGHTMISS — Random light on miss: Adds a 25% chance to toggle lighting if no target is hit.
    • SF_RANDOMLIGHTHIT — Random light on hit: Randomly changes light on hit, like A_GauntletAttack (25% 0, 37.5% 1, 37.5% 2).
    • SF_RANDOMLIGHTBOTH — Random light on both: The two above flags combined, works like A_GauntletAttack.
    • SF_NOUSEAMMOMISS — No ammo use on miss: Do not use ammo if nothing hit.
    • SF_NOUSEAMMO — No ammo use: Do not use ammo.
    • SF_NOPULLIN — No pull in: the player is not pulled towards their struck target on successful hits.
    • SF_NOTURN — No turn: the player's facing angle is not adjusted towards their struck target on successful hits.
    • SF_STEALARMOR — When lifesteal is used, the stolen health is converted to armor points, repairing the player's armor, instead of healing the player like normal.
    • SF_NORANDOMPUFFZ — The random z offset given to the puff when spawned is disabled.
  • range: The maximum range of the attack. If this is 0, the range is determined by adding 20 to the calling actor's MeleeRange, which is 44 by default. Although the actor property could be used to alter the range, it is best to instead set the range directly through this parameter. This feature exists only for DoomWikiLogoIcon.pngMBF21 support. Default is 0.
  • spread_xy: Maximum angle of random horizontal spread. Defaults to 2.8125.
  • spread_z: Maximum angle of random vertical spread. Defaults to 0.
  • lifesteal: If positive, this value is used as a factor for giving back the inflicted damage as hit points to the actor using the calling weapon.
  • lifestealmax: The limit of how much the player heals when stealing health from the victim. This works for when stealing health for health and health for armor. Positive values set an explicit limit. If a value of zero is passed, the player is healed up to their maximum health when stealing for health, and up to the armorbonustype item's Armor.MaxSaveAmount (see below) when stealing for armor. Default value is 0.
  • armorbonustype: The armor bonus item to use for repairing armor when life-stealing. This must be an item derived from BasicArmorBonus. When stealing for armor, the item's Armor.SaveAmount property is taken into account; the life stolen value will be multiplied by that property's value. If this is not specified, ArmorBonus will be used as the default item.


This example is taken from Doom's chainsaw weapon.

    SAWG AB 4 A_Saw
    SAWG B 0 A_ReFire
    Goto Ready