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"

Integer into progress bar

I'm working on trying to take my health (which is an integer) then converting it into a float for the progress bar: alt text

however, when looking at the progress bar in game, it is either full or empty rather than going steadily down. any advice on how to fix the issue would be great! thanks,

Percy

Product Version: UE 4.12
Tags:
screenshot (1).png (203.5 kB)
more ▼

asked Sep 05 '16 at 05:22 PM in Blueprint Scripting

avatar image

MadkingPercy
18 3 6 9

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

2 answers: sort voted first

Hey MadkingPercy,

Because you are doing the divide before turning the result into a floating point number, it is being returned as 0 instead of something like 0.25, as an example.

To explain more:

75 / 100 = 0.75 but because Health is a integer value, it will result in 0 (dropping the decimals because integer variables do not have any floating point numbers).

To fix this, you'll want to turn Health into a floating point number (float) before the divide. As such:

alt text

more ▼

answered Sep 05 '16 at 05:35 PM

avatar image

ImVawx ♦♦ STAFF
6.8k 114 18 127

avatar image MadkingPercy Sep 05 '16 at 05:47 PM

that's great! Thank you for explaining!!!

avatar image MadkingPercy Sep 06 '16 at 07:57 PM

Hello again, using this same method for a different project but progress bar no longer updating at all no matter what it is always empty. would you happen to know why this is?

avatar image ImVawx ♦♦ STAFF Sep 07 '16 at 05:48 PM

Hey MadkingPercy,

Make sure that your new progress bar is both valid (as in your cast is successful and you can get that value - such as health) as well as when you divide it, its result is a floating point number (like the screenshot above) and it is from 0.0 to 1.0.

If you can, please post a screenshot or more information related to how this new progress bar may be different from the health bar.

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

I don't think you need to divide to 100 to convert from an int to a float

more ▼

answered Sep 05 '16 at 05:31 PM

avatar image

Mookaroni
569 21 9 35

(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