HediffDefs

Started by general222291, February 20, 2015, 03:26:29 PM

Previous topic - Next topic

general222291

Hi,

My new mod I am working on called 'Meds Galore' will add a variety of new drugs and medication to the game, but I am stuck on two important factors, the effect and the thought defs! The mod is in WIP - https://ludeon.com/forums/index.php?topic=8763.0 - if you want to check it out!

Anyway my problem is the programmed effects on the body just appears in black (in the colonist health tab) when the drug is taken, this happens for all drug stages. Also, thoughts don't appear at all.



Here are all my current def files:

NOTE - I don't actually have a way of obtaining them (unless you use dev mode and spawn them in).

HediffDefs:
Drugs_Hediffs_Drugs

<?xml version="1.0" encoding="utf-8"?>
<Defs>
  <HediffDef>
    <defName>Extract_42a</defName>
    <hediffClass>Hediff_Alcohol</hediffClass>
    <label>Extract</label>
    <naturallyHealed>false</naturallyHealed>
    <thought>Extract 42</thought>
    <defaultLabelColor>(0,0,0)</defaultLabelColor>
    <stagedProps>
      <initialSeverity>0.15</initialSeverity>
      <treatable>false</treatable>
      <severityPerDay>-0.5</severityPerDay>
      <severityStages>
        <li>
          <fromSeverity>0.1</fromSeverity>
          <label>Energized</label>
          <painFactor>0.2</painFactor>
          <modifiers>
            <actMods>
              <li>
                <activity>Moving</activity>
                <offset>0.3</offset>
              </li>
            </actMods>
          </modifiers>
        </li>
        <li>
          <fromSeverity>0.25</fromSeverity>
          <label>Zooming</label>
          <painFactor>0.3</painFactor>
          <modifiers>
            <actMods>
              <li>
                <activity>Moving</activity>
                <offset>0.5</offset>
              </li>
            </actMods>
          </modifiers>
        </li>
        <li>
          <fromSeverity>0.5</fromSeverity>
          <label>Slightly Overdosed</label>
          <painFactor>0.1</painFactor>
          <modifiers>
            <actMods>
              <li>
                <activity>Moving</activity>
                <offset>1.0</offset>
                <activity>Consciousness</activity>
                <offset>-0.10</offset>
              </li>
            </actMods>
          </modifiers>
        </li>
        <li>
          <fromSeverity>0.7</fromSeverity>
          <label>Overdosed</label>
          <painFactor>0.4</painFactor>
          <modifiers>
            <actMods>
              <li>
                <activity>Moving</activity>
                <offset>1.3</offset>
                <activity>Consciousness</activity>
                <setMax>-0.40</setMax>
              </li>
            </actMods>
          </modifiers>
        </li>
        <li>
          <fromSeverity>1</fromSeverity>
          <lable>Dangerously Overdosed</lable>
          <painFactor>0.6</painFactor>
          <modifiers>
            <actMods>
              <li>
                <activity>Moving</activity>
                <offset>1.5</offset>
                <activity>Consciousness</activity>
                <setMax>-0.50</setMax>
              </li>
            </actMods>
          </modifiers>
        </li>
      </severityStages>
    </stagedProps>
  </HediffDef>
</Defs>


This code is meant to do the following:

Energized - increase movement speed by 30% (and some pain)
Zooming - increase movement speed by 50% (and some pain)
Slightly overdosed - increase movement speed by 100% and decrease consciousness by -10% (and some pain)
Overdosed - increase movement speed by 130% and decrease consciousness by -40% (and some pain)
Dangerously overdosed - increase movement speed by 150% and decrease consciousness by -50% (and some pain)

ThingDefs:
Drugs_Items_Drugs

<?xml version="1.0" encoding="utf-8"?>
<Defs>
  <ThingDef Name="MealBase" Abstract="True">
    <eType>Item</eType>
    <label>meal</label>
    <thingClass>Meal</thingClass>
    <category>Item</category>
    <useStandardHealth>true</useStandardHealth>
    <selectable>true</selectable>
    <statBases>
      <MaxHealth>50</MaxHealth>
      <Flammability>1.0</Flammability>
    </statBases>
    <altitudeLayer>Item</altitudeLayer>
    <stackLimit>10</stackLimit>
    <tickerType>Rare</tickerType>
    <description>"Meal lacks desc."</description>
    <socialPropernessMatters>true</socialPropernessMatters>
    <thingCategories>
      <li>FoodMeals</li>
    </thingCategories>
    <alwaysHaulable>true</alwaysHaulable>
    <comps>
      <li>
        <compClass>CompForbiddable</compClass>
      </li>
    </comps>
    <pathCost>15</pathCost>
    <resourceReadoutPriority>Last</resourceReadoutPriority>
    <drawGUIOverlay>true</drawGUIOverlay>
  </ThingDef>
  <ThingDef ParentName="MealBase">
    <defName>Extract_42a</defName>
    <label>Extract 42</label>
    <description>After the plasmatic civil-war that took place in Planetary-System 67a, a gravatational weapon projected everything on that war-plagued planet into numerous different places around the universe, including this semi-illegal drug.</description>
    <graphicPath>Extract 42</graphicPath>
    <graphicClass>Graphic_Single</graphicClass>
    <rotatable>false</rotatable>
    <stackLimit>10</stackLimit>
    <statBases>
      <DeteriorationRate>0</DeteriorationRate>
      <MarketValue>55</MarketValue>
    </statBases>
    <ingestible>
      <taste>Simple</taste>
      <nutrition>1</nutrition>
      <maxNumToIngestAtOnce>1</maxNumToIngestAtOnce>
      <foodPreference>NeverForFood</foodPreference>
      <isPleasureDrug>true</isPleasureDrug>
      <hediffGivers>
        <li>
          <chance>1</chance>
          <hediffDef>Extract 42</hediffDef>
        </li>
      </hediffGivers>
    </ingestible>
  </ThingDef>
