Help needed - Applying a new status once another status reaches 100%

Started by Menoske, July 11, 2019, 12:44:11 PM

Previous topic - Next topic

Menoske

I'm building a mod and have most of it working, but I'd like to add a new status with a graphic onto the pawn once another status reaches 100%.  So right now I've added a Cryo-Gun into the game that applies a "Cryo-Freezing" HeDiff to the target based on the infection base type.  I'm trying to get the mod to apply a Frozen status once Cryo-Freezing reaches 100% and apply an iceblock graphic to the pawn once Frozen has been applied.

I have the Frozen Hediff and Cryo-Freezing Hediffs created in xml, and the gun applies the Cryo-Freezing Hediff just fine, I just can't seem to figure out how to apply the Frozen Hediff and the graphic once the conditions are met.

Any help or direction would be appreciated.

K

You'll probably need some C# to do this. The easiest way would probably be to create a custom HediffComp that checks for the right conditions each tick and applies the new Hediff when the conditions are met. If you've based your Hediffs off of the InfectionBase def, then they already have the HediffWithComps class and you could easily add the new comp once you made it.

It might also end up that a HediffComp doesn't give you enough control over the behavior, and in that case you could also create a custom Hediff. There are several vanilla examples of this you could look at, like the Hediff_Injury class.