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"

How can I add a Countdown Timer to a Level with Blueprints (e.g. Time Limit to complete a Level)

I'm having trouble trying to create a countdown timer with Blueprints. As I'm not sure where to start with it.

I'm trying to create a timer that can be placed into individual levels, and will display on the Player's HUD, the time remaining. (The reason I'd like it to be placeable and editable into different levels is that different levels will have different times required to complete them).

What I'm aiming to create is a time limit to complete the level, If the timer hits "0", then a "Game over" with a "Restart" button appears.

Any help with this would be absolutely appreciated, Thanks!

Product Version: UE 4.10
more ▼

asked Jan 12 '16 at 09:29 AM in Blueprint Scripting

avatar image

46 18 25 28

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Enjoy. This is my simple timer with 2 functions and 2 events. First event is for each tick and second is called when time is up. On TimeIsUp event you can clear the timer(we saved a handle for it) to stop ticking or you can restart it(otherwise this event will keep firing) alt text

Also you can use EventDispatchers instead of simple events to bind multiple events to it:

alt text alt text

timer.png (292.9 kB)
timer3.png (270.7 kB)
timer2.png (145.3 kB)
more ▼

answered Jan 13 '16 at 10:02 AM

avatar image

250 20 19 34

avatar image A.M.K Nov 21 '16 at 03:47 PM

How do I create the "Cast To gm_mainMenu" in Level BP?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I would use timeline for that, here's an example :

![alt text][1]

I thought there was a node for that, but I couldn't find it.

But time line should work fine.

Good luck !

timerquestion.jpg (140.7 kB)
timerquestion.jpg (140.7 kB)
more ▼

answered Jan 12 '16 at 09:21 PM

avatar image

101 3 5 25

avatar image MikeyBGames Jan 12 '16 at 11:20 PM

I can't quite see where I can enter or change the time for the levels, Also Would this display the Time in mm:ss or just seconds?

Could you show how you made the custom event please? Thank you very much for replying!

avatar image MateuszW93 Jan 13 '16 at 10:30 AM

On the left there is a node "make literal float" , You will need a variable there, thats the start time.

About setting Your time in the level, You could make an actor to CoundDown with Start time variable that is editable, than it would be possible by seting the time in that actor details. Probably the simplest one

Other better way, but not that simple would be calling CountDown in game instance blueprint

alt text

You would need to set map index when changing the map. It's much better, because you would have all times in one place

On the right side there is a node called "Time Seconds to String" it changes seconds to mm:ss:ms

To create custom event -> right click "custom event"

To call it -> right click "call (event name)"

avatar image FiftyStars Jan 13 '16 at 11:09 AM

I believe that timeline is not a good way to create timers. You can have tons of timers and timeline nodes are evaluated each tick. So for example updating 100 timers 30+ times per second(3000 updates each second) isnt good for your performance. Timer events are really good for such purposes.Even 0.1s refresh rate can save you 2000 calls.

avatar image MateuszW93 Jan 13 '16 at 11:52 AM

Well MikeyBGames will only need one timeline for his countdown, and timelines seems to be more accurate and easier to set up.

avatar image FiftyStars Jan 13 '16 at 12:07 PM

I just mean that timelines are made for a bit diffferent purposes. And about accuracy: by using a timer you can even create a floating refresh rate(when 90 secs remaining RR is 1update/sec, but when timer reaches 10s you can change RR to 10updates/sec etc). I believe its more flexible way for creating a timers. Also event dispatchers can be really useful when many BPs want to know about new second or about time expiration.
BUT timelines still can be used for some simple logic.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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