Deceptive Pastry
New member
Was doing a bunch of testing and thought this may be helpful to others wondering how perc_adds are calculated and such.
Damage calculation for items in general seems to be:
((Entity/BlockDamage +/- base_add/subtract) * (1 + sum of all perc_add values)) * (1 + DamageModifier)
Damage modifiers are applied after all Entity/BlockDamage calculations, so things like DamageModifier tags="head" (headshot multiplier) or "wood" will be applied after.
More from XML.txt:
If AN ENTITY is doing something, using items, or merely standing around:
1. Entity Class
2. the item in question including installed mods (if an item is passed in)
3. held item including installed mods, if not equal to the item in question
4. worn items including installed mods
5. player progression (skills, perks...)
6. buffs
7. bonus damage such as for headshots or attacking specific block materials (see below)
8. game difficulty modifier
9. armor reduces damage
On PASSIVE effects, the order is also affected by the TYPE of operation.
- A "base_set" should be placed first in the order of operations (OOO)... because it overwrites any previous changes in the OOO. Duh.
- Any base_set|base_add|base_subtract take effect immediately as the list is traversed.
- Any and all perc_set|perc_add|perc_subtract are COLLECTED into a separate variable and applied after last as one modifier.
Some examples:
Default Iron Fireaxe, base BlockDamage of 30, power attack perc_add of 2 that only applies to secondary attack (tags="secondary")
Standard attack: (30 * (1 + 0)) * (1 + 0) = 30
Power attack: (30 * (1 + 2)) * (1 + 0) = 90
Power attack on Metal (default -0.75 modifier): (30 * (1 + 2)) * (1 - 0.75) = 22.5
Let's say we get a headshot with the Hunting Rifle and we have lvl 2 of the Headshot perk. 7.62 ammo does 40 damage and the Hunting Rifle itself has a 0.35 perc_add modifier. Default headshot damage modifier is 0.5 (+50%), lvl 2 perk gives another 0.5.
(40 * (1 + 0.35)) * (1 + 0.5 + 0.5) = 108 damage. Avg zombie has 150 hp, not a one shot kill.
Lvl 5 perk adds 150% damage.
(40 * (1 + 0.35)) * (1 + 0.5 + 1.5) = 162. That's a dead zombie
So let's say we add some of our own modifiers. Let's add the following to the Hunting Rifle effect_group:
<passive_effect name="BlockDamage" operation="perc_add" value="0.5"/>
The Hunting Rifle already has a BlockDamage perc_add modifier, but this new line will add to any modifiers already on the weapon, not overwrite the original line/value. So the 7.62 ammo has a default BlockDamage of 8, and the gun itself has a default BlockDamage perc_add of 0.35 and a wood DamageModifier of 4.
Hunting rifle shooting at wood:
(8 * (1 + 0.35 default + 0.5)) * (1 + 4) = 74
Feel free to correct anything or add experiences that differ from these calculations, still figuring this stuff out.
Damage calculation for items in general seems to be:
((Entity/BlockDamage +/- base_add/subtract) * (1 + sum of all perc_add values)) * (1 + DamageModifier)
Damage modifiers are applied after all Entity/BlockDamage calculations, so things like DamageModifier tags="head" (headshot multiplier) or "wood" will be applied after.
More from XML.txt:
If AN ENTITY is doing something, using items, or merely standing around:
1. Entity Class
2. the item in question including installed mods (if an item is passed in)
3. held item including installed mods, if not equal to the item in question
4. worn items including installed mods
5. player progression (skills, perks...)
6. buffs
7. bonus damage such as for headshots or attacking specific block materials (see below)
8. game difficulty modifier
9. armor reduces damage
On PASSIVE effects, the order is also affected by the TYPE of operation.
- A "base_set" should be placed first in the order of operations (OOO)... because it overwrites any previous changes in the OOO. Duh.
- Any base_set|base_add|base_subtract take effect immediately as the list is traversed.
- Any and all perc_set|perc_add|perc_subtract are COLLECTED into a separate variable and applied after last as one modifier.
Some examples:
Default Iron Fireaxe, base BlockDamage of 30, power attack perc_add of 2 that only applies to secondary attack (tags="secondary")
Standard attack: (30 * (1 + 0)) * (1 + 0) = 30
Power attack: (30 * (1 + 2)) * (1 + 0) = 90
Power attack on Metal (default -0.75 modifier): (30 * (1 + 2)) * (1 - 0.75) = 22.5
Let's say we get a headshot with the Hunting Rifle and we have lvl 2 of the Headshot perk. 7.62 ammo does 40 damage and the Hunting Rifle itself has a 0.35 perc_add modifier. Default headshot damage modifier is 0.5 (+50%), lvl 2 perk gives another 0.5.
(40 * (1 + 0.35)) * (1 + 0.5 + 0.5) = 108 damage. Avg zombie has 150 hp, not a one shot kill.
Lvl 5 perk adds 150% damage.
(40 * (1 + 0.35)) * (1 + 0.5 + 1.5) = 162. That's a dead zombie
So let's say we add some of our own modifiers. Let's add the following to the Hunting Rifle effect_group:
<passive_effect name="BlockDamage" operation="perc_add" value="0.5"/>
The Hunting Rifle already has a BlockDamage perc_add modifier, but this new line will add to any modifiers already on the weapon, not overwrite the original line/value. So the 7.62 ammo has a default BlockDamage of 8, and the gun itself has a default BlockDamage perc_add of 0.35 and a wood DamageModifier of 4.
Hunting rifle shooting at wood:
(8 * (1 + 0.35 default + 0.5)) * (1 + 4) = 74
Feel free to correct anything or add experiences that differ from these calculations, still figuring this stuff out.
Last edited by a moderator: