<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[Shooter Game Tutorial]]></provider_name><provider_url><![CDATA[http://shootertutorial.com]]></provider_url><author_name><![CDATA[andrzejkoloska]]></author_name><author_url><![CDATA[https://shootertutorial.com/author/andrzejkoloska/]]></author_url><title><![CDATA[Display target information]]></title><type><![CDATA[link]]></type><html><![CDATA[<p><a href="https://shootertutorial.files.wordpress.com/2015/08/target.png"><img class="alignnone wp-image-1119 size-full" src="https://shootertutorial.files.wordpress.com/2015/08/target.png?w=363&#038;h=139" alt="target" width="363" height="139" /></a></p>
<p>In this tutorial I would like to polish how I&#8217;m showing enemies HP.</p>
<ul>
<li>Update HP bar above enemies,</li>
<li>Add UMG widget which will show target enemy HP and his name,</li>
</ul>
<p>Again, easy stuff. <!--more--></p>
<pre><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.</pre>
<h1><a href="https://shootertutorial.files.wordpress.com/2015/08/ue4editor-2015-08-22-14-48-11-681.jpg"><img class="alignnone wp-image-1118 size-large" src="https://shootertutorial.files.wordpress.com/2015/08/ue4editor-2015-08-22-14-48-11-681.jpg?w=1024&#038;h=576" alt="UE4Editor 2015-08-22 14-48-11-681"   /></a></h1>
<h1>Updating Enemies HP Bar</h1>
<p>Open BP_BaseEnemy and navigate to your UI_Health widget. For me it&#8217;s UI_Debug_EnemyHealth. You can rename this widget and move outside Debug folder.</p>
<p>Open it and select progress_holder as Progress Bar Background and progress_fill_full as Fill Image. Remember &#8211; I&#8217;m using textures from <a href="http://shootertutorial.com/2015/07/12/umg-ui-draw-player-health-and-armor/">k-spree GUI package</a>.</p>
<p>Then go back to your BP_BaseEnemy and add one Text variable: EnemyName.</p>
<p>Create new custom event UpdateHPBarRotation. This will rotate HP bar to player. There were issues where HP bar has weird rotation.</p>
<p><a href="https://shootertutorial.files.wordpress.com/2015/08/updatehpbarrotation.jpg"><img class="alignnone wp-image-1111 size-large" src="https://shootertutorial.files.wordpress.com/2015/08/updatehpbarrotation.jpg?w=1024&#038;h=279" alt="updatehpbarrotation"   /></a></p>
<p>Now in event Tick call this custom event.</p>
<h1>Creating UMG widget</h1>
<p>Now create new Widget named HUD_EnemyTarget. Try to recreate this hierarchy:</p>
<p><a href="https://shootertutorial.files.wordpress.com/2015/08/hierarchy.jpg"><img class="alignnone wp-image-1112 size-large" src="https://shootertutorial.files.wordpress.com/2015/08/hierarchy.jpg?w=1024&#038;h=438" alt="hierarchy"   /></a></p>
<p>You should<a href="http://shootertutorial.com/2015/08/22/how-to-implement-score-and-combo-system/"> read earlier post</a> where you can find more details about which textures I&#8217;m using here.</p>
<p>Now in Event Graph create one variable named TargetReference (extending BP_BaseEnemy)</p>
<p>Create an binding for Progress Bar progress named Get Target Health.</p>
<p><a href="https://shootertutorial.files.wordpress.com/2015/08/progressbarbinding.jpg"><img class="alignnone wp-image-1113 size-large" src="https://shootertutorial.files.wordpress.com/2015/08/progressbarbinding.jpg?w=1024&#038;h=460" alt="progressbarbinding"   /></a></p>
<p>I&#8217;m using this binding to get enemy as well.</p>
<h1>Placing widget</h1>
<p>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 <a href="http://shootertutorial.com/2015/08/22/how-to-implement-score-and-combo-system/">earlier post. </a></p>
<p>Widget Properties:</p>
<ul>
<li>Location: (X=-1.996885,Y=-1.232498,Z=33.010548)</li>
<li>Rotation: (Pitch=0.000034,Yaw=89.999817,Roll=99.999878)</li>
<li>Scale: (X=0.030000,Y=0.030000,Z=0.030000)</li>
<li>Widget Class: HUD_EnemyTarget,</li>
<li>Draw Size: 350, 150,</li>
</ul>
<p>Open Event Graph and create new custom event named UpdateEnemyTargetHud.</p>
<p><a href="https://shootertutorial.files.wordpress.com/2015/08/updateenemytargethud.jpg"><img class="alignnone wp-image-1115 size-large" src="https://shootertutorial.files.wordpress.com/2015/08/updateenemytargethud.jpg?w=1024&#038;h=494" alt="updateenemytargethud"   /></a></p>
<p>What this do is basically checking using traces if hit something &#8211; if it&#8217;s an enemy show target hud and pass target reference. If it isn&#8217;t enemy hide target hud.</p>
<p>Now you need to call this function in a Tick or using looping Timer. For now I&#8217;m using Tick.</p>
<h1>Final Effect</h1>
<p><span class='embed-youtube' style='text-align:center; display: block;'><iframe class='youtube-player' type='text/html' width='640' height='390' src='https://www.youtube.com/embed/WOu4TKlBLwU?version=3&#038;rel=1&#038;fs=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;wmode=transparent' frameborder='0' allowfullscreen='true'></iframe></span></p>
<blockquote><p>Creating ShooterTutorial takes a lot of my free time.<br />
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=8UXM3JZGDPPPE"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Buy Now Button" /><br />
</a>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.</p>
<p>Implementing game is taking time but writing about it is taking much more effort!</p></blockquote>
]]></html><thumbnail_url><![CDATA[https://i0.wp.com/shootertutorial.files.wordpress.com/2015/08/ue4editor-2015-08-22-14-48-11-681.jpg?fit=440%2C330]]></thumbnail_url><thumbnail_height><![CDATA[247]]></thumbnail_height><thumbnail_width><![CDATA[440]]></thumbnail_width></oembed>