How can I stack hp regeneration?

I made a potion to can regen hp overtime.
But how can I make it like you drink multiple potions and regeneration by stacking effect?

atleast tell me what nodes can be used to?

I would use Actor Components for something like this. Drinking a potion spawns an effect on the player, the effects interact with the player’s health pool and eventually expire once they’re done their job.

You could then drink 10 different potions and each would have its own life cycle without having to even manage them. It’s a highly scalable system.

atleast tell me what nodes can be used to?

That would require around 50 nodes. Give or take.


by stacking effect

Stacking could mean either duration or potency of the eliksir, or perhaps both and then some more. Depending on the details of how it really works, a slightly different approach would be needed.

1 Like

Stacking hp regeneration.
For example, Potion you drink give regen 10 hp/second for 10 seconds and if you drink 2 hp potion it now gives you regen 20hp/second but depend on how fast you drink them.

If you drink 2nd hp potion 5 seconds after you drank 1st hp potion then the effect of 1st is still on you and wears off after 5 seconds

well, however your first one works, add the additional time to that when they take a second one

Depending on how far your need to takes this, here’s an idea with the above-mentioned actor components:

  • a bunch of potion effects inheriting from the base:

image

  • when we drink, a potion effect is spawned on the player (Add Component by Class):

  • the regen potion doing its thing:

You can now have any number of effects affecting the player and tracked independently, and each takes care of itself. If necessary, the player can look them up at any time:

image

Perhaps receiving a critical hit cancels regeneration and you want to get rid of active effects. You can also take it much further by creating entities containing multiple configurable effects.

Good luck!

2 Likes