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 play a UI animation off of damage from an outside blueprint?

I have UI animations made in a widget blueprint that is cast to my player character. I want to play these animations when I take damage (an overlap trigger volume that detracts from my health value every second). I made a little red flash animation thats just changing the opacity and color of the default white image the ui widget gives you. Which blueprint do I have to edit and what do I have to cast to to accomplish this? Thanks.

Product Version: UE 4.17
more ▼

asked May 09 '18 at 03:07 PM in Using UE4

avatar image

1 1

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

1 answer: sort voted first

You should have an AnyDamage event in your Player Character blueprint. You should also keep a reference to the Widget that you added to the screen (which includes the health bar). I'm gonna assume you do that in your player controller, but if you do it in your player character that's fine.

You should also have a custom event in your widget blueprint that plays the animation you want (PlayAnimation node).

When the AnyDamage event fires, you call the custom event in your widget blueprint, using the reference you saved when you added it to the screen, and it should play the UI animation you configured.

If you've got any further questions let me know ;)

more ▼

answered May 09 '18 at 03:13 PM

avatar image

897 12 14 24

avatar image Trppnontriscuts May 10 '18 at 01:04 PM

Hey, thanks so much for the reply. I'm at work right now so I can't try this out immediately but I wanted to ask if I have an animation for the value going up AND an animation for the value going down, would this method still work? Thanks.

avatar image Trppnontriscuts May 10 '18 at 01:17 PM

Apologies, I tried to respond to this earlier but I guess it didn't go thru. The thing is, I have 2 UI animations for the health value, one for damage and one for healing. I would think AnyDamage would only allow the use of one of them?

avatar image goncasmage May 10 '18 at 01:21 PM

Well, the AnyDamage event is called when you call the Damage function of the character blueprint (from another class, for instance).

You can simply call the function with a negative value to add health to the character, and on the AnyDamage event check if the damage is positive. If it isn't, play the healing animation instead of the damage animation ;)

(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