Problem with injesting new drink?

Started by Jdalt40, August 05, 2016, 08:17:18 PM

Previous topic - Next topic

Jdalt40

For my Vampire mod I created a drink called a 'blood bottle' and when one of my colonists consumed it this error happened:JobDriver threw exception in initAction. Pawn=Roberson, Job=Ingest A=Thing_BloodBottle60745, Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: type
  at System.Activator.CheckType (System.Type type) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
  at Verse.HediffWithComps.InitializeComps () [0x00000] in <filename unknown>:0
  at Verse.HediffWithComps.PostMake () [0x00000] in <filename unknown>:0
  at Verse.HediffMaker.MakeHediff (Verse.HediffDef def, Verse.Pawn pawn, Verse.BodyPartRecord partRecord) [0x00000] in <filename unknown>:0
  at Verse.Pawn_HealthTracker.AddHediff (Verse.HediffDef def, Verse.BodyPartRecord part, Nullable`1 dinfo) [0x00000] in <filename unknown>:0
  at RimWorld.IngestibleHediffGiver.CheckGiveHediff (Verse.Pawn pawn, Verse.Thing ingested) [0x00000] in <filename unknown>:0
  at Verse.Thing.Ingested (Verse.Pawn ingester, Single nutritionWanted) [0x00000] in <filename unknown>:0
  at RimWorld.Toils_Ingest+<FinalizeIngest>c__AnonStorey200.<>m__E1 () [0x00000] in <filename unknown>:0
  at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Received packet from server: PhiClient.ChatMessagePacket

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Received packet from server: PhiClient.UserConnectedPacket

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Received packet from server: PhiClient.UserConnectedPacket

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Received packet from server: PhiClient.ChatMessagePacket

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Received packet from server: PhiClient.ChatMessagePacket

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

JobDriver threw exception in initAction. Pawn=Roberson, Job=Ingest A=Thing_BloodBottle60745, Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: type
  at System.Activator.CheckType (System.Type type) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
  at Verse.HediffWithComps.InitializeComps () [0x00000] in <filename unknown>:0
  at Verse.HediffWithComps.PostMake () [0x00000] in <filename unknown>:0
  at Verse.HediffMaker.MakeHediff (Verse.HediffDef def, Verse.Pawn pawn, Verse.BodyPartRecord partRecord) [0x00000] in <filename unknown>:0
  at Verse.Pawn_HealthTracker.AddHediff (Verse.HediffDef def, Verse.BodyPartRecord part, Nullable`1 dinfo) [0x00000] in <filename unknown>:0
  at RimWorld.IngestibleHediffGiver.CheckGiveHediff (Verse.Pawn pawn, Verse.Thing ingested) [0x00000] in <filename unknown>:0
  at Verse.Thing.Ingested (Verse.Pawn ingester, Single nutritionWanted) [0x00000] in <filename unknown>:0
  at RimWorld.Toils_Ingest+<FinalizeIngest>c__AnonStorey200.<>m__E1 () [0x00000] in <filename unknown>:0
  at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x00000] in <filename unknown>:0


I really don't know which def to show so I will post the mod up here so people can try to see what is going on. Please help me!


[attachment deleted by admin - too old]

CallMeDio

I looked it for some time now and there are 2 things, one is that you added in the thingdef of bloodbottle

<comps>
      <li>
        <compClass>CompEquippable</compClass>
      </li>
    </comps>


but did not said the stats for the equipped item should be something like:

<comps>
      <li>
        <compClass>CompEquippable</compClass>
      </li>
    </comps>
    <verbs>
      <li>
        <verbClass>Verb_MeleeAttack</verbClass>
        <hasStandardCommand>true</hasStandardCommand>
        <meleeDamageDef>Blunt</meleeDamageDef>
      </li>
    </verbs>


And the other: there is something wrong in your hediff Immunization. I couldn't figure what, but i could make the error stop by adding the part I mentioned on the thingdef and deleting the heddif Immunization and changing the heddif of the bloodbottle to Hangover so what is left to figure out is there on the Immunization and only there, it can be one problem or more.

QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died

Jdalt40

I kinda fixed it, now people get the Hediff when consuming it but the item gives no nutrition for some reason... And it still gives the same error :/

Jdalt40

