Ludeon Forums

Ludeon Forums

  • October 24, 2021, 01:29:44 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: (solved) baseMoodEffect over time?  (Read 696 times)

AileTheAlien

  • Colonist
  • ***
  • Posts: 751
  • Refugee
    • View Profile
(solved) baseMoodEffect over time?
« on: July 12, 2018, 10:48:09 PM »

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...
« Last Edit: July 31, 2018, 08:52:43 AM by AileTheAlien »
Logged

AileTheAlien

  • Colonist
  • ***
  • Posts: 751
  • Refugee
    • View Profile
Re: baseMoodEffect over time?
« Reply #1 on: July 13, 2018, 09:40:54 AM »

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?
Logged

Karthas077

  • Drifter
  • **
  • Posts: 27
  • Muffalo in disguise
    • View Profile
Re: baseMoodEffect over time?
« Reply #2 on: July 13, 2018, 04:47:58 PM »

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.
Logged

AileTheAlien

  • Colonist
  • ***
  • Posts: 751
  • Refugee
    • View Profile
Re: baseMoodEffect over time?
« Reply #3 on: July 13, 2018, 08:07:52 PM »

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?
Logged

Karthas077

  • Drifter
  • **
  • Posts: 27
  • Muffalo in disguise
    • View Profile
Re: baseMoodEffect over time?
« Reply #4 on: July 14, 2018, 03:05:39 AM »

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.
Logged