[ModCreationHelp] XML codes for Damage Mitigation

Started by HQQ, January 19, 2020, 06:19:09 AM

Previous topic - Next topic

HQQ

Hello, I'm trying to create an extra powerful Tough trait that mitigates like 85% of damage instead of 50 to give to some evil monsters, but after checking the Core's Trait.xml file, and researching the coreXML dictionary, there just don't seem to be a way. Is it something that involves C#?
If so, is there a way for me to give a pawn damage mitigation? I'm thinking of the damageMultiplier codes for building, but I'm not sure if it works on RaceDef.

K

The vanilla game doesn't expose a stat for damage mitigation. The tough trait is hard coded to provide a 50% reduction. It's possible to add a stat for damage mitigation (I've done it in one of my mods) but it will require C# and the use of Harmony. Generally, the implementation I went with was adding a stat and applying that stat in a prefix to the PreApplyDamage method in the Pawn class, so that my damage mitigation worked about the same as the vanilla tough trait.

Also, posts asking for help with mod creation generally go in the help subforum.

HQQ

I see, thanks for the help and the directions!
I think I'll just settle with adding armors for that race instead. I'm a pawn that has Lv0 in Intellectual, with no Passion or Interest in the skill.

Vanitious

using these for an animal seemed to give it damage reduction in the sense apparel does for colonists. (bottom 3 not all of them)

    <statBases>
      <MoveSpeed>5.5</MoveSpeed>
      <MarketValue>6000</MarketValue>
     <SellPriceFactor>0.30</SellPriceFactor>
      <ComfyTemperatureMin>-165</ComfyTemperatureMin>
      <ComfyTemperatureMax>150</ComfyTemperatureMax>
      <ArmorRating_Sharp>1.55</ArmorRating_Sharp>
      <ArmorRating_Blunt>1.55</ArmorRating_Blunt>
      <ArmorRating_Heat>1.35</ArmorRating_Heat>
    </statBases>

cant say for certain since i never extensively tested it but sure seemed to work and i imagine adding that into a race would do the same since animals base comes from race defs.