# How to make make a variable grow slowly?

**URL:** <https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806>\
**Category:** Asset Creation\
**Tags:** stamina, unreal-engine, question\
**Created:** [April 12, 2021, 8:45pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806 "2021-04-12T20:45:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pancu422](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pancu422](https://forums.unrealengine.com/u/Pancu422)\
**Post date:** [April 12, 2021, 8:45pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/1 "2021-04-12T20:45:56Z")

</div>

I have for example a game with stamina and whenever I don’t use stamina it automatically goes to max but I want it to slowly rise

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 12, 2021, 9:04pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/2 "2021-04-12T21:04:00Z")

</div>

![335709-screenshot-2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/a/87a7a913c8b5ce5f6896c25a8218eff73fe232e3.jpeg)

---

<div class="post-metadata">

**Author:** ![Pancu422](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pancu422](https://forums.unrealengine.com/u/Pancu422)\
**Post date:** [April 12, 2021, 9:23pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/3 "2021-04-12T21:23:55Z")

</div>

Thank you so much i did not know about the “Clamp”

---

<div class="post-metadata">

**Author:** ![Bob3DGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bob3DGames](https://forums.unrealengine.com/u/Bob3DGames)\
**Post date:** [April 12, 2021, 9:28pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/4 "2021-04-12T21:28:59Z")

</div>

That looks sensible. One thing I might add is to pause the timer when it gets to a value of 1, and something in whatever event reduces the stamina to start the timer again. Then you don’t have to have the AddStamina event firing all the time unnecessarily when the stamina is full. You can use the ‘Pause Timer by Handle’ and ‘Unpause Timer by Handle’ nodes. The handle is the ‘Return Value’ (which would be better named ‘Handle’ if you ask me) of the timer node.

---

<div class="post-metadata">

**Author:** ![Pancu422](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pancu422](https://forums.unrealengine.com/u/Pancu422)\
**Post date:** [April 12, 2021, 9:58pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/5 "2021-04-12T21:58:16Z")

</div>

I don’t see where to put them

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 12, 2021, 10:03pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/6 "2021-04-12T22:03:59Z")

</div>

Probably in your character.

---

<div class="post-metadata">

**Author:** ![Pancu422](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pancu422](https://forums.unrealengine.com/u/Pancu422)\
**Post date:** [April 12, 2021, 10:39pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/7 "2021-04-12T22:39:58Z")

</div>

Like this?

 ![335713-image-2021-04-13-013939.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/c/0/5c0188116aa1f324492d6ac8349eba32e6c635cd.png)

---

<div class="post-metadata">

**Author:** ![Bob3DGames](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bob3DGames](https://forums.unrealengine.com/u/Bob3DGames)\
**Post date:** [April 12, 2021, 11:18pm UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/8 "2021-04-12T23:18:28Z")

</div>

At the moment, you set up the timer then immediately pause and unpause it. What you want to do is to pause the timer _when stamina gets to 1_, so where would you put the pause timer node? (Hint: you’ll need a branch).

Now, you must have an event that knocks stamina off the character, which I can see part of at the top of the image. _That_ is when you want to start charging the stamina back up, and so is where you want to unpause the timer.

I’m trying not to just give you the code because I want you to really think about the logic.

---

<div class="post-metadata">

**Author:** ![ACBYTES](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ACBYTES](https://forums.unrealengine.com/u/ACBYTES)\
**Post date:** [April 15, 2021, 8:37am UTC](https://forums.unrealengine.com/t/how-to-make-make-a-variable-grow-slowly/481806/9 "2021-04-15T08:37:38Z")

</div>

Have you thought about using “Linear Interpolation”?
