Hide HUD widget after X seconds

please explain your last note about delay.

Hello guys.

I made a HUD that displays the Item that you just picked up.

It works, but I want the widget to disappear after X seconds and also, I want it not to overlaps.
Yes because if I take 2 items, the name of those overlaps each other.

THIS IS THE BLUEPRINT WHEN THE PICKUP IS TAKEN

THIS IS THE WIDGET BLUEPRINT

How can I solve this problem?

Thanks in advance!

PLEASE NOTE!
I know that to delete a widget I’ve to use Remove From Parent.
The problem is that I want the widget to disappear after 2 seconds AND if I use the Delay node, then my Item will spawn with 2 seconds of delay!

Hello and thanks for the answer.
Well, when I take the Pickup it calls the Pickup’sOnActorBeginOverlap
In that event, before REspawning the Pickup, i use a Delay node that waits X seconds before respawning the pickup.

If I add a new delay node for the Widget… well… the two delays add up and then the pickup spawns late

As i understand each time you will pick up item widget must add your view port (with 2 second lifetime) and widget must add every time without 2x delay , yes?

How are you doing the spawn of your item?

If you just put that behind it can’t you just change the order or use a sequence?

For the none overlap you need to check how many of those widgets are on your screen right now and move it further to another place. Or do a type of event log. That honestly is a lot more complex than a simple “yea just add that node”.

How should they not overlap? Where are they right now? That’s a quite tall order and a significant element of your game.

Yes. I want the widget that displays “You picked up 50+ health!”.
This message must display 2 seconds, BUT without interfering with the original pickup respawn delay.

When I pickup the health, this happens:

When I also pickup the armor:

They get overlapped! And no one of them disappears after 2 seconds as I want them to do

Well why not (for example) make it smaller and move upwards on event tick (of the widget)?

you can simply add animation to your widget text… move up health text and decrease opacity and you avoid 2 widget collision. Also you can take one main widget and don’t destroy it and when you will pick up second pickup just update its text.

“Also you can take one main widget and don’t destroy it and when you will pick up second pickup just update its text.”

Ok, I’m gonna take this way. So, where do I create the MAIN widget istance? And how to update the text? The variable to update is “ItemNameReceived”

You can create main widgets instance in your_character pawn and save there. Add “change text” function to your widget and when you will pick up healing item , call this function from character pawn.

Ok listen. In the first person character I created a new (main) widget:

Now, in the health pickup, when I call the “Change Text” function that I created in the ItemPicked widget, it asks me a ItemPicked reference. Where do I get that variable?

This is the “ChangeText” function in the main widget blueprint

There’s a little confusion. When I create the main widget i’m in this situation:

There are 2 variables that I created in the FirstPersonCharacter:

  • ItemPickedWidget (an User Widget Reference)
  • ItemPickedReference (an ItemPicked Reference)

Now, this is the health pickup:

The “ChangeText” requires an ItemPicked Reference, BUT in the FirstPersonCharacter the Create Item Picked Widget only returns an User Widget Reference

SO, how can i deal with this?

Thanks

get this variable from the your first person character where you created this widget

don’t forget to make this widget variable public to get from outside of third person character

Ok so please do what i would say.

  1. add function “change health” to your third person character which will call “change text” function and it has already item picked reference.
  2. from pick up call “change” health function

Mhm… “add function “change health” to your third person character which will call “change text” function and it has already item picked reference” that’s not true…

This is the pickupHealth blueprint

Firstly , please add “Item_picked” widget reference to your third person character. Then from “Add Health” function call this “change text” function which is located in “Item_Picked” widget. Lastly call “Add Health” function from PickUpHealth bp.

Firstly , please add “Item_picked” widget reference to your third person character.

Done.

Then from “Add Health” function call this “change text” function which is located in “Item_Picked” widget.
I already do

Lastly call “Add Health” function from PickUpHealth bp.
I already do

The problem lies in the second image. I still need the TARGET for ChangeText

Thanks for you patience anyway :slight_smile:

On Begin play make this widget and store in this reference.
then call its function.