</Defs>


ThoughtDefs:
Drugs_Thought_Drugs

<?xml version="1.0" encoding="utf-8"?>
<Defs>
  <ThoughtDef>
    <defName>Extract_42a</defName>
    <stages>
      <li>
        <label>Extract 42-hidden</label>
        <description>Invisible.</description>
        <baseMoodEffect>0</baseMoodEffect>
        <visible>false</visible>
      </li>
      <li>
        <label>Energized</label>
        <description>I feel like doing some exercise.</description>
        <baseMoodEffect>10</baseMoodEffect>
      </li>
      <li>
        <label>Zooming</label>
        <description>My legs! My body! I feel like an athlete!</description>
        <baseMoodEffect>30</baseMoodEffect>
      </li>
      <li>
        <label>Slightly Overdosed</label>
        <description>I could do 40 laps around this planet!! This is insane!</description>
        <baseMoodEffect>40</baseMoodEffect>
      </li>
      <li>
        <label>Overdosed</label>
        <description>M-my head ca-n't k-keep up with m-my m-ou-th...</description>
        <baseMoodEffect>-20</baseMoodEffect>
      </li>
      <li>
        <lable>Dangerously Overdosed</lable>
        <description>I-I feel s-cared... He-lp meee.</description>
        <baseMoodEffect>-35</baseMoodEffect>
      </li>
    </stages>
  </ThoughtDef>
</Defs>


I think its clear what the mood effect is but it just doesn't show up in the colonists thought when taken.

Corrections would be HUGELY appreciated on how to get this mod working and get it released in its early stages, I'm trying my best :)
Mods:
Wandering Caravans [A15]

general222291

Mods:
Wandering Caravans [A15]

Alistaire

<defaultLabelColor>(2,0,2)</defaultLabelColor>

Means the text is RGB:002000002, which is almost full black. (255,0,0) would make it full red, (0,255,0) full green etc etc.

general222291

Thanks, but I may not of made this clear, the code has no effect on the body at all!
Mods:
Wandering Caravans [A15]

blaze7736

general maby downlode my mod or Itchys and look at how they work to effect the people, also about the text thoughts go in the thoughts area, and health effects go in the health area so they wont be together but in different tabs on your colonists.

ItchyFlea

#5
Quote from: general223 on February 20, 2015, 03:28:11 PM
It posted twice????
Removed the dupe for you. :)

I would recommend removing the spaces from the defname fields. That might be why things are working quite right. Use underscores instead.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

general222291

Well, thanks to everyone for their suggestions to far, they are much appreciated since this is my first mod I have ever created, I know I may have done a lot of things wrong, and it may have glitches and incompatibility issues, but I will try.

(I also updated the codes according to the changes and help I received, the debug list may also help below)

Debug log:


XML error: <label>Dangerously Overdosed</lable> doesn't correspond to any field in type ThoughtStage. (yellow)

XML Verse.HediffActivityModifier defines the same field twice: activity. Whole XML: (red)

XML Verse.HediffActivityModifier defines the same field twice: offset. Whole XML: (red)

XML Verse.HediffActivityModifier defines the same field twice: activity. Whole XML: (red)

XML error: <label>Dangerously Overdosed</lable> doesn't correspond to any field in type HediffSeverityStage. (yellow)

XML Verse.HediffActivityModifier defines the same field twice: activity. Whole XML: (red)

Could not resolve cross-reference: No RimWorld.ThoughtDef named Extract 42 found to give to Verse.HediffDef Extract 42a (red)

Could not resolve cross-reference: No Verse.HediffDef named Extract 42 found to give to RimWorld.IngestibleHediffGiver Rimworld.IngerstibleHediffGiver (red)

Cannot call ItemFromXMLFile with resolveCrossRefs=true while loading is already in progress. (red)

Could not resolve cross-reference: No RimWorld.ThoughtDef named Extract 42 found to give to Verse.HediffDef Extract 42a (red)

Could not resolve cross-reference: No Verse.HediffDef named Extract 42 found to give to RimWorld.IngestibleHediffGiver Rimworld.IngerstibleHediffGiver (red)

Cannot call ItemFromXMLFile with resolveCrossRefs=true while loading is already in progress. (red)

Could not resolve cross-reference: No RimWorld.ThoughtDef named Extract 42 found to give to Verse.HediffDef Extract 42a (red)

Could not resolve cross-reference: No Verse.HediffDef named Extract 42 found to give to RimWorld.IngestibleHediffGiver Rimworld.IngerstibleHediffGiver (red)

Cannot call ItemFromXMLFile with resolveCrossRefs=true while loading is already in progress. (red)


I have tried to solve some of these myself, but have failed, I am not trying to make u guys slaves :P I am just inexperienced!

Mods:
Wandering Caravans [A15]