And on another note, changing the HediffComp to Alcohol makes it so it goes on to the Hediff Hangover, is there anyway I could stop this from happening?

CallMeDio

#4
It would need some C#, but I think you can avoid that and reach what you are looking for by changing some hediffs from diseases, this one looks good to me:

<HediffDef Abstract="True" ParentName="InfectionBase" Name="MechanitesBase">
    <hediffClass>HediffWithComps</hediffClass>
    <makesSickThought>true</makesSickThought>
    <makesAlert>false</makesAlert>


    <comps>
      <li>
        <compClass>HediffComp_Disappears</compClass>
        <disappearsAfterTicks>
          <min>900000</min>
          <max>1800000</max>
        </disappearsAfterTicks>
      </li>
      <li>
        <compClass>HediffComp_Tendable</compClass>
        <tendDuration>120000</tendDuration>
      </li>
      <li>
        <compClass>HediffComp_Immunizable</compClass>
        <severityPerDayNotImmune>0.25</severityPerDayNotImmune>
        <severityPerDayTendedOffset>-1.0</severityPerDayTendedOffset>
        <minSeverity>0.001</minSeverity>
        <maxSeverity>1</maxSeverity>
      </li>
    </comps>
  </HediffDef>
 



  <HediffDef ParentName="MechanitesBase">
    <defName>FibrousMechanites</defName>
    <label>fibrous mechanites</label>
    <stages>
      <li>
        <painOffset>0.2</painOffset>
        <label>mild pain</label>
        <restFallFactor>1.7</restFallFactor>
        <capMods>
          <li>
            <capacity>Manipulation</capacity>
            <offset>0.5</offset>
          </li>
          <li>
            <capacity>Moving</capacity>
            <offset>0.5</offset>
          </li>
          <li>
            <capacity>BloodPumping</capacity>
            <offset>0.5</offset>
          </li>
        </capMods>
      </li>
      <li>
        <minSeverity>0.5</minSeverity>
        <label>intense pain</label>
        <painOffset>0.6</painOffset>
        <restFallFactor>2.0</restFallFactor>
        <capMods>
          <li>
            <capacity>Manipulation</capacity>
            <offset>0.5</offset>
          </li>
          <li>
            <capacity>Moving</capacity>
            <offset>0.5</offset>
          </li>
          <li>
            <capacity>BloodPumping</capacity>
            <offset>0.5</offset>
          </li>
        </capMods>
      </li>
    </stages>
  </HediffDef>



The one with the abstract = true above is the a definition, this means that any hediff you make with <HediffDef ParentName="MechanitesBase"> in the beggining is going to automatically get the things that are there in the abstract (sorry if you already know this),
you can change the name from MechanitesBase to whatever you like and mess with or remove the hediffcomp_disappears and the hediffcomp_tendable. Just keep in mind that the definition of this MechanitesBase have infection_base as parent, so to change things such as label color and makesickthought you will have to make your copy of this mechanite base stuff ,remove the parent name infection_base and copy the stuff from infection base to there and change it.
I hope this is not too confuse to be interpretated.

Edit:If you saw my other edit before this one forget it,
QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died

Jdalt40

But wouldn't this make the drink not build up the severity? Just wondering since I have absolutely no info about how Hediffs and items giving Hediffs work :D

CallMeDio

Not really sure if applying the disease multiple times would to this or not, but my guess is that it would build up severity like a malaria or infection instead of beer (without drinking more)
QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died

CallMeDio

Give it a try, will only take some mins, if it don't work and you still want to do this read the tutorials on the wiki about setting up a solution and decompiling .dll, you would probably need to copy the cs file containing the alcohol and make yours with other class name that don't point out to the hangover, compile it in a .dll, add to your mod Assemblies folder and point it out on your xmls.
QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died

Jdalt40

Yeah, thanks for your help! :)
My internet is just really bad at the moment so I had no time to set up my computer to be able to decompile stuff, thanks anyways :)

CallMeDio

But only go for the C# if the diseases and other types of hediff can't do what you want, try some other things you can do in xml first to see if it does the trick. That is, if you want to avoid the C#, if you don't want to avoid and have interest in it do like Shia LaBeouf says and "Just Do It!".  ;)
QuoteYou may need a rubber duck.  Also, try some caveman debugging.

Released mods: No Mood Loss on Prisoner Sold or Died