Give a Hediff to a pawn on spawn

Started by Kellion, July 21, 2019, 07:07:23 PM

Previous topic - Next topic

Kellion

Greetings fine folks of the Ludeon Forums. I've worked hard behind the scenes developing a rather large mod, but one of the bits requires me to add a specific Hediff that I created to a pawn when it spawns.

It's rather necessary because it gives all sorts of nice things to it like pain immunity plus immunity to a ton of diseases, oh and it would last pretty much forever.

I got that bit to work, but the part that betrays me is the actual addition. I cannot reliably add the Hediff to that one race of pawns whenever they spawn, and I must admit that after much googling, I am stumped.


So I ask of you, more experienced mod developers to come to my aid and help bring this mod ever closer to release...!
...By telling me how to do it :)

TL DR: "Dude spawns" -> "Spawns with Hediff/Gets Hediff added instantly"

Have a fine day!

Kellion

Well since nobody bothered to put down their two cents, here's the way I figured out how to do it:

You will need JecsTools as a dependency.

Now create your own HediffGiverSet, and in the hediff givers use this class:


<li Class="JecsTools.HediffGiver_StartWithHediff">
   <hediff>YourHediff</hediff>
</li>


There we go. There's probably more ways to do it this but this is as straightforward as I could figure out.

Have a fine day :D

LWM

I suspect that if Jecstools has a specific function to do that, then it needs to be done via C#, so if you don't want to write it yourself, you may have found the best - perhaps only - solution!

--LWM