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.
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
Have a look at the live training streams from Epic:
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:
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.
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.
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?
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!