Making new pheromone Drugs - But require assistance

Started by Jiruharudo, April 24, 2020, 01:01:28 PM

Previous topic - Next topic

Jiruharudo

Hey guys, I'm new here, so I hope I read the "read first" correctly and didn't post this on the wrong place..

Anyhoo, I just made a tiny mod for personal use, a cool animal monster that I really liked, and now I was inspired to make something else;

A Drug that at first make you part of the "insect class" so the megaspiders and their family will ignore you, allowing you to walk among them without retribution.

- On the High insects will ignore pawn (you get the insect parent template in the code below)
- On the tolerance (or addiction..?) the pawn becomes more insect like with chitin etc
- With Addiction your pawn becomes an insect hybrid with natual weapons, armor and digging speed
- If the addiction is unmet though, the pawn becomes even MORE powerful but will become Wildman, and will basically be a insect now and leave your colony (and may attack your colonist like insects would if they are hungry)

I thought I could make a pawn inherit the following code all insects have as a parent so it'll be part of their "faction":   <ThingDef Abstract="True" ParentName="AnimalThingBase" Name="BaseInsect">
    <statBases>
      <ToxicSensitivity>0</ToxicSensitivity>
      <ComfyTemperatureMax>60</ComfyTemperatureMax>
    </statBases>
    <race>
      <fleshType>Insectoid</fleshType>
      <bloodDef>Filth_BloodInsect</bloodDef>
      <meatColor>(160,168,139)</meatColor>
      <meatMarketValue>0.5</meatMarketValue>
      <foodType>OmnivoreAnimal, AnimalProduct</foodType>
      <manhunterOnDamageChance>0.35</manhunterOnDamageChance>
      <manhunterOnTameFailChance>0.20</manhunterOnTameFailChance>
    </race>
  </ThingDef>


But I'm having trouble adding this to a pawn, and I'll admit I'm new to the programming business, how to I make this work?

My code: <?xml version="1.0" encoding="utf-8" ?>
<Defs>
 
  <ThingDef ParentName="MakeableDrugBase">
    <defName>BugDrug</defName>
    <label>Insect Pheromones</label>
    <description>This is a test.\n\nMake interesting text plz</description>
<descriptionHyperlinks>
      <HediffDef>PheromonesHigh</HediffDef>
      <HediffDef>PheromonesTolerance</HediffDef>
      <HediffDef>PheromonesAddiction</HediffDef>
    </descriptionHyperlinks>
    <tradeability>Sellable</tradeability>
    <socialPropernessMatters>true</socialPropernessMatters>
<tickerType>Rare</tickerType>

    <graphicData>
  <texPath>Things/Item/Drug/BugDrug</texPath>
  <graphicClass>Graphic_StackCount</graphicClass>
    </graphicData>
   
    <statBases>
      <MarketValue>15</MarketValue>
      <Mass>0.1</Mass>
      <DeteriorationRate>4</DeteriorationRate>
  <Nutrition>0.1</Nutrition>
    </statBases>
    <techLevel>Ultra</techLevel>


    <ingestible>
      <baseIngestTicks>100</baseIngestTicks>
      <chairSearchRadius>4</chairSearchRadius>
      <preferability>DesperateOnly</preferability>
      <tasteThought></tasteThought>
      <foodType>AnimalProduct</foodType>



      <nurseable>true</nurseable>
      <drugCategory>Hard</drugCategory>
      <outcomeDoers>
        <li Class="IngestionOutcomeDoer_GiveHediff">
          <hediffDef>PheromonesHigh</hediffDef>
          <severity>1.00</severity>
          <toleranceChemical>Pheromones</toleranceChemical>
        </li>
        <li Class="IngestionOutcomeDoer_GiveHediff">
          <hediffDef>PheromonesTolerance</hediffDef>
          <severity>0.032</severity>
          <divideByBodySize>true</divideByBodySize>
        </li>
      </outcomeDoers>
    </ingestible>



    <comps>
      <li Class="CompProperties_Drug">
        <chemical>Pheromones</chemical>
        <addictiveness>0.010</addictiveness>
        <minToleranceToAddict>0.15</minToleranceToAddict>
        <existingAddictionSeverityOffset>0.1</existingAddictionSeverityOffset>
        <needLevelOffset>1</needLevelOffset>
        <listOrder>30</listOrder>
      </li>
    </comps>
  </ThingDef>

  <HediffDef>
    <defName>PheromonesHigh</defName>
    <label>Emitting Pheromones</label>
    <description>Emitting insect pheromones, causing insects to leave you alone. Also turns your blood the same green as theirs ..probably wise not to take too many of these..</description>
    <hediffClass>HediffWithComps</hediffClass>
    <defaultLabelColor>(1,0,0.5)</defaultLabelColor>
    <scenarioCanAdd>true</scenarioCanAdd>
    <maxSeverity>1.0</maxSeverity>
    <isBad>false</isBad>
    <comps>
      <li Class="HediffCompProperties_SeverityPerDay">
        <severityPerDay>-1.0</severityPerDay>
      </li>
    </comps>

