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"

Damage texture

Hey, i have a hud that is applied to my character and i want that if my characters health (float variable) is getting lower that a damage texture will set its oppacity depending on the float, and the lower your health the more visible it is (kinda like the cod blood splatters on your screen), But i have idea where to start, please help and. Thank you

Product Version: UE 4.7
Tags:
more ▼

asked Sep 05 '15 at 09:47 AM in Using UE4

avatar image

kaosrio
58 4 7 14

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

1 answer: sort voted first

You will need to create a widget, then find a nice big blood splatter image on google images and drag it into UE4 editor.

Add a image to your widget in the designer and set its anchors to the 4 corners and make sure its set to fill the entire screen. Now select your blood image for it.

Now set its opacity to 0.

Now in the event graph On eventBeginPlay do a cast to your character ie cast to MyCustomCharacter and then promote that cast varaible (the bottom blue pin right click on it) to a variable called MyCharacter_reference.

Then create a a varaible myHealth in your widget of type float. On eventTick() drag in your MyCharacter_reference variable with ctrl held down to make a getter, drag off its pin and get the health varible from your character and then set myHealth to that variable.

Now go back into the desgner and bind the image opacity to myHealth

Alternatively you can bind opacity to a function that takes MyCharacter_Reference -> get charactersHealth -> return pin that will be cleaner.

Let me know if that makes sense and works for you. Remember that values like opacity work from 0-1 so if your characterHealth varaible in your character BP is 0-100 you need to divide it by 100 first in the widget once you get it from the mycahracter_Reference variable. Also remember you want lower health to make the image more opaque so you probably want to set myHealth to characterHealth squareRt or something else math-like basically yo will need to figure out the best way to mathemtically set your image opacity from 0to0.8ish from 1to0 like an inversion. My math skills arnt good enough to know the answer. Maybe multiply it by -1 to get it inverted (negitive) and then add + 0.9 so health 0.9 = -0.9 + 0.9 = 0 opacity but 0.5 will be -0.5 + 0.9 = 0.4 opacity and 0.2 health will be -0.2 + 0.9 = 0.7 opacity etc.

Don't forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going as well as keeping AnswerHub clean so that it gets removed from the "unanswered questions" category.

more ▼

answered Sep 05 '15 at 06:01 PM

avatar image

Nsomnia
1.8k 67 27 137

avatar image kaosrio Sep 05 '15 at 06:39 PM

Thank you so much, your the first person that gave me a understandable answer

avatar image Nsomnia Sep 05 '15 at 08:57 PM

Glad I could help, with some material effects you could do some cool stuff too or maybe some blendables in a post process volume. That is the simplest way to get the "red out" effect I think your talking about.

(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