# How to have a dynamic Experience bar?

**URL:** <https://forums.unrealengine.com/t/how-to-have-a-dynamic-experience-bar/311343>\
**Category:** UI\
**Tags:** hud, unreal-engine, dynamic, UE4, question, Blueprint\
**Created:** [March 17, 2015, 8:11am UTC](https://forums.unrealengine.com/t/how-to-have-a-dynamic-experience-bar/311343 "2015-03-17T08:11:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MikeDog\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MikeDog\_1](https://forums.unrealengine.com/u/MikeDog_1)\
**Post date:** [March 17, 2015, 8:11am UTC](https://forums.unrealengine.com/t/how-to-have-a-dynamic-experience-bar/311343/1 "2015-03-17T08:11:50Z")

</div>

Hey guys,

So i followed the tutorial for the HUD, all works fine… however the experience bar only goes from 0-1. I have my level up cost changing each time you level up to become more expensive…

How do i set it so the experience bar max number changes to meet this changing cost?

---

<div class="post-metadata">

**Author:** ![veggiesaurus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@veggiesaurus](https://forums.unrealengine.com/u/veggiesaurus)\
**Post date:** [March 17, 2015, 8:34am UTC](https://forums.unrealengine.com/t/how-to-have-a-dynamic-experience-bar/311343/2 "2015-03-17T08:34:49Z")

</div>

I would suggest having two variables in your widget blueprint, `Exp` and `MaxExp`. Then, bind your progress bar to a function `GetExpProgress`, which simply returns `Exp / MaxExp`. When your character levels up, update the widget’s `MaxExp` variable, and any time your character gains experience, update the `Exp` variable.

This is assuming that your `Exp` gets reset to zero as soon as you level up. If that’s not the case, then you probably want to also store the previous level’s `MaxExp` somewhere, and `GetExpProgress` would look like

`(Exp - PrevMaxExp) / (MaxExp - PrevMaxExp)`

---

<div class="post-metadata">

**Author:** ![MikeDog\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MikeDog\_1](https://forums.unrealengine.com/u/MikeDog_1)\
**Post date:** [March 17, 2015, 9:09am UTC](https://forums.unrealengine.com/t/how-to-have-a-dynamic-experience-bar/311343/3 "2015-03-17T09:09:18Z")

</div>

Worked perfect, can’t believe it was just xp / max xp…I obviously don’t do maths…
