(solved) baseMoodEffect over time?

Started by AileTheAlien, July 12, 2018, 10:48:09 PM

Previous topic - Next topic

AileTheAlien

I'm trying to make a new drug, which has different moods at different times. Most drugs just have single stage, and thus a single baseMoodEffect, but beer has multiple stages. However, it looks like there's four stages in beer's ThoughtDef, but only three stages of beer's HediffDef? How does that work? Is one of them just not used in the game?

Basically, my stages will be roughly:
- 6 hours of good thought, and combat enhancement
- 6 hours of terrible thought, and chance of heart attack
- 12 hours of mildly bad thought, and reduced work speed

If I just make three stages for thoughts, do they get lined up with the three stages I've defined for the high (hediff)? Or is there some way to explicitly set what severity applies for which thought levels?

Everything else, it looks like I can copy off of the other drugs, cancer, toxic buildup, etc. Thanks!

EDIT:
Hmm. Beer actually has a "hangover" with several stages in addition to the "high" stages, which complicates this, although might also make it better to copy off of...

AileTheAlien

Does anyone know how beer works? I can't actually figure it out, since there's 4 moods for being drunk, but 5 stages of drunkenness, and 3 moods for hangover, but 4 stages of hangover. It might be related to the <severityIndices>, but those go from 3 to 5?

Karthas077

Short perusal of the code: If there are fewer mood stages than Hediff stages, it will continue using the last mood for an extra stage. For the Inebriated ThoughtDef this means the hammered stage is used during the blackout stage. For Hungover, (which actually has 4 moods but only 3 stages), the extra mood appears to go entirely unused, but might be a holdover from a different way of making the thought invisible until AlcoholHigh faded?

If short, if you just make the number of mood stages match the Hediff stages, it should work out.

AileTheAlien

What about the hangover and high happening at different times? There's a comment saying that's the reason for a certain hard-coded threshold, but I don't know how they interact. Do they both just get applied at the same time, and then the thresholds have to be hand-calculated, for the times you want?

Karthas077

Alcohol has a specifically coded c# classes that cause AlcoholHigh to create a Hangover Hediff once it reaches the third stage, and then hide it until the AlcoholHigh one is gone. So if you want to replicate that process, you'd have to calculate how long it will take for AlcoholHigh to fall from the minSeverity of stage 3 all the way to nothing, and how much of the Hangover severity would be left at that time.