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"

Widget won't Disappear after Timer is done.

Okay I have a timer that starts as I pick up a collectible item, but no matter what I do, when the timer hits 0, the 0 stays on the screen....

It is supposed to destroy my object, and start a timer that displays on the screen.When the timer hits 0 I want it to remove the timer widget from the viewport. The problem is, the 0 stays on the screen. Any ideas?

alt text

The solution: alt text

It turns out the problem was that I was making 20 widgets and then only deleting one. My solution was to add a delay node that would delay the sequence by one second, and then remove the widget as the next one was being created. So the timer would say 20, and 1 second later, the 20 would be deleted at the same time as the 19 appeared on the screen, giving it a seamless transition in a timer look-alike.

Product Version: UE 4.12
more ▼

asked Sep 15 '16 at 03:56 PM in Blueprint Scripting

avatar image

22 5 7 8

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

2 answers: sort voted first

I think you need to pass Self into your SetTimerByFunctionName node as the Object param

more ▼

answered Sep 15 '16 at 04:28 PM

avatar image

474 24 21 51

avatar image Cougarkillz Sep 15 '16 at 04:57 PM

I'm not quite sure what you mean.

avatar image RuBa1987 Sep 15 '16 at 05:02 PM

Take a look at your SetTimerByFunctionName node, the 1st param it takes is called Object, you need to pass something into that. Drag off that pin and type Self. That's what you need.

The problem, I think, is that SetTimerByFunctionName doesn't know what object that function lives on. It may be obvious to you that the MustartdTime function lives on 2DSideScrollerCharacter but it doesn't know that

avatar image Cougarkillz Sep 15 '16 at 05:05 PM

I tried that, didn't work. Also tried adding the reference to self on the clear timer node, that didn't work either.

avatar image CriErr Sep 15 '16 at 05:05 PM

no, its self by default, this part is fine.

avatar image RuBa1987 Sep 15 '16 at 05:08 PM

the only other thing I can think of is something is wrong w/ your MustardCountdown decrement logic. Can you post that? Might be better to use the NearlyEqual node instead of <=. Floats can be funny

avatar image Cougarkillz Sep 15 '16 at 05:28 PM

It's in the original picture up there... I somehow deleted the line that displays the image but the link to view it is still there. Basically, every 1 second the set timer node calls the MustardTime event. The mustard time event subtracts 1 every time it is called, which is every second, which is how the timer counts down. As the timer is counting down, while it is above 0 the branch is false, so it creates the widget. Once it hits 0 it sends a signal to true where it is supposed to erase the widget. The problem is, it doesn't erase (I ran the game with the bueprint open so I could see the signals. It DOES send a signal down the true path, it just doesn't remove the timer widget from the screen).

avatar image RuBa1987 Sep 15 '16 at 05:33 PM

wait a sec, you're not storing the widget you're creating. You can't hook the creation up to the remove node. Store the widget as a variable when you create it and remove that from the parent instead

avatar image Cougarkillz Sep 15 '16 at 05:42 PM

I see what you are saying, how would I go about doing that? (I'm still a noob when it comes to this. I'm trying to learn by making a 2d scroller that isn't going so well haha)

avatar image RuBa1987 Sep 15 '16 at 05:47 PM

Right click ReturnValue on the CreateMustardTimerWidget node and select Promote to Variable to create a variable and then fix your execution line if needed. It should automatically create a setter for IIRC

Drag that variable out onto your graph and click Get to get it. Hook the get one up to RemoveFromParent and unhook the other one from RemoveFromParent

avatar image Cougarkillz Sep 15 '16 at 06:09 PM

I posted a screenshot of the change, did I do it rght? Because that still doesn't work.

avatar image RuBa1987 Sep 15 '16 at 06:14 PM

Yep, that's right. Now you need to see how many time your calling the false branch of that function before you call the remove. I have a suspicion that you're creating >1 widget.

Put a break point on both the AddToViewport and RemoveFromParent nodes. see how many times AddToViewport is called before RemoveFromParent is called.

avatar image Cougarkillz Sep 15 '16 at 07:47 PM

It looks like it does it once per tick, so by the end there are 20 of them. Is that why the number stays there? It makes 20 but only erases one?

avatar image RuBa1987 Sep 15 '16 at 08:06 PM

Yes, you're only erasing 1. You need to prevent it from creating more than 1. Or create 1 initially and toggle visibility instead of create/destroy

avatar image Cougarkillz Sep 16 '16 at 03:11 AM

Any idea how to go about doing that? I tried a few experiments but they failed so I went back to this setup since I can freely admit I don't know enough to get this done. xD

avatar image Cougarkillz Sep 16 '16 at 09:31 AM

Actually I figured it out.... apparently, all I had to do, was add a delay node after the "Add to Viewport" to make it wait a second, and then move the "Remove from parent" node to after the "delay" node. So it would make the widget, wait 1 second, and then remove it as the next widget was created with a new number.

Thank you for leading me to this idea though, it's greatly appreciated!

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

Problem might be in the "function part", since you used custom event.

more ▼

answered Sep 15 '16 at 04:31 PM

avatar image

1.2k 57 19 55

avatar image Cougarkillz Sep 15 '16 at 04:56 PM

But it all works correctly until it comes to removing the widget. Everything is working, but when the timer hits 0, the 0 stays on the screen. I just replaced the function part with a set timer by even node, and it did the same thing.

avatar image CriErr Sep 15 '16 at 05:10 PM

ok, maybe they fixed it.

so, whats going on here http://puu.sh/rcfm6.png

if branch false, you create widget and add it to viewport, but if branch true you attempt to remove from parent widget which is not created, output of create widget function. It doesnt have any sence.

I believe you should even have log warning messages about input of remove from parent not being valid, check output log.

avatar image Cougarkillz Sep 15 '16 at 05:15 PM

The timer is counting down. If the timer is above 0 it goes through the false branch and creates the widget that displays the countdown. Once the timer hits 0, it goes through the true branch, and since the widget was created from the false branch, there is a widget to remove. It just doesn't remove it and the 0 sits on the screen.

avatar image CriErr Sep 15 '16 at 06:46 PM

oh, that's looping timer, maybe then you should use timeline?

(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