Download

GameHUD UMg - Progress bars not updating correctly?

Hello forum!

I followed the tutorial on the unreal wiki to create the basic Health, Energy, and Mood (XP in my case), but I can’t seem to get the progress bars updating.

After making the basic game HUD, I bound the progress bars to the correct variables within my character:

tmp1.JPG

I’m trying to make the basic; “When he jumps, remove 20 energy”. I made this within the FirstPersonCharacter Blueprint:

tmp2.JPG

But the progress bar is not changing.
Other than that, whenever I pick up an item within my game world, I wish for the user to gain XP.

I do this in the following manner:

tmp3.JPG

It does say; “DING”, but the progress bar is filled 100% constantly.

I’m not sure what I’m doing wrong?

Are those energy XP amd xp till next level Float by any chance? If so watch this: https://www.youtube.com/watch?v=PZRI1IfStY0
That is hint for the future, be careful with float and == operator. Use rather “nearly equal”.
So first change i propose is to change that “==” with “compare float” node.

Are you actually casting and sending that variable value over to HUD (or updating this variable in hud from player pawn)?

You also should place that print node in various places, track whole chain of events and see where it stops. Instead of printing some bad words you should print value of those variables.

And when we are at subject of “censored” words, you really should edit that picture and remove it. This may be seen as avoiding world filter, which is 2 infraction points.

It does work with the equal operator, but thanks for the tip!

As mentioned, I followed the tutorial from the Unreal Wiki. I saw nothing about updating these? Could you give an example?

My bad. Will edit.

EDIT: I’m talking about this wiki: https://docs.unrealengine.com/latest/INT/Engine/UMG/QuickStart/2/

Easiest way to update variables:
in progress bar inside that bind function that updates bar value.
Add there get player pawn (or controller depends where you keep XP variable)
Then cast to "your name pf player controller (or pawn) class.
And type “XP” m then create “GET XP” node.
Now you have value of “XP” variable right from controller.
Create variable in umg blueprint, and store that value there (you may want to use it in more places of umg later)
Now you should have bar updated.

And some tips:
bars operate in range of 0.0 to 1.0 (not 0 to 100%).
there is great node that is called “Map in range”
Also future hint: “Format text” it is great node for all numerical text output, together with “integer” or “float” to “text” converting nodes. You can easily format all your numbers.

You also should start looking into “blueprint communication”, it is quite easy thing to use, but very messy to learn at first. Do not get frustrated give it time.
https://www.youtube.com/watch?v=s5pIrpI7py8

Oh god… This is where it goes wrong. Changing the values to be between 0 and 1, made everything works. Appreciate the help!

When in doubt, trying messing with any settings to see what kinds of values work. :smiley:

Yea I know. But I just assumed that the progress bars worked in percentage. The “0-1” way they work right now, doesn’t really seem like logic to me.

Something is buggy here.

4.14

I have two progress bars that are in the 0-100% range. The third which was created at the same time but not set up is stuck in 0-1.0 range. Deleting and recreating it I only get 0-1.0 range.
I can copy paste a 100% range bar, but if I change the range slider it pops into 1.0 range.

hmm, got it to work, I did something dumb. Either way, I can use 100 and the 1.0-0 still works as 100%, still don’t know why two bars are one way and this one isn’t.