# How to change image in the widget based on the player integer variable?

**URL:** <https://forums.unrealengine.com/t/how-to-change-image-in-the-widget-based-on-the-player-integer-variable/1666604>\
**Category:** Architectural and Design Visualization\
**Tags:** unreal-engine, Widget, question, Blueprint\
**Created:** [February 4, 2024, 10:56pm UTC](https://forums.unrealengine.com/t/how-to-change-image-in-the-widget-based-on-the-player-integer-variable/1666604 "2024-02-04T22:56:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![petrow1tch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@petrow1tch](https://forums.unrealengine.com/u/petrow1tch)\
**Post date:** [February 4, 2024, 10:56pm UTC](https://forums.unrealengine.com/t/how-to-change-image-in-the-widget-based-on-the-player-integer-variable/1666604/1 "2024-02-04T22:56:35Z")

</div>

I have an integer variable that represents the number of limbs the player have. When player loses a limb, the number in the integer decreases by 1, and with each new number i want a picture on the widget change too, so if integer is at 5, then the little person on the pic has all limbs; if the number is 4, then the image widget should pick up the next image with one limb missing an show that instead, and so on and so forth.

How would i go about implementing it?

---

<div class="post-metadata">

**Author:** ![S-Dot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s-dot/32/1194599_2.png) [@S-Dot](https://forums.unrealengine.com/u/S-Dot)\
**Post date:** [February 5, 2024, 7:08am UTC](https://forums.unrealengine.com/t/how-to-change-image-in-the-widget-based-on-the-player-integer-variable/1666604/2 "2024-02-05T07:08:47Z")

</div>

You can set the image in the widget. First make your image a variable by ticking the box right top corner in the design tab:

 ![imagewidget01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/2/9d278ac71e6c43a9ca4068166606746c7e6143f4.png)

This is an image button. Using a simple image will be similar.

 ![imagewidget02](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/3/5/1356578dee2051943a7c1de0d5c31766ddb01183.png)

Now you can use the image in the graph tab of the widget. I made a simple node system for it. It may look a bit different for a normal image but the principle is the same.

- Get your character and the variable from it

- The Select node can choose an image based on the INT value. You can add pins if you have more than 2 images.

- Set the style of the image.

This is just one of many ways to do it. Hope it gives you the right direction.

---

<div class="post-metadata">

**Author:** ![petrow1tch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@petrow1tch](https://forums.unrealengine.com/u/petrow1tch)\
**Post date:** [February 5, 2024, 1:28pm UTC](https://forums.unrealengine.com/t/how-to-change-image-in-the-widget-based-on-the-player-integer-variable/1666604/3 "2024-02-05T13:28:31Z")

</div>

Thank you so much, you’re a life saver!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 6, 2024, 1:28pm UTC](https://forums.unrealengine.com/t/how-to-change-image-in-the-widget-based-on-the-player-integer-variable/1666604/4 "2024-03-06T13:28:34Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
