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 make widget images change with health?

For a personal project I'm working on, I have this health system in mind where when the player character loses a life, the image in the widget changes. Green is 3/3 health, yellow is 2/3 health, red is 1/3 health. (images are placeholders) What kind of method would I use to achieve this?

Images

alt text

Health Variable

alt text

Product Version: UE 4.18
Tags:
capture1.png (28.3 kB)
capture2.png (33.5 kB)
more ▼

asked Jan 08 '18 at 11:06 AM in Blueprint Scripting

avatar image

EAPyoutube
16 3 3 4

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

2 answers: sort voted first

Hey there, you can do this 2 ways:

  • Have 3 images and toggle visibility between them

  • Have 1 image and in the code change the brush image

Which do you prefer?

more ▼

answered Jan 08 '18 at 11:36 AM

avatar image

xlar8or
6k 161 129 304

avatar image EAPyoutube Jan 08 '18 at 12:58 PM

I attempted using 3 images and toggling visibility, but I must have been doing something wrong since I couldn't get them to work.

Having 1 image and then using code to change brush image does sound interesting tough. I would like to try doing that.

avatar image xlar8or Jan 08 '18 at 01:05 PM

Ok so do the following, select the image on the options on the right create a bind function for the brush. In there you have to create 3 make slatebrush nodes for each of the options and then you'll just do 2 branches to determine which one to use.

avatar image EAPyoutube Jan 08 '18 at 09:03 PM

It works! This is what I did to get it working! Thank you!alt text

capture3.png (140.8 kB)
avatar image xlar8or Jan 08 '18 at 09:08 PM

No prob :)

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

Rather than making the circle coloured, make it white and use this to colour it:

alt text

This way, you do not need to store/create/maintain multiple brushes/images and/or swap them around. Just pick the colour you want. This will also allow you to animate it easily if you wish so - change the colour gradually, for example.

There are as many solutions to this as there are people. Pick your poison.

capture.png (40.3 kB)
more ▼

answered Jan 08 '18 at 03:22 PM

avatar image

Everynone
14.6k 76 25 61

(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