ID:272725
 
Hi there, I am trying to make a Fatigue system. What happens is the more fatigue you have the less you can regenerate to your max hp. For example, you have:

500/500 Hp/MaxHp
0% Fatigue

but now lets say you get 5% fatigue, you can longer regenerate to your max hp.

490/500 Hp/MaxHp
5% Fatigue

You can regenerate fully because of your fatigue, if anyone could help me out here that would be great.

I can't quite tell exactly what you want, but here are the two interpretations I got from it.

If you want it so that the more fatigue you have, the lower your "soft" max hp is, it would be pretty trivial to add if you already have your basic HP regeneration system implemented. All you would have to do would be to cap it off depending on how much of their HP you want to reduce based on their fatigue. In your example there, it looks like 5% fatigue reduces your max by 2%, so each % of fatigue would be 0.4% of their hp, but I'll just assume it's a 1:1 ratio.
mob.hp += [whatever the regen rate is]
mob.hp = min(mob.maxhp, mob.maxhp*(1 - mob.fatigue/100))

You could also stop the regen proc before it does anything, using an if, but I figured this would kill 2 birds with one stone (keeping hp <= maxhp).

If you want to make it so that fatigue reduces the amount of HP that is regenerated (you regain health slower), then it's just as simple as modifying that number in your regen proc...