In this tutorial I would like to polish how I’m showing enemies HP.
- Update HP bar above enemies,
- Add UMG widget which will show target enemy HP and his name,
Again, easy stuff.
1 2 |
<strong>This Tutorial has been created using Unreal Engine 4.8.2</strong>. Make sure you are working on the same version of the engine. |
Updating Enemies HP Bar
Open BP_BaseEnemy and navigate to your UI_Health widget. For me it’s UI_Debug_EnemyHealth. You can rename this widget and move outside Debug folder.
Open it and select progress_holder as Progress Bar Background and progress_fill_full as Fill Image. Remember – I’m using textures from k-spree GUI package.
Then go back to your BP_BaseEnemy and add one Text variable: EnemyName.
Create new custom event UpdateHPBarRotation. This will rotate HP bar to player. There were issues where HP bar has weird rotation.
Now in event Tick call this custom event.
Creating UMG widget
Now create new Widget named HUD_EnemyTarget. Try to recreate this hierarchy:
You should read earlier post where you can find more details about which textures I’m using here.
Now in Event Graph create one variable named TargetReference (extending BP_BaseEnemy)
Create an binding for Progress Bar progress named Get Target Health.
I’m using this binding to get enemy as well.
Placing widget
Now open GameplayCharacter and add new Widget component to it named HUD_EnemyTarget. It need to be attached as rest HUD Widgets. You could read more about this in earlier post.
Widget Properties:
- Location: (X=-1.996885,Y=-1.232498,Z=33.010548)
- Rotation: (Pitch=0.000034,Yaw=89.999817,Roll=99.999878)
- Scale: (X=0.030000,Y=0.030000,Z=0.030000)
- Widget Class: HUD_EnemyTarget,
- Draw Size: 350, 150,
Open Event Graph and create new custom event named UpdateEnemyTargetHud.
What this do is basically checking using traces if hit something – if it’s an enemy show target hud and pass target reference. If it isn’t enemy hide target hud.
Now you need to call this function in a Tick or using looping Timer. For now I’m using Tick.
Final Effect
Creating ShooterTutorial takes a lot of my free time.
If you want you can help me out! I will use your donation to buy better assets packs and you will be added to Credits /Backers page as well.Implementing game is taking time but writing about it is taking much more effort!
Reblogged this on King Designs.
The tutorial still going on ?