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"

Enemy Health Bar not Binding

Hello Everyone!

I have read all the questions and replies here about this and yet still no answer. I am trying to bind a widget health bar to my enemy AI. It appears above his head, facing camera, all good. It does not display the health. My hero displays his health, no problem, so I am assuming it is how I am approaching the Event Graph in the Widget BP. I have a feeling it has to do with Object being cast to CastToZombieCharacter. Object is a public variable. Here are some images. I think its a really easy step I am missing, if anyone could point it out, that would be awesome!

GetPercent EnemyWidgetEvent WidgetBind

Product Version: UE 4.9
more ▼

asked Jan 03 '16 at 11:19 PM in Blueprint Scripting

avatar image

52 2 5 8

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

1 answer: sort voted first

What are you assigning to Owner?

  • I am assuming that Owner in the Event Construct event is the result of a hit. You are then storing a handle to this object for later reference, however you are not using this handle in the "get percent zombie health" function. Instead of calling it "owner", how about something less ambiguous like "focusedActor".

Have you considered creating a base class (or interface) that handles every characters health and damage mechanisms?

  • Any class, such as your zombie class that extends this base class can be handled by the same code. Instead of storing a variable "ZombieCharacter" just store the base class. The implementing class can use public means to change any desired behavior differences. Importantly, your blueprint will not get polluted with numerous specific actor types.

Once you have cleaned up your parameter names and leveraged a base class for commonality, you should just have to connect your target hit result to your players HUD "Event Construct" event. Next, set up an event tick that queries the health of your "focusedActor" that will update itself accordingly.

  • You'll also want to consider changing target, and target validity checks along the way. I assume that there will be many targets eventually.


more ▼

answered Jan 04 '16 at 04:38 AM

avatar image

61 1 7 7

avatar image MaroonersRockAnimation Jan 04 '16 at 05:16 AM

That sounds excellent! I do have an Interface, "IDamageable", but a little confused about its use. I'll implement what you said and let you know how it comes out. Thanks for taking a few minutes to explain it!

(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