how do I display an image on the screen when my player is killed?

I just want to show a PNG on the screen as a HUD when my character is killed by anything at all, I know it should be simple enough but I’m just beginning to learn about scripting and I really cant pick what I need out of tutorials.

Thanks

What do you use for HUD, the HUD class canvas or UMG (widget blueprint)?

Hi Qualitypirate,

Here is a good video on Displaying an Image. It mainly revolves around the Widget Blueprint. Once you get that working, then change the condition from “pressing E” (~5 min in video) to “when the character dies”. You might need to create this variable depending on how you handle the character’s death

Widget blueprint mate

doesn’t the input and end input need to be removed then also?

basically I have a lava floor with dynamic collision, player hits the floor they burn they lose health and they die at the minute thats all thats dangerous so it could be as simple as player kitting a kill volume and displaying the PNG for me, any idea how that would be done mate?

Unfortunately, I’m I don’t know exactly how to handle this as I’m still new to UE4. I don’t know if this will help but here is a better attempt to explain my thoughts…

  1. First create a variable in the character’s blueprint called IsDead and make sure the default value is False (The checkbox in variable details should unchecked). This means the character is alive. When IsDead is set to True then the character will be dead.

  2. Next, I would setup the widget to display an image. I think you can make it for the user interface and I would name this widget DeathScreen. Here, get the image you want (through the appearance tab) and place it where you want in the visual designer area. Here is some more information on Widgets.

  3. Now this is the tough part for me, we need to call this widget when the character dies. I think in the character’s Event Graph, we can connect an Event Tick to a Branch and connect IsDead as the condition. When True, connect to Create DeathScreen Widget and a then Add to Viewport. Leave False empty as we don’t want to display anything while the character is alive. Here’s another video about a Pause Menu and user interface.

  4. Finally, the lava object will need to kill. In the lava’s event graph, start with OnActorBeginOverlap, Cast to the character, and set IsDead to True (check the box). If you have a health system, then the lava will lower the health and you will need to create another event to set IsDead to True once the character’s health reaches 0.

Hopefully, this will start with the character alive (step 1). When he touches the lava he will die (step 4) and the widget will display (step 3) with the image you want (step 2).

Simple, make a variable called something like “IsDead” and make it a Boolean. Set it to false. So when the player’s health is 0 set “IsDead” to true. Then, play the death animation when “IsDead” is true. Also, in the Widget Blueprint make a full sized damage effect image. them set its opacity to 0. Make an animation for it. In the animation set the opacity to 1. In the player Blueprint, play the animation when “IsDead” is true. And with this “IsDead”, you can also fire anything else you want when the player dies, just set it to happen when IsDead is true.

Best,