Drug effect - lower hunger rate?

Started by orannj, December 25, 2016, 02:49:36 PM

Previous topic - Next topic

orannj

Hey all. Trying to get an idea on how to do this.

Take drug

Drug gives effect (lower hunger rate).



Attempted to use the metabolism Hediff, but that didn't do it. I'm pretty sure I need to use <hungerRateFactor>, but I'm not sure how to link it from taking the drug to giving the effect.

Any help?

O Negative

If I'm not mistaken, metabolism only affects how quickly a pawn's sleep need is fulfilled... ::)

If you want to lower the hunger rate, altering the hungerRateFactor is the way to go. It's a multiplier, so 0.5 would half the rate at which pawns become hungry. Anything over 1.0 will increase the hunger rate :)

I played around with this when I was working on a disease mod. I've since used this in a pill to lower hunger rate of caravans :D

orannj

How did your def look? I'm having trouble getting things to run with the hunger rate modifier.

O Negative

#3
Quote from: orannj on December 25, 2016, 09:04:20 PM
How did your def look? I'm having trouble getting things to run with the hunger rate modifier.

So, you're going to have your drug, right?
I'll reference it as AppetiteSuppressant
Here we go:

<ThingDef ParentName="MakeableDrugPillBase">
    <defName>AppetiteSuppressant</defName>
    <label>Appetite Suppressant</label>
    <description>A drug that lowers the basal metabolic rate of the patient; lowering the need for food in the process.</description>
    <graphicData>
      <texPath>Things/Item/Drug/Penoxycyline</texPath>
      <graphicClass>Graphic_StackCount</graphicClass>
    </graphicData>
    <rotatable>false</rotatable>
    <statBases>
      <WorkToMake>500</WorkToMake>
      <MarketValue>32</MarketValue>
      <Mass>0.002</Mass>
    </statBases>
    <techLevel>Industrial</techLevel>
    <ingestible>
      <drugCategory>Medical</drugCategory>
      <outcomeDoers>
        <li Class="IngestionOutcomeDoer_GiveHediff">
          <hediffDef>AppetiteSuppressantHigh</hediffDef>
          <severity>1.0</severity>
        </li>
      </outcomeDoers>
    </ingestible>
    <recipeMaker>
      <recipeUsers>
        <li>DrugLab</li>
      </recipeUsers>
    </recipeMaker>
    <costList>
      <Neutroamine>1</Neutroamine>
    </costList>
    <comps>
      <li Class="CompProperties_Drug">
        <listOrder>1000</listOrder>
        <overdoseSeverityOffset>
          <min>0.08</min>
          <max>0.14</max>
        </overdoseSeverityOffset>
      </li>
    </comps>
  </ThingDef>


And then you're going to have the Hediff that it gives to your person:

<HediffDef>
    <defName>AppetiteSuppressantHigh</defName>
    <hediffClass>HediffWithComps</hediffClass>
    <label>Appetite Suppressant</label>
    <defaultLabelColor>(0,0.6,0.8)</defaultLabelColor>
    <scenarioCanAdd>true</scenarioCanAdd>
    <maxSeverity>1.0</maxSeverity>
    <comps>
      <li Class="HediffCompProperties_SeverityPerDay">
        <severityPerDay>-1.22</severityPerDay>
      </li>
    </comps>
      <stages>
        <li>
          <hungerRateFactor>0.5</hungerRateFactor>
</li>
      </stages>
  </HediffDef>





Update: Here, I'll post a working version of the mod I've made for you :)

It's really rather simple, and it works just fine. Use it in any way you wish.

[attachment deleted by admin due to age]

orannj

Thanks bud. All I needed was the Hediff reference. I didn't have it on ingestible and I wasn't referencing the right file. Thanks a bunch. :)