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. 

How to convert an Int to a Float for use with a UMG Progress Bar?

So in my player character I have an Int variable called PlayerHealth with a value of 100. I want to be able to use this with a UMG Progress Bar. How can I do this in Blueprint? Thanks.

alt text

alt text

Product Version: UE 4.9
Tags:
capture01.png (14.2 kB)
capture02.png (7.6 kB)
more ▼

asked Sep 26 '15 at 11:44 PM in Blueprint Scripting

avatar image

PCCoder1000
7 2 4 6

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

1 answer: sort voted first

In your UMG, select your ProgressBar and look for Percentage, it should have a binding next to it. Create a new binding. This is what should be in your binding:

alt text

So what this basically does is gets the pawn that you're controlling, converts it to whatever your player is (I used the basic ThirdPersonCharacter for this example), gets the Health variable, converts the int to a float (type 'to float' or just make the next node and plug it in and it will do it automatically for you), divides it by a float of 100.0, and then returns a percentage.

more ▼

answered Sep 27 '15 at 12:13 AM

avatar image

Sephern
117 4 8 16

avatar image PCCoder1000 Sep 27 '15 at 03:33 AM

Thank you!

(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