Yeah, i know, this is like super important and totally game breaking bug
Category: Code
Version: All, beta and release
Summary:
There is small rounding error (1 point, maybe 2 at most) when armored ZED takes health damage from certain damage types. It doesn't matter if ZED's currently wearing armor or not, it might be completely destroyed, even without it such ZEDs will be taking 1 point less damage than they should.
For example, non-headshot off-perk 9mm does 25 points of damage to Alpha Clot but 24 to Rioter (when it shot to legs / spine / other unprotected zone), Kriss: 49 vs 48. Even though both Clots having same resistances.
Description:
Should the rounding error occur or not depends on weapon damage and ZED's armor (not health) multiplier against that damage, combinations of these to give float variable are likely to cause such error.
Even when armored ZED takes damage to exposed body part it still processes (possible) calculation of damage to armor: KFPawn_Monster.AdjustDamage -> AdjustDamageForArmor -> ArmorInfo.AdjustBoneDamage
example for Rioter vs off-perk 9mm, marked in green
function AdjustBoneDamage(out int InDamage, name BoneName, Vector DamagerSource, class<DamageType> DamageType)
{
local int ArmorZoneIdx, ModDmgMax, ModDmgRem, ObliterateDamage;
local float Modifier;
Modifier = GetArmorDamageTypeModifier(DamageType); // 9mm's DamageTypeModifier = 1.01
ModDmgMax = InDamage * Modifier; // 25 x 1.01 = 25.25 = 25 since it's stored as INT
ModDmgRem = ModDmgMax;
ArmorZoneIdx = GetArmorZoneIndex(BoneName, DamagerSource);
if (ArmorZoneIdx != INDEX_NONE && ArmorZones[ArmorZoneIdx].ArmorHealth > 0)
{
if (ModDmgMax >= ArmorZones[ArmorZoneIdx].ObliterateDmgThreshold)
{
ObliterateDamage = ArmorZones[ArmorZoneIdx].ArmorHealth;
TakeArmorZoneDamage(ArmorZoneIdx, ObliterateDamage, ObliterateDamage);
}
else
{
TakeArmorZoneDamage(ArmorZoneIdx, ModDmgRem, ModDmgRem);
}
}
InDamage = float(ModDmgRem) / Modifier; // InDamage = 25 / 1.01 = ~24.75 = 24, the outcome is less than incoming var by 1 point.
}
Category: Code
Version: All, beta and release
Summary:
There is small rounding error (1 point, maybe 2 at most) when armored ZED takes health damage from certain damage types. It doesn't matter if ZED's currently wearing armor or not, it might be completely destroyed, even without it such ZEDs will be taking 1 point less damage than they should.
For example, non-headshot off-perk 9mm does 25 points of damage to Alpha Clot but 24 to Rioter (when it shot to legs / spine / other unprotected zone), Kriss: 49 vs 48. Even though both Clots having same resistances.
Description:
Should the rounding error occur or not depends on weapon damage and ZED's armor (not health) multiplier against that damage, combinations of these to give float variable are likely to cause such error.
Even when armored ZED takes damage to exposed body part it still processes (possible) calculation of damage to armor: KFPawn_Monster.AdjustDamage -> AdjustDamageForArmor -> ArmorInfo.AdjustBoneDamage
example for Rioter vs off-perk 9mm, marked in green
Spoiler!
function AdjustBoneDamage(out int InDamage, name BoneName, Vector DamagerSource, class<DamageType> DamageType)
{
local int ArmorZoneIdx, ModDmgMax, ModDmgRem, ObliterateDamage;
local float Modifier;
Modifier = GetArmorDamageTypeModifier(DamageType); // 9mm's DamageTypeModifier = 1.01
ModDmgMax = InDamage * Modifier; // 25 x 1.01 = 25.25 = 25 since it's stored as INT
ModDmgRem = ModDmgMax;
ArmorZoneIdx = GetArmorZoneIndex(BoneName, DamagerSource);
if (ArmorZoneIdx != INDEX_NONE && ArmorZones[ArmorZoneIdx].ArmorHealth > 0)
{
if (ModDmgMax >= ArmorZones[ArmorZoneIdx].ObliterateDmgThreshold)
{
ObliterateDamage = ArmorZones[ArmorZoneIdx].ArmorHealth;
TakeArmorZoneDamage(ArmorZoneIdx, ObliterateDamage, ObliterateDamage);
}
else
{
TakeArmorZoneDamage(ArmorZoneIdx, ModDmgRem, ModDmgRem);
}
}
InDamage = float(ModDmgRem) / Modifier; // InDamage = 25 / 1.01 = ~24.75 = 24, the outcome is less than incoming var by 1 point.
}
Last edited: