Pain Medicine

Started by BukTaki, March 10, 2019, 07:55:30 PM

Previous topic - Next topic

BukTaki

I need some guidance i am making a mod that adds medicine. I want to make a painkiller i can see how pain is calculated here. https://rimworldwiki.com/wiki/Pain

What i want is an effect that reduces pain. But i am not sure were to begin i have been searching .xmls all day looking for anything that remotely looks right.Even the pain stopper defs was no help.

It seems there is no direct link to a pawns Pain hat can be accessed or modified threw the stat bases.

I think i will have to use the CompProperties
I Don't really understand what a comp proproperties is though. I See them implemented to add light add heddiff
I want to add a heddiff that reduces pain when when medicine is used during tending but i do not know what compproperties to use in. Is there a list of compproperties and how they are implemented somewhere?



BukTaki

So far i got this using the herbs as a drug but i want the hediff to be called when the herb is used during tending. Right now it only works when i command a pawn to apply it to them selves.


<?xml version="1.0" encoding="utf-8" ?>
<Defs>

<ThingCategoryDef>
    <defName>MedicalHerbs</defName>
    <label>Medical Herbs</label>
    <parent>Drugs</parent>
    <iconPath>UI/Icons/ThingCategories/Drugs</iconPath>
    <resourceReadoutRoot>true</resourceReadoutRoot>
  </ThingCategoryDef>
 
  <!--=============== Herb Base ====================-->


  <ThingDef ParentName="MakeableDrugBase" Name="HerbBase" Abstract="True">
    <thingClass>Medicine</thingClass>
    <stackLimit>750</stackLimit>
    <uiIconForStackCount>1</uiIconForStackCount>
    <soundInteract>Standard_Drop</soundInteract>
    <soundDrop>Standard_Drop</soundDrop>
<ingestible>
      <foodType>Processed, Fluid</foodType>
      <baseIngestTicks>100</baseIngestTicks>
      <ingestSound>RawMeat_Eat</ingestSound>
      <ingestCommandString>Apply {0}</ingestCommandString>
      <ingestReportString>Applying {0}.</ingestReportString>
<drugCategory>Medical</drugCategory>
<chairSearchRadius>0</chairSearchRadius>
<ingestHoldUsesTable>false</ingestHoldUsesTable>
<ingestHoldOffsetStanding>
<northDefault>
<offset>(0.18,0,0)</offset>
</northDefault>
</ingestHoldOffsetStanding>
</ingestible>
<socialPropernessMatters>false</socialPropernessMatters>
<thingCategories Inherit="false">
<li>MedicalHerbs</li>
</thingCategories>
<statBases>
      <MaxHitPoints>10</MaxHitPoints>
    </statBases>
   </ThingDef>
   
 
  <ThingDef ParentName="HerbBase">
    <defName>GreenHerb</defName>
    <label>Green Herb</label>
    <description>Green herb from plant.</description>
    <graphicData>
      <texPath>Things/Resource/Herbs/GreenHerb</texPath>
      <graphicClass>Graphic_StackCount</graphicClass>
      <drawSize>0.85</drawSize>
    </graphicData>
<techLevel>Neolithic</techLevel>
<statBases>
      <WorkToMake>450</WorkToMake>
      <MarketValue>0.8</MarketValue>
      <Mass>0.15</Mass>
      <Flammability>1.00</Flammability>
      <MedicalPotency>0.2</MedicalPotency>
      <MedicalQualityMax>0.3</MedicalQualityMax>
      <DeteriorationRate>3</DeteriorationRate>
    </statBases>
<ingestible>
<outcomeDoers>
<li Class="IngestionOutcomeDoer_GiveHediff">
<hediffDef>SoothPain</hediffDef>
<severity>0.5</severity>
</li>
</outcomeDoers>
</ingestible>
    <recipeMaker>
  <recipeUsers>
        <li>CraftingSpot</li>
        <li>DrugLab</li>
      </recipeUsers>
      <workSpeedStat>DrugCookingSpeed</workSpeedStat>
      <workSkill>Cooking</workSkill>
    </recipeMaker>
    <costList>
      <MedicineHerbal>1</MedicineHerbal>
    </costList>
<comps>
<li Class="CompProperties_Drug">
<listOrder>1505</listOrder>
<overdoseSeverityOffset>
<min>0.01</min>
<max>0.03</max>
</overdoseSeverityOffset>
</li>
</comps>
</ThingDef>

  <HediffDef>
  <defName>SoothPain</defName>
    <hediffClass>HediffWithComps</hediffClass>
    <label>SoothPain</label>
    <defaultLabelColor>(1,0,0.5)</defaultLabelColor>
    <scenarioCanAdd>true</scenarioCanAdd>
    <maxSeverity>2.0</maxSeverity>
<lethalSeverity>-1.0</lethalSeverity>
<isBad>false</isBad>
    <comps>
    <li Class="HediffCompProperties_SeverityPerDay">
        <severityPerDay>-0.95</severityPerDay>
      </li>
        </comps>
    <stages>
<li>
<lifeThreatening>false</lifeThreatening>
<painOffset>-0.10</painOffset>
</li>
     </stages>
  </HediffDef>

</Defs>

LWM

Have you found anything in the xml that CAUSES pain?

Some of the diseases, IIRC, have a pain component.

I'm thinking there may be some sort of xml-based hediff you can apply with your medicine that will have a negative number for how much pain it causes?

HTH, LWM

BukTaki

That's interesting i was able to to create a heddiff that reduces pain but you have to ingest the herbs. i just cant think of away to get a doctor to apply the heddiff when tending with the same herb.

LWM

What mechanism does anesthesia use when a doctor applies it?

At this point, you know way more about this particular topic than I do; I just hope the questions I ask are helpful ^.^

--LWM

BukTaki

Anesthetics is a recipe the cost is a piece of medicine

AileTheAlien

The closest thing to what you want is other drugs, so copy off of beer, luciferium, etc. They give the colonist a hediff, which will slowly wear off over time, and can also be addictive. The hediff will have definitions for what it modifies, in its different stages. Part of the hediff can be a reduction of pain by a flat amount like -10%, or multiplying it by something like 75%.

LWM

So it sounds like copying the Anesthetics recipe, but changing the costs of the recipe to your drug and the hediff to your hediff is where you want to go, no?