Swatchz Posted September 2, 2020 Share Posted September 2, 2020 I'm trying to understand how dismemberment works/is calculated so I can mod items to have different dismemberment chances. I last played A15 into A16 but am coming back for A19. When I last played it was a threshold type system tied into each weapon but now it seems purely chance based tied directly to attribute skill progression. However, I don't know the exact formula as I've tried multiple things but the results are never what I'm expecting. Example: In entityclasses.xml is the base dismemberment chance. <entity_class name="playerMale"> ... <passive_effect name="DismemberChance" operation="base_set" value="0.05"/> In progression.xml is the progressive additive chance increase per point 2-10 <attribute name="attAgility" name_key="attAgilityName" desc_key="attAgilityDesc" icon="ui_game_symbol_agility"> ... <passive_effect name="DismemberChance" operation="base_add" level="2,10" value=".05,.45"/> Lastly, in entityclasses.xml I'm assuming this is a multiplier for the chance against certain limbs/head <entity_class name="zombieTemplateMale"> ... <property name="DismemberMultiplierHead" value="1"/> <property name="DismemberMultiplierArms" value="1"/> <property name="DismemberMultiplierLegs" value="1"/> However, if I change the values in an attempt to have 100% headshot dismemberment chance even at level 1 of the Agility attribute by increasing head multiplier. It doesn't result in 100% headshot chance. <entity_class name="playerMale"> ... <passive_effect name="DismemberChance" operation="base_set" value="0.05"/> ... <entity_class name="zombieTemplateMale"> ... <property name="DismemberMultiplierHead" value="20"/> <!-- set multiplier 20x --> ... If I then try and just set base chance to 100% and leave multiplier at 1. It still doesn't result in 100% headshot chance. <entity_class name="playerMale"> ... <passive_effect name="DismemberChance" operation="base_set" value="1"/> <!-- set base chance to 100% --> ... <entity_class name="zombieTemplateMale"> ... <property name="DismemberMultiplierHead" value="1"/> <!-- return multiplier back to 1 --> ... So I seem to be missing something and would really welcome some insight. Link to comment Share on other sites More sharing options...
xyth Posted September 3, 2020 Share Posted September 3, 2020 Its not that simple, and I don't understand it enough to give a clear explanation but in looking at the code, there are other factors involved. One part of the final calculation on whether a limb gets dismembered or not involves the current % damage (GetDamageFraction) which it the amount of the hit damage (take into account melee glancing blow damage reductions) compared to the MaxHealth of the zombie. There is also the additional dismember chances on the weapon in the calculation. Then a random number is applied to the final calculation, so it might not dismember even if there was enough damage. Link to comment Share on other sites More sharing options...
Swatchz Posted September 3, 2020 Author Share Posted September 3, 2020 I'm pretty sure that's how it use to be coded. The dismemberment section in the XML text file details out the formula and that's how I remember it working. Quote private float GetDamageFraction(float _damage) { return _damage / zombie.GetMaxHealth() ;} GetDamageOverlimit = Max(0, GetDamageFraction(bodyDamage.RightLowerLeg + _damage)- ec.LowerLegDismemberThreshold) baseChance = ec.LowerLegDismemberBaseChance + (GetDamageOverlimit * ec.LowerLegDismemberBonusChance); totalChance = canDismember ? (baseChance + _weaponBase + (_damage * _weaponBonus)) : 0f; totalChance is the actual chance for limb dismemberment. But they previously had (LowerLegDismemberThreshold), (LowerLegDismemberBaseChance), and (LowerLegDismemberBonusChance) values we could change but they've all been since removed. So the formula seems obsolete now. They either changed the formula completely or have hardcoded/moved those values. Curious if anyone has heard or seen how it works now especially with new variables such as (DismemberChance) and (DismemberMultiplierLegs). Link to comment Share on other sites More sharing options...
mr.devolver Posted September 4, 2020 Share Posted September 4, 2020 Maybe it would be easier if you told us what's your actual goal, so that we don't have to keep beating around the bush here. If you wanted to create a weapon that will destroy heads or limbs 100% of the time, you could simply code it inside that weapon code. I used a similar trick in my Crowbar mod in Alpha 18. Well, it didn't always destroy heads, but that wasn't even the main point of it. I wanted it to be a useful tool for opening doors, safes and heads, but you wouldn't always see the head explode, because that wouldn't be as much fun as you might think, that would be kinda OP and I didn't want that, but yeah if you wanted a weapon that makes the heads explode 100% of the time, this is one of the ways you could make it happen. Link to comment Share on other sites More sharing options...
Swatchz Posted September 4, 2020 Author Share Posted September 4, 2020 The intent of the post was to understand the formula. If no one knows, then that's that. I'm ultimately trying to have items with their own dismemberment chances per limb (kinda like back in A15 or A16... whichever I played a few years back). For example: Pistol - head 20% / arm 10% / leg 10% Magnum - head 50% / arm 40% / leg 20% Sledgehammer (Primary) - head 10% / arm 10% / leg 10% Sledgehammer (Secondary) - head 60% / arm 20% / leg 10% As it stands, I can set the overall dismemberment chance per item and I can try setting the limb multipliers (DismemberMultiplierLegs) but without the formula its just arbitrary values that have to be tweaked by feel. Link to comment Share on other sites More sharing options...
mr.devolver Posted September 4, 2020 Share Posted September 4, 2020 1 hour ago, Swatchz said: The intent of the post was to understand the formula. If no one knows, then that's that. I'm ultimately trying to have items with their own dismemberment chances per limb (kinda like back in A15 or A16... whichever I played a few years back). For example: Pistol - head 20% / arm 10% / leg 10% Magnum - head 50% / arm 40% / leg 20% Sledgehammer (Primary) - head 10% / arm 10% / leg 10% Sledgehammer (Secondary) - head 60% / arm 20% / leg 10% As it stands, I can set the overall dismemberment chance per item and I can try setting the limb multipliers (DismemberMultiplierLegs) but without the formula its just arbitrary values that have to be tweaked by feel. If you feel lucky, try to look at the code of Assembly-CSharp.dll. I wish someone would make an all in one modding guide with all kinds of different things explained, such as this one, but there is none, so honestly it's all trial and error. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.