Make Widget disappear after x seconds

Hello.

I’m making a Widget Blueprint that displays the player you just killed.

This is what I did:

I create a Widget Blueprint and in the event tick I made this:

GetLastPlayerKilled is a functions that return the name of the killed player, but that doen’t matter.

What matters it that once I call HUD Delay:

70435-2.png

which calls ShowHide

The text remains there and does not disappear.

This is the TextBlock of the Widget which refers to PlayerKilledMessage string variable

can you confirm that show-hide gets called? (e.g. make a print screen message to show that it gets called) if it gets called, you might not be hiding the right thing, if it doesn’t get called, trace backwards to find out why.

Does HUD delay get called?

No it doesn’t get called. Can’t find out why

Yes, many many times per second

Where should I add it?

Maybe the problem is that i’m using the Event Tick

Probably just after get last player killed. One way to support multiple type of death messages would be to have a counter. If you’ve already shown the last message (determined by the counter) then you do nothing, if the last death is newer (therefore you have a higher count) then you show it and increment the count to compare to.

Try to add a boolean that determines whether the message has been shown once for this person so that the HUD delay only gets called once per kill
In the game I could also kill the same person in a very small interval.

My solution would be to call ChangeText function from C++, without using the Event Tick that is probably the reason of the issue

Yeah the death of a player should be an event that would call this visual effect in addition to game logic, but I didn’t want to make assumptions on the overall game structure.

You can expose a C++ function to blueprints and you can call it from C++ and if you override the implementation in blueprint that function will be called like an event.

That should only be called once per death, otherwise the previous call will probably override the delayed state. Try to add a boolean that determines whether the message has been shown once for this person so that the HUD delay only gets called once per kill.

Hello Gedamial,

You’re correct. Using Event Tick is what is causing this. The problem is that every frame, event tick is being called. This means that after a player has been killed once, since the branch will remain false at that point, the HUD Delay function is being called every frame. Calling “Set Timer by Function Name” multiple times before the timer completes will cause the timer to reset. The timer will never complete with the current setup.

Hope this helps!