Ive been trying to do this for a while now, it works to some degree since when I crouch the stamina increase rate increases but when I uncrouch it remains the same speed of increase rate, any advice?
Here is the stamina regen part I copied and pasted
At first, as far as I understand, this blueprint will not regenerate the stamina, instead it will set it instantly to the new value after some delays.
If you want to smoothly increase a value, there are multiple ways:
- you can use
Lerp node with (“duration” / “time passed”) as the Alpha value. Then you will be able to control the increase speed by changing the duration.
- Other way is to use
FInterpTo node. In this case, you can directly set the desired increase speed.
- Use the
Timeline node. This way will allow you not just to change the increase speed (over the timeline play rate), also it will allow to use different curves for increasing, if you want to make it non-linear.
Thanks, do i connect to the crouch or event tick?
Could you perhaps go into further detail about the flnterpto one?
Depends on which way you want to.
FInterpTo should be used on Tick, since you need to update the value continuously over time.
Timeline can be used from a single-call node, but it will have a different behavior: it’s more like animation, you can start it and it will increase the value at desired speed and time. E.g. “fire and forget”. It may be okin case if player is picking up some “restore stamina” bonus or something like that, but not for the constant increase rate.
thank you, ill try my best