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"

AI/NPC Health bar

Hello, I made a really basic health system to my AI, when I shoot him his health lowers by 20. Now i'm trying to display his health with a health bar,I tried doing that and made a health bar above his head. The problem is the health bar stays the same...Here's what I've tried alt text But it doesn't work. Any help please? (Without using Event tick). Thanks!

Product Version: UE older version
Tags:
unrealq.png (236.9 kB)
more ▼

asked Mar 07 '17 at 05:27 PM in Using UE4

avatar image

Sntfon100
78 11 16 19

avatar image VizualTek Mar 07 '17 at 05:35 PM

Do you really change the progress bar then?

I don't know how you want to arrange that, but I would give your AI or NPC a 3D Widget as a component, so it hovers over it all the time (or where ever you want it to be). If you make the widget a child of the AI/NPC then you can access the Widget very easily, because it is part of your AI/NPC. Then you can change all the settings for your widgets like the health/progress bar, it's color and percentage and stuff.

avatar image Sntfon100 Mar 07 '17 at 05:46 PM

Do you mean like this? alt text The problem with this is that I don't want to use Event tick and don't know how to fire it without it.

unrealq2.png (260.0 kB)
avatar image Devgroup Mar 08 '17 at 09:16 AM

There are a few mysteries in your problem. How are you visualising the HP bar? Did you bind the GetPercentage_0 function to the HP bar? Are you running on multiplayer, in that case maybe the problem is replication and not a problem with your implementation. How are you taking damage? On your character I believe you had the event "onDamage" or "onHit" which you could use unless you implemented it some other way.

avatar image Sntfon100 Mar 08 '17 at 03:27 PM

I bind GetPercentage_0 function to my AI's health points which start from 100. I do not run multiplayer at the moment, it's just a singleplayer. And my AI character takes damage by LineTraceByChannel. Everytime it "hits" the actor(AI) it removes him 15 Health points. About the visualising I didn't quite understand you.

avatar image Devgroup Mar 08 '17 at 09:12 PM

Okay first off, have you doing a PrintString to see if the hit is actually being triggered? Have you tried logging the values t see if the value 15 is there?

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

2 answers: sort voted first

Sorry for my late response but I've already got it to work. Instead of plugging Cast to health bar to Event Tick, I plugged Cast to health bar to whenever I deal damage to my AI. Works perfectly!

more ▼

answered Mar 14 '17 at 02:51 AM

avatar image

Sntfon100
78 11 16 19

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

Have a look at the live training streams from Epic:

https://www.youtube.com/watch?v=PgxuaTSkyu4&index=1&list=PLRrOfLSL-UhRBZ3bAFGAM4DS468pGWDrl

They cover this at some point during the stream as well as other useful information you may find helpful. I believe the widget can be seen in the forth video...here it is:

https://youtu.be/b6it1NEOsQ8?list=PLRrOfLSL-UhRBZ3bAFGAM4DS468pGWDrl&t=848

more ▼

answered Mar 07 '17 at 05:39 PM

avatar image

Black Phoenyx
4.1k 165 9 170

avatar image Sntfon100 Mar 07 '17 at 05:48 PM

Thanks for the videos i'll give them a look.

(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