<!-- Effects here -->

    <stages>
        <li>
          <painFactor>0.1</painFactor>
          <capMods>
            <li>
              <capacity>Consciousness</capacity>
              <offset>0.70</offset>
            </li>
          </capMods>
        </li>
      </stages>
  </HediffDef>

  <!-- Pawn thoughs -->
 
  <ThoughtDef>
    <defName>PheromonesHigh</defName>
    <workerClass>ThoughtWorker_Hediff</workerClass>
    <hediff>PheromonesHigh</hediff>
    <validWhileDespawned>true</validWhileDespawned>
    <stages>
      <li>
        <label>Emitting Pheromones</label>
        <description>The insects should leave me be now. I feel accepted by them.</description>
        <baseMoodEffect>5</baseMoodEffect>
      </li>
    </stages>
  </ThoughtDef>

  <!-- Addiction -->
 
  <ChemicalDef>
    <defName>Pheromones</defName>
    <label>Pheromones</label>
    <addictionHediff>PheromonesAddiction</addictionHediff>
    <toleranceHediff>PheromonesTolerance</toleranceHediff>
    <onGeneratedAddictedToleranceChance>0.8</onGeneratedAddictedToleranceChance>
  </ChemicalDef>
 
   <!-- The need that happens when the pawn is addicted -->
 
  <NeedDef ParentName="DrugAddictionNeedBase">
    <defName>Chemical_Pheromones</defName>
    <needClass>Need_Chemical</needClass>
    <label>Pheromones</label>
    <description>Because of an ambrosia addiction, this person needs to regularly consume ambrosia to avoid withdrawal symptoms.</description>
    <listPriority>20</listPriority>
  </NeedDef>

  <HediffDef ParentName="DrugToleranceBase">
    <defName>PheromonesTolerance</defName>
    <label>pheromone tolerance</label>
    <description>A built-up tolerance to ambrosia. The more severe this tolerance is, the more ambrosia it takes to get the same effect.</description>
    <comps>
      <li Class="HediffCompProperties_SeverityPerDay">
        <severityPerDay>-0.020</severityPerDay>
      </li>
      <li Class="HediffCompProperties_DrugEffectFactor">
        <chemical>Pheromones</chemical>
      </li>
    </comps>
<!-- Effects here Tolerance, slowly gives more insect traits -->
    <stages>
<!-- For some reason it doesnt reconise natural healing dactor ..not sure why
   <li>
        <naturalHealingFactor>1.5</naturalHealingFactor>
      </li>
  -->
      <li>

        <statOffsets>
          <ArmorRating_Sharp>0.35</ArmorRating_Sharp>
          <ArmorRating_Blunt>0.1</ArmorRating_Blunt>
          <ArmorRating_Heat>0.3</ArmorRating_Heat>
        </statOffsets>
      </li>
    </stages>
    <tags><li>Chitin</li></tags> <!-- Not sure what this does.. -->

  </HediffDef>
 
      <!-- Pawn thoughs -->
 
  <ThoughtDef>
    <defName>PheromonesTolerance</defName>
    <workerClass>ThoughtWorker_Hediff</workerClass>
    <hediff>PheromonesTolerance</hediff>
    <validWhileDespawned>true</validWhileDespawned>
    <stages>
      <li>
        <visible>false</visible>
      </li>
      <li>
        <label>pheromone tolerance</label>
        <description>I may have overdone it with the pheromones, but I can't let them eat me..</description>
        <baseMoodEffect>-3</baseMoodEffect>
      </li>
    </stages>
  </ThoughtDef>
 
 
  <HediffDef ParentName="AddictionBase">
    <defName>PheromonesAddiction</defName>
    <label>pheromone addiction</label>
    <description>A chemical addiction to ambrosia. Long-term presence of ambrosia has caused neurological adaptations at the cellular level, so the brain can no longer function properly without the drug.
