Recovery time process

I have a stats system with health, hunger, thirst and afflictions, those afflictions have all the necessary variables and an array of treatments that the affliction may need. One of these treatments is a variable that I call “Time to recovery” if it is something like “Headache” that can go away over time. How could I take the current time (ingame) and decrease this variable to finally cure the “Headache” affliction? Remembering that I may have other afflictions already in progress, so what would be better? Make timers? An array in a timer that decreases each one that is available? Ideas?

Hey @Vinicius_Pires!

Yeah, I’d say “Set Timer By Function”!

You can use the key off of that function to also end said timer when you use a curative method, as well. :slight_smile:

Another benefit here is by using a timer you’re not tying anything to the game speed.

Hope this helps!

1 Like

Do you already have two data types for afflictions? One defining an affliction (all the stats you mentioned) and an instance type that your character has (when afflicted, in a array maybe) that references the affliction type?

This would seem to be the most lightweight setup, and in this case you could simply calculate the cure time up front (when afflicted) and store it in the instance type on the character.

Something along the lines of:

1 Like

Thank you very much for the answer! This idea is very good and fits well in my codes. But instead of using event tick, it would be good to use timer by function name as @Mind-Brain mentioned. Your two ideas complement each other very well! Thank you very much for your help, guys.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.