Issue with weapon hediff application

Started by Goldenpotatoes, January 11, 2017, 09:02:53 AM

Previous topic - Next topic

Goldenpotatoes

I created a weapon with a custom DamageDef that applies a hediff, but the issue is that the hediff doesn't seem to apply. When I enabled AllDefs on a pawn's health tab and hit them with the gun, it shows the effect popping up and vanishing immediately afterwards. Manually applying the hediff via dev tool makes it work just fine.

DamageDef
  <DamageDef Name="FatigueShot" Abstract="True">
    <makesBlood>false</makesBlood>
    <externalViolence>true</externalViolence>
    <deathMessage>{0} has died of exhaustion.</deathMessage>
    <armorCategory>Blunt</armorCategory>
  </DamageDef>
 
  <DamageDef ParentName="FatigueShot">
    <defName>FatigueBuildup</defName>
    <label>fatigue</label>
    <additionalHediffs>
      <li>
        <hediff>Fatigue</hediff>
        <severityPerDamageDealt>.5</severityPerDamageDealt>
      </li>
    </additionalHediffs>
  </DamageDef>


HediffDef
  <HediffDef>
    <defName>Fatigue</defName>
    <hediffClass>HediffWithComps</hediffClass>
    <defaultLabelColor>(0.7, 1.0, 0.7)</defaultLabelColor>
    <label>fatigue</label>
    <lethalSeverity>1</lethalSeverity>
    <makesSickThought>true</makesSickThought>
    <scenarioCanAdd>true</scenarioCanAdd>
    <comps>
      <li Class="HediffCompProperties_Immunizable">
        <severityPerDayNotImmune>-0.08</severityPerDayNotImmune>
      </li>
    </comps>
    <stages>
      <li>
        <label>initial-hidden</label>
        <everVisible>false</everVisible>
      </li>
      <li>
        <label>initial</label>
        <minSeverity>0.04</minSeverity>
        <capMods>
          <li>
            <capacity>Consciousness</capacity>
            <offset>-0.05</offset>
          </li>
        </capMods>
      </li>
      <li>
        <label>minor</label>
        <minSeverity>0.2</minSeverity>
        <capMods>
          <li>
            <capacity>Consciousness</capacity>
            <offset>-0.10</offset>
          </li>
        </capMods>
      </li>
      <li>
        <label>moderate</label>
        <minSeverity>0.40</minSeverity>
        <capMods>
          <li>
            <capacity>Consciousness</capacity>
            <offset>-0.15</offset>
          </li>
        </capMods>
      </li>
      <li>
        <label>serious</label>
        <minSeverity>0.60</minSeverity>
        <capMods>
          <li>
            <capacity>Consciousness</capacity>
            <offset>-0.25</offset>
          </li>
        </capMods>
      </li>
      <li>
        <label>extreme</label>
        <minSeverity>0.80</minSeverity>
        <capMods>
          <li>
            <capacity>Consciousness</capacity>
            <setMax>0.10</setMax>
          </li>
        </capMods>
      </li>
    </stages>
  </HediffDef>


Is the severity per damage dealt not enough to correctly apply it for more than a split second? I'm not really sure what else would be the issue. Bear in mind this is me mostly learning from the core game files and basing that into my own version, so I'm probably overlooking something.

Thirite

Weird. It must have something to do with the damagedef if the hediff works fine if added via debug mode. Try setting severityPerDamageDealt to zero and see what happens.

Goldenpotatoes

Same issue occurs still, not sure what to do at this point.

skullywag

do you have a damage worker?

<workerClass>DamageWorker_AddInjury</workerClass>

check the core damagedefs or an example, you need this abstract in your mod or set this on the def itself.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Goldenpotatoes

#4
I forgot the workerclass, yeah. Running into a new issue now, though. Log throws an error whenever the projectile hits a pawn's external body-part, i.e limbs. If by chance the bullet RNG hits an internal part like a rib, no error is thrown and the effect is applied properly.

Couldn't find a way to save the log in-game, screencap of the error output.


EDIT: Figured it out myself, problems solved.