\nWithout regular doses of ambrosia, withdrawal symptoms will begin. However, extended abstinence will force the brain to adapt back to its normal state, resolving the addiction.</description>
    <hediffClass>Hediff_Addiction</hediffClass>
    <causesNeed>Chemical_Pheromones</causesNeed>
    <comps>
      <li Class="HediffCompProperties_SeverityPerDay">
        <severityPerDay>-0.10</severityPerDay>
      </li>
    </comps>
    <stages>
      <li> 
      </li>
      <li> <!-- First <li> opener for statchanges etc turns you even more buglike and pwoerfull, but pawn will leave and attack your colony and serve the HIVE-->
 
        <label>withdrawal</label>
  <capMods>
          <li>
            <capacity>Consciousness</capacity>
            <offset>0.10</offset>
          </li>
          <!--
  <li>
            <capacity>Moving</capacity>
            <offset>0.05</offset>
          </li>
          <li>
            <capacity>Sight</capacity>
            <offset>0.15</offset>
          </li>
          <li>
            <capacity>BloodFiltration</capacity>
            <offset>0.70</offset>
          </li>
          <li>
            <capacity>BloodPumping</capacity>
            <offset>0.15</offset>
          </li>
           <li>
            <capacity>Metabolism</capacity>
            <offset>0.20</offset>
          </li>
          <li>
            <capacity>Breathing</capacity>
            <offset>0.10</offset>
          </li>
  -->
        </capMods>
  <mentalStateGivers>
          <li>
            <mentalState>Berserk</mentalState> <!-- Actually want this to be "RunWild", but for some reason that doesnt work here.. -->
            <mtbDays>0.4</mtbDays>
          </li>
        </mentalStateGivers>
      </li>
 
    </stages>
  </HediffDef>


    <!-- Pawn thoughs -->
 
  <ThoughtDef>
    <defName>PheromoneWithdrawal</defName>
    <workerClass>ThoughtWorker_Hediff</workerClass>
    <hediff>PheromonesAddiction</hediff>
    <validWhileDespawned>true</validWhileDespawned>
    <stages>
      <li>
        <visible>false</visible>
      </li>
      <li>

        <label>pheromone withdrawal</label>
        <description>Something is calling me.. I must serve</description>
      </li>
    </stages>
  </ThoughtDef>

</Defs>


I would really like to learn more about coding, and this seems like a fun motivator, any help would be greatly appreciated!

I hope my Quote lines make sense :)

dcrookston

I don't think making the pawn into an insect type will prevent the bugs from attacking it.  My guess (I'm pretty new to this) is that they decide what to attack based on faction, and probably insects are part of the wild animal faction.  I've seen wild men walk around in an insect cave and be ignored.

So you'd probably want to patch insects (and ONLY insects!) so that when they consider whether to attack something, having the pheromone drug active makes it return "not attackable."

Unfortunately I'm still really new to modding so I can't give you more direction than this.

Jiruharudo

Hey dcrookston!

No matter your experience, I appreciate your willingness to help out! You are likely right about the faction thing..

Ill try and figure out where the whole faction related info is kept. Maybe I should check the mod better infestations (because I love it) but I already saw that most of it is C+ written, which is at least a level higher then I comprehend atm

Do you think all the other effects of the insect parent apply though? Because I would actually like them to have green blood and such as part of the subtle transformation for instance :)

Jiruharudo