x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Hide HUD widget after X seconds

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 alt text

THIS IS THE WIDGET BLUEPRINT alt text

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!

Product Version: UE 4.9
Tags:
1.png (134.9 kB)
2.png (130.1 kB)
1.png (203.7 kB)
more ▼

asked Oct 26 '15 at 03:46 PM in Blueprint Scripting

avatar image

gedamial
127 38 37 50

avatar image kubiknubik Oct 26 '15 at 03:53 PM

please explain your last note about delay.

avatar image gedamial Oct 26 '15 at 04:00 PM

Hello and thanks for the answer. Well, when I take the Pickup it calls the Pickup's*OnActorBeginOverlap* 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

avatar image kubiknubik Oct 26 '15 at 05:09 PM

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?

avatar image gedamial Oct 26 '15 at 06:40 PM

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.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Oct 26 '15 at 07:07 PM

avatar image

kubiknubik
336 17 3 17

avatar image gedamial Oct 26 '15 at 07:23 PM

"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"

alt text

5.png (177.3 kB)
avatar image kubiknubik Oct 26 '15 at 07:41 PM

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.

avatar image gedamial Oct 26 '15 at 08:12 PM

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

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? alt text

This is the "ChangeText" function in the main widget blueprint alt text

1.png (229.2 kB)
1.png (131.2 kB)
2.png (200.9 kB)
3.png (52.8 kB)
avatar image kubiknubik Oct 26 '15 at 08:23 PM

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

avatar image kubiknubik Oct 26 '15 at 08:28 PM

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

avatar image gedamial Oct 26 '15 at 08:36 PM

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

alt text

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: alt text

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

1.png (162.8 kB)
2.png (146.9 kB)
avatar image kubiknubik Oct 26 '15 at 09:05 PM

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

avatar image gedamial Oct 26 '15 at 09:26 PM

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...

alt text

This is the pickupHealth blueprint alt text

1.png (222.5 kB)
2.png (283.6 kB)
avatar image kubiknubik Oct 26 '15 at 09:36 PM

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.

avatar image gedamial Oct 26 '15 at 09:44 PM

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

Done. alt text

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

alt text

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

alt text

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

Thanks for you patience anyway :)

1.png (296.3 kB)
2.png (202.6 kB)
3.png (144.2 kB)
avatar image kubiknubik Oct 26 '15 at 10:08 PM

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

storewidget.png (64.7 kB)
avatar image gedamial Oct 26 '15 at 10:25 PM

I really really really thank you very much!

I don't know where you get all this patience.

You're awesome!

avatar image kubiknubik Oct 26 '15 at 10:36 PM

You are great , because you tried and get successful result (y) good job man

(comments are locked)
10|2000 characters needed characters left

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.

more ▼

answered Oct 26 '15 at 06:38 PM

avatar image

Erasio
5.9k 291 86 293

avatar image gedamial Oct 26 '15 at 06:58 PM

When I pickup the health, this happens: ![alt text

When I also pickup the armor: alt text

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

5.png (880.8 kB)
5.png (880.8 kB)
6.png (899.9 kB)
avatar image Erasio Oct 26 '15 at 07:00 PM

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

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question