So simple question probably a complicated issue, to keep it simple i have a health stat. I want to have a poison effect that can happen that reduces health over time. thats easy enough just use a timer by event tied to a function. now the issue is how do i let the player use a potion that heals over time. I could use the same function just but if the potion or poison effect ends before the other when that function ends it would clear and invalidate the timer there fore stopping the effect of the not yet finished effect.
For numerous status effects affecting the player at the same time, consider using Actor Components. Each component is an effect, for example:
a health potion
poison damage DoT
being on fire
having no arm
possessing and using a special ability
Each component drives its own logic; we can spawn and remove those from the player (or enemy!). And any component can look up another component and affect it. If drinking a healing potion restores HP slowly but also halves the duration of the poison effect, that’d be trivial to set up.
simple question probably a complicated issue
This scales and maintains well in the long run and should be enough for you & me. For the extreme case scenarios, there is:
you know ill be honest i didn’t even think of spawning actor components. I mean I’m using them for the stat manager and inventory system but i didn’t think of spawning them for stat modifications like that. its such a simple solution. thank you very much for the help.