Convert int to float progress bar problem

Hello,

I have a progress bar and this function bound to it:

I would like the bar to display the score, in percentages. I am dividing 1 / 500 (max score) and then * current score. It would go like (1 / 500) x 10 = 0.02 or 2%, which should otherwise fill the bar by 2%. But it doesn’t. The progress bar never gets filled, no matter the score - and I wonder if the int to float conversion is the fault here.

The ‘SCORE’ is the total score or the sum of two player scores, nothing fancy. So P1 + P2 = SCORE.
The widget is created and added to the viewport - tied to the BeginPlay event.
Maybe it has to do with the actual score system, as in, maybe it doesn’t check the score at all? I am so confused.

Any help would be much appreciated!

The math is fine.

Put .5 manually in the return value and see if you get a result.

If you do, the score is 0 or the GMR is invalid.

If you do not see a result, you’re looking at the wrong widget.

My bet, GMR is just an empty variable and isn’t actually “Set” anywhere thus making it a null reference. How did you create “GMR”? Did you ever use a “Set” node with it?

GMR is a game mode reference variable. I don’t think I did actually.

EDIT: I’ve just ‘set’ it in the widget’s event graph by simply casting to game controller, getting game mode and setting the GameModeReference variable. The progress bar is now working fine. Thank you!

Glad we got it figured out :slight_smile: