How to mod out tolerance?

Started by seanguy68, September 13, 2016, 03:44:49 PM

Previous topic - Next topic

seanguy68

Is there any way to mod out the tolerance system so pawns never develop a tolerance to any drugs? If so how?

Master Bucketsmith

I imagine it's done by simply removing the tolerance tags and defs in the XML files for drugs.
Here's an example of vanilla Psychite_Yayo:
<?xml version="1.0" encoding="utf-8" ?>
<Yayo>

  <ThingDef ParentName="MakeableDrugBase">
    <defName>Yayo</defName>
    <label>yayo</label>
    <description>A fine white powder snorted to produce a euphoric high. Yayo reducing the user's need for rest, and suppresses pain. It is, however, addictive.</description>
    <graphicData>
      <texPath>Things/Item/Drug/Yayo</texPath>
      <graphicClass>Graphic_StackCount</graphicClass>
    </graphicData>
    <rotatable>false</rotatable>
    <statBases>
      <WorkToMake>500</WorkToMake>
      <MarketValue>22</MarketValue>
    </statBases>
    <techLevel>Industrial</techLevel>
    <ingestible>
      <foodType>Processed</foodType>
      <joy>0.80</joy>
      <drugCategory>Hard</drugCategory>
      <baseIngestTicks>240</baseIngestTicks>
      <ingestSound>Ingest_Snort</ingestSound>
      <ingestHoldOffsetStanding>(0.21,0,0.05)</ingestHoldOffsetStanding>
      <ingestHoldUsesTable>false</ingestHoldUsesTable>
      <ingestCommandString>Snort {0}</ingestCommandString>
      <ingestReportString>Snorting {0}.</ingestReportString>
      <outcomeDoers>
        <li Class="IngestionOutcomeDoer_GiveHediff">
          <hediffDef>YayoHigh</hediffDef>
          <severity>0.75</severity>
          <toleranceChemical>Psychite</toleranceChemical>
        </li>
        <li Class="IngestionOutcomeDoer_OffsetNeed">
          <need>Rest</need>
          <offset>0.4</offset>
          <toleranceChemical>Psychite</toleranceChemical>
        </li>
        <li Class="IngestionOutcomeDoer_GiveHediff">
          <hediffDef>PsychiteTolerance</hediffDef>
          <severity>0.040</severity>
        </li>
      </outcomeDoers>
    </ingestible>
    <recipeMaker>
      <researchPrerequisite>PsychiteRefining</researchPrerequisite>
      <recipeUsers>
        <li>DrugLab</li>
      </recipeUsers>
    </recipeMaker>
    <costList>
      <PsychoidLeaves>14</PsychoidLeaves>
    </costList>
    <comps>
      <li Class="CompProperties_Drug">
        <chemical>Psychite</chemical>
        <addictiveness>0.08</addictiveness>
        <minToleranceToAddict>0.04</minToleranceToAddict>
        <existingAddictionSeverityOffset>0.20</existingAddictionSeverityOffset>
        <needLevelOffset>1</needLevelOffset>
        <isCombatEnhancingDrug>true</isCombatEnhancingDrug>
        <listOrder>100</listOrder>
        <overdoseSeverityOffset>
          <min>0.18</min>
          <max>0.35</max>
        </overdoseSeverityOffset>
      </li>
    </comps>
  </ThingDef>

  <HediffDef>
    <defName>YayoHigh</defName>
    <hediffClass>HediffWithComps</hediffClass>
    <label>high on yayo</label>
    <defaultLabelColor>(1,0,0.5)</defaultLabelColor>
    <scenarioCanAdd>true</scenarioCanAdd>
    <maxSeverity>1.0</maxSeverity>
    <comps>
      <li>
        <compClass>HediffComp_SeverityPerDay</compClass>
        <severityPerDay>-1.5</severityPerDay>
      </li>
    </comps>
      <stages>
        <li>
          <painFactor>0.5</painFactor>
          <restFallFactor>0.33</restFallFactor>
          <capMods>
            <li>
              <capacity>Moving</capacity>
              <offset>0.15</offset>
            </li>
          </capMods>
        </li>
      </stages>
  </HediffDef>

  <ThoughtDef>
    <defName>YayoHigh</defName>
    <workerClass>ThoughtWorker_Hediff</workerClass>
    <hediff>YayoHigh</hediff>
    <stages>
      <li>
        <label>high on yayo</label>
        <description>Feeling pumped! Let's do this!</description>
        <baseMoodEffect>35</baseMoodEffect>
      </li>
    </stages>
  </ThoughtDef>
 
  <!-- Psychite addiction -->
 
  <ChemicalDef>
    <defName>Psychite</defName>
    <label>psychite</label>
    <addictionHediff>PsychiteAddiction</addictionHediff>
    <toleranceHediff>PsychiteTolerance</toleranceHediff>
  </ChemicalDef>
 
  <NeedDef ParentName="DrugAddictionNeedBase">
    <defName>Chemical_Psychite</defName>
    <needClass>Need_Chemical</needClass>
    <label>psychite</label>
    <description>Because of a psychite addiction, this person needs to regularly consume the drug to avoid withdrawal symptoms.</description>
    <listPriority>50</listPriority>
  </NeedDef>

  <HediffDef ParentName="DrugToleranceBase">
    <defName>PsychiteTolerance</defName>
    <label>psychite tolerance</label>
    <comps>
      <li>
        <compClass>HediffComp_SeverityPerDay</compClass>
        <severityPerDay>-0.015</severityPerDay>
      </li>
      <li>
        <compClass>HediffComp_DrugEffectFactor</compClass>
        <chemical>Psychite</chemical>
      </li>
    </comps>
  </HediffDef>
 
  <HediffDef ParentName="AddictionBase">
    <defName>PsychiteAddiction</defName>
    <hediffClass>Hediff_Addiction</hediffClass>
    <label>psychite addiction</label>
    <causesNeed>Chemical_Psychite</causesNeed>
    <comps>
      <li>
        <compClass>HediffComp_SeverityPerDay</compClass>
        <severityPerDay>-0.04</severityPerDay>
      </li>
    </comps>
    <stages>
      <li>
      </li>
      <li>
        <label>withdrawal</label>
        <restFallFactor>1.3</restFallFactor>
        <socialFightChanceFactor>3.0</socialFightChanceFactor>
        <capMods>
          <li>
            <capacity>Consciousness</capacity>
            <offset>-0.20</offset>
          </li>
          <li>
            <capacity>Moving</capacity>
            <offset>-0.20</offset>
          </li>
          <li>
            <capacity>Manipulation</capacity>
            <offset>-0.20</offset>
          </li>
        </capMods>
        <mentalStateGivers>
          <li>
            <mentalState>WanderPsychotic</mentalState>
            <mtbDays>10</mtbDays>
          </li>
        </mentalStateGivers>
      </li>
    </stages>
  </HediffDef>

  <ThoughtDef>
    <defName>PsychiteWithdrawal</defName>
    <workerClass>ThoughtWorker_Hediff</workerClass>
    <hediff>PsychiteAddiction</hediff>
    <stages>
      <li>
        <visible>false</visible>
      </li>
      <li>
        <label>psychite withdrawal</label>
        <description>God I'm tired. And nothing feels good any more.</description>
        <baseMoodEffect>-25</baseMoodEffect>
      </li>
    </stages>
  </ThoughtDef>
 
</Yayo>


Play around; try removing all of the references to tolerance, save it as a new XML and dump it in a new modfolder. Don't forget the About folder and the About.xml.

Deimos Rast

To build on what Bucket said, here are what I believe the ones you need to worry about. Setting both their severity to 0 should negate their effects I would think.


        <li Class="IngestionOutcomeDoer_GiveHediff">
          <hediffDef>PsychiteTolerance</hediffDef>
          <severity>0.040</severity>
        </li>
 
  <HediffDef ParentName="DrugToleranceBase">
    <defName>PsychiteTolerance</defName>
    <label>psychite tolerance</label>
    <comps>
      <li>
        <compClass>HediffComp_SeverityPerDay</compClass>
        <severityPerDay>-0.015</severityPerDay>
      </li>
      <li>
        <compClass>HediffComp_DrugEffectFactor</compClass>
        <chemical>Psychite</chemical>
      </li>
    </comps>
  </HediffDef>
 
#StopPluginAbuse

henk

A bit late but...

In .../Mods/Core/Defs/Drugs/DrugBases.xml look for the following lines.

 
<HediffDef Name="DrugToleranceBase" Abstract="True">
    <hediffClass>HediffWithComps</hediffClass>
    <defaultLabelColor>(179,86,132)</defaultLabelColor>
    <maxSeverity>1.0</maxSeverity>
    <scenarioCanAdd>true</scenarioCanAdd>
    <stages>
      <li>
        <minSeverity>0</minSeverity>
        <everVisible>false</everVisible>
      </li>
      <li>
        <minSeverity>0.20</minSeverity>
        <label>small</label>
      </li>
      <li>
        <minSeverity>0.50</minSeverity>
        <label>large</label>
      </li>
      <li>
        <minSeverity>0.80</minSeverity>
        <label>massive</label>
      </li>
    </stages>
  </HediffDef>


If you leave the max severity at 1.0 and change the levels for small, large, and massive to any number greater than 1.0, you effectively remove tolerance for all drugs.