# How do I make my progress bar decrease with integer-based health?

**URL:** <https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058>\
**Category:** Community & Industry Discussion\
**Tags:** health, damage, float, integer, unreal-engine, question\
**Created:** [April 17, 2021, 5:37am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058 "2021-04-17T05:37:19Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 17, 2021, 7:37am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/21 "2021-04-17T07:37:22Z")

</div>

There’s no need to call this at all. We’re already setting the progress bar percent below… calling it will revert the bar to the incorrect value you had before 😑

 ![336169-screenshot-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/6/226632725ce519118c8ca4a9b4f92b6c405c1d59.png)

Besides, you’re pulling wrong value in that update (not the one after division). You can skip this completely. If you call it the way you do now, you will override the progress with this, as mentioned before.

And you can also skip setting up Enemy reference in the widget. There’s generally no need for that.

It’s much more efficient for the actor to push data into the widget.

---

<div class="post-metadata">

**Author:** ![Chief\_Man](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chief\_Man](https://forums.unrealengine.com/u/Chief_Man)\
**Post date:** [April 17, 2021, 7:44am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/22 "2021-04-17T07:44:39Z")

</div>

I still don’t understand how to do damage the way I want to. My damage takes 10% of the enemies health regardless of how much health they have. If they have 1000 then they lose 100, and if they have 100 then they lose 10. I want to do 100 damage no matter how much health the enemy has. But with floats, it’s making me do 10% of their health instead of an exact number.

I’m trying my best to understand everything you’re commenting but I’m very new to Unreal and there are a lot of things I do not know how to do, or where to add things in ☹

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 17, 2021, 8:14am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/23 "2021-04-17T08:14:15Z")

</div>

Here’s a small project that does all that:

> **[Enemywave1.zip](https://drive.google.com/file/d/1PUPVbB3lAYdn6yVs-vmITotga_ryA5qt/view?usp=sharing)**
>
> Google Drive file.

Right click deals damage. I wrapped things in functions to make it more reasonable. See if this clarifies things for you.

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/b/4/1b43b77a8a44d8e3fcdc8be1be016c8f5d0b49af.gif)](https://gyazo.com/12c6eeb8c50cf7b3f0efe5f2da6be6d3)

---

<div class="post-metadata">

**Author:** ![Chief\_Man](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chief\_Man](https://forums.unrealengine.com/u/Chief_Man)\
**Post date:** [April 17, 2021, 8:28am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/24 "2021-04-17T08:28:41Z")

</div>

Okay I’ll check it out

---

<div class="post-metadata">

**Author:** ![Chief\_Man](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chief\_Man](https://forums.unrealengine.com/u/Chief_Man)\
**Post date:** [April 17, 2021, 8:40am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/25 "2021-04-17T08:40:09Z")

</div>

Yeah that’s perfect! Now I can change the amount of damage that the player does, and the amount of health that an enemy has 🙂 Thank you!!

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 17, 2021, 8:44am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/26 "2021-04-17T08:44:51Z")

</div>

Wicked! Thanks for the update and good luck with the rest.

---

<div class="post-metadata">

**Author:** ![Chief\_Man](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chief\_Man](https://forums.unrealengine.com/u/Chief_Man)\
**Post date:** [April 17, 2021, 8:47am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/27 "2021-04-17T08:47:17Z")

</div>

I’ll try adding it into my own project tomorrow. It’s 2AM here and I’m getting tired.

---

<div class="post-metadata">

**Author:** ![Chief\_Man](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chief\_Man](https://forums.unrealengine.com/u/Chief_Man)\
**Post date:** [April 18, 2021, 7:43am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/28 "2021-04-18T07:43:21Z")

</div>

I just finished adding everything to my project and it’s working nicely. Thank you so much for the help! There was no way I was gonna figure this out on my own.

---

<div class="post-metadata">

**Author:** ![Chief\_Man](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chief\_Man](https://forums.unrealengine.com/u/Chief_Man)\
**Post date:** [April 18, 2021, 8:28am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/29 "2021-04-18T08:28:41Z")

</div>

Do you know how I could change the text widget on the health bar so that it displays the health in numbers rather than a percent? (For example, 750/1000 instead of 75%)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 18, 2021, 9:12am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/30 "2021-04-18T09:12:58Z")

</div>

No worries. Glad to hear you got it to work as you needed.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 18, 2021, 9:41am UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/31 "2021-04-18T09:41:12Z")

</div>

Sending it again as I misread your message:

- have the Calculate function format value as text, and return both:

 ![336289-01.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/1/ab1e75658db0f6f736d727b85d35f0be90c9a9da.png)

![336290-format.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/d/bddc9fcc8fcba6f2c454e78f08fcccf8f929391e.png)

- send both values to the widget:

 ![336291-02.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/0/1/f0128136eb24028128e8f8faa5bc68902d9d19ac.jpeg)

- widget receiving that data:

 ![336292-03.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/0/1/2010b487022117b94eccef6f1cfce9d3aac65d9e.png)

* * *

[![Image from Gyazo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/b/c/ebcac8f8b8eb16d3ebbf81ba15f180de09280f43.gif)](https://gyazo.com/f009a66fa2085c0de110acec7991bf05)

There are many ways of setting it up, just following on the logic that was suggested before.

---

<div class="post-metadata">

**Author:** ![Chief\_Man](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chief\_Man](https://forums.unrealengine.com/u/Chief_Man)\
**Post date:** [April 18, 2021, 7:27pm UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/32 "2021-04-18T19:27:12Z")

</div>

I will try this out and let you know how it goes. Although, I do have one question. Why do I input 1 and 324 for the minimum and maximum integral digits? What do those specific numbers do?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 18, 2021, 7:58pm UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/33 "2021-04-18T19:58:03Z")

</div>

These are the default values and can be left as are - number of whole digits to display. If you set the first one to 3, you’ll see 001 instead of just 1.

Max fractional should be 0 unless you want see values after comma.

---

<div class="post-metadata">

**Author:** ![Chief\_Man](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chief\_Man](https://forums.unrealengine.com/u/Chief_Man)\
**Post date:** [April 18, 2021, 9:20pm UTC](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058/34 "2021-04-18T21:20:37Z")

</div>

I set everything up and it’s working great! Thanks for the guide on how to do it.

[Previous page](https://forums.unrealengine.com/t/how-do-i-make-my-progress-bar-decrease-with-integer-based-health/482058.md?page=1)
