x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Progress Bar UI - why doesn't it work?

Hey,

I have a 2 players local 2D game where they collect apples and they get 10 points per. I have a widget that is called when 100 total points are reached - an Endgame widget. That one part works.

The problem: I wanted to display each player's points using a progress bar. This is the function (for players' 1 points): alt text This would otherwise work if I had converted it to text, for example (minus the int/int).

And then I have the progress bars, the % is bound to the function obviously (players' 1 points bound to the first progress bar, players' 2 points bound to the second) alt text

Yet when the widget appears, the progress bars stay empty - although both players have individual points equal to a multiple of 10. I've tried this before and it didn't work that one time either so I just gave up and the in-game UI is just text - pretty unappealing right?

Where'd I go wrong? Thank you!

Product Version: UE 4.17
Tags:
points1.png (55.4 kB)
bound.png (75.0 kB)
more ▼

asked Feb 20 '19 at 06:34 PM in Blueprint Scripting

avatar image

OutOfRehab
9 1 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

The progress bar goes from 0 to 1, from 0% to 100%. If you are dividing your points by 1 you are getting as a result your points, making the division redundant and getting always a number >1.

You should divide 1 by your total so you get the value of each item.

e.g.

If you need 10 items, then divide 1/10 so each item has a value of .1 And multiply this by your picked items so your bar fills.

alt text

borrarya.png (62.9 kB)
more ▼

answered Feb 20 '19 at 07:00 PM

avatar image

SageX85
11 1 1

avatar image Crowley Caine Feb 20 '19 at 07:08 PM

This guy is right. If the scale goes to 100 points then for the progress bar 10 points would be 0,1.

However, you can change the scale of the progress bar to make it go from 0 to 100 instead.

Also, dividing anything by 1 is pointless. From a glance all you need to do is divide by 100 instead of 1 and it should be working.

avatar image OutOfRehab Feb 20 '19 at 07:23 PM

Hey,

Naturally, I know dividing anything by 1 equals the same - I had the second players' points divided by 100. I just forgot to change it in the example I've given you.

However, the result was the same. I will now try what Sage suggested.

avatar image OutOfRehab Feb 20 '19 at 07:29 PM

Right,

I have divided them by 100 instead of - when the widget was called Player 1 had 30 points which / 100 = 0.3. The bar stayed the same though. I know it should have worked. It just doesn't though.

avatar image Nebula Games Inc Feb 21 '19 at 12:17 AM

Screen shot of this? Did you happen to divide your integer 30 by 100 giving you a value of 0.3 as an integer which would have then been rounded to 0 and you subsequently converted that to a float to plug into the binding?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

A lot of the time when I have the same issue, I add a node in the binding blueprint because usually when there is no nodes between Get Percent 0 and Return Node, it doesn't work. So try adding like instead of getting a ref, casting to the ref or casting to ThirdPersonCharacter and then getting "Game Ctrl BP".

Hope that helps.

more ▼

answered Feb 21 '19 at 01:22 PM

avatar image

ZeusXpress
11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question