Countdown Timer | End Game Screen - Unreal Engine 4 Tutorial

  Рет қаралды 64,651

Matt Aspland

Matt Aspland

Күн бұрын

Hey guys, in today's video, I'm going to be showing you how to create a countdown timer to count down from any length you choose, once the timer is up, it will end the game or do whatever you wish.
#Ue4 #UnrealEngine4 #Ue4Tutorial
___________________________________________________________________________
00:00 - Intro
00:14 - Overview
00:57 - Tutorial
11:36 - Final Overview
12:09 - Outro
___________________________________________________________________________
Unreal Engine 4 Tutorials Playlist: • Unreal Engine 4 Tutorials
Blender Tutorials Playlist: • Blender Tutorials
___________________________________________________________________________
If you enjoy make sure to subscribe: / @mattaspland
Join My Discord Server: / discord
Follow Me On Instagram: / matt_aspland_
___________________________________________________________________________
If you want to support me, you can PayPal me at "matt.aspland.1@gmail.com". This is by no means expected or required. It is just a nice support :)
Link to PayPal: www.paypal.com/
You can also support me on Ko-Fi following this link: ko-fi.com/mattaspland
Thank you :) ___________________________________________________________________________
♫Music By♫
●Kronicle - Chill Noons
●Soundcloud - / the-chemist-10

Пікірлер: 128
@sn00ph0gg
@sn00ph0gg 3 жыл бұрын
Anyone who wants the timer to go up instead of down: In event tick: 1. change the 2x int - int nodes to int + int. 2. change the 2x equals node value, to 59 (prev 0) 3. change the set seconds node (after the 2nd branch) value to 0 (prev 59)
@mjesensky2760
@mjesensky2760 3 жыл бұрын
My most favourite youtube channel. Thank you Matt, for all your hard work.
@Murderousblue
@Murderousblue 3 жыл бұрын
Fast, clean, concise, and efficient. *Chefs Kiss* A perfect tutorial!
@MattAspland
@MattAspland 3 жыл бұрын
Thank you so much! I really appreciate that man! :)
@JKordero
@JKordero 2 жыл бұрын
Old but gold, thanks dude. I use the widget instead of the character BP and worked like a charm.
@dmw4176
@dmw4176 Жыл бұрын
Matt, Once again you have saved the day! Thanks for this tutorial! DW
@TrojanLube69
@TrojanLube69 3 жыл бұрын
Alternatively instead of using a tick event - fired every frame. You can use a looped timer by event in begin play and make your counter event. If in multiplayer use the game state class.
@beyondtitansstudio
@beyondtitansstudio Жыл бұрын
Thanks, very helpful!
@Ompyt2
@Ompyt2 Жыл бұрын
8:15 I don't understand this part can someone explain this part to me please
@hugifreyr
@hugifreyr 3 жыл бұрын
Awesome, thank you
@MattAspland
@MattAspland 3 жыл бұрын
Thank you! Happy to help :)
@GrumpyMunkyGameDesign
@GrumpyMunkyGameDesign 2 жыл бұрын
Tip for opening the level you're currently in via a widget, theres a 'Get Current Level name' node, plug that into open level by name and bam, now you dont have to change the level manually each time it will always just open the current level :)
@HarkeeratSingh12
@HarkeeratSingh12 3 жыл бұрын
Hey, Matt is it possible that the timer could and reset when approached a place for an end of a level? If so explaining it would be most delighted.
@zGuuust
@zGuuust 3 жыл бұрын
thx very much man! you help so much on my game project of college !
@MattAspland
@MattAspland 3 жыл бұрын
No problem man, so happy to help you out! Best of luck with your project! :)
@francescaromanasartori5963
@francescaromanasartori5963 2 жыл бұрын
Hi! Once I finished the tutorial UE gave me the error "accessed none trying to read property CharacterReference". In this way the timer doesn't start when I click on play. What should I do?
@WillLeamon
@WillLeamon 5 ай бұрын
Ok, so I know this is two years old but I just hit the same wall. Turns out that when setting the Get All Actors of Class to "BP_ThirdPerson_Character" I actually hit Gamemode instead. You can't see it in the graph bc it gets truncated.
@SafaAlkan
@SafaAlkan 3 жыл бұрын
Thanks a lot! You are life saver man
@MattAspland
@MattAspland 3 жыл бұрын
No problem, always happy to help! :)
@suhail6670
@suhail6670 3 жыл бұрын
really i learned alot from ur tuts😊
@MattAspland
@MattAspland 3 жыл бұрын
Happy to help man, glad your learning :)
@mathus1906
@mathus1906 3 жыл бұрын
Thanks !
@MartKart8
@MartKart8 3 жыл бұрын
at 7:52 I clicked on GET and selected promote to variable and it creates a separate variable on it's on saying SET and it doesn't connect to GET. Data was copied over to the GameOver as well, don't know if that's right?
@josedejesusmartinezavalos1403
@josedejesusmartinezavalos1403 3 жыл бұрын
You have some very interesting videos, not to say that they are all very good to learn, thank you for teaching us your knowledge,
@MattAspland
@MattAspland 3 жыл бұрын
Thank you so much! I appreciate the feedback! I'm always happy to help! :)
@MZONE3D
@MZONE3D 3 жыл бұрын
@Matt Aspland hey Matt, I did the timer and it works great. Any idea on a time booster? Eg overlap a volume that adds time to your timer? Cheers for any help.
@jeremyrandall8282
@jeremyrandall8282 2 жыл бұрын
Thank you.
@Alex00m
@Alex00m 3 жыл бұрын
Nice😃😃good stuff 😊👍
@MattAspland
@MattAspland 3 жыл бұрын
Thank you so much! :)
@kamitsu2352
@kamitsu2352 3 жыл бұрын
is there a way to get runtime to show? (instead of having a countdown timer, it's a count (up) timer?)
@shauryasingh6207
@shauryasingh6207 3 жыл бұрын
Noice keep it up 👍
@MattAspland
@MattAspland 3 жыл бұрын
Thank you man, really appreciate it :)
@virx7944
@virx7944 3 жыл бұрын
Hi, would just like to ask if there is actual any performance benefit to not cast every time (ie we do it in the event construct rather than the event graph) very good tutorial btw
@anantaprasadpatra7870
@anantaprasadpatra7870 2 жыл бұрын
HI Matt.I have just started using ue5 and would like a bit of help. I have created a series of sequenced animations in 3dsmax and imported them into ue5. what I would like to do is be able to link all of these to a single slider so I can scrub it back and forth playing the animations with the sequence retained. Eventually I would style this slider out with dates so it acts a timeline. Is this possible and how would I do it?
@rifat.ahammed
@rifat.ahammed Жыл бұрын
Thank You
@CloudyKeebs
@CloudyKeebs 3 жыл бұрын
How would you do this exactly the same except respawn from a checkpoint instead of restarting the level?
@daithiluck8749
@daithiluck8749 2 жыл бұрын
How do I get an interger from the level blueprint to show up on screen? I'm trying to make a remaining enemies counter.
@arashhurbash7513
@arashhurbash7513 2 жыл бұрын
nice,,,,, like always
@pro_di_galson6889
@pro_di_galson6889 3 жыл бұрын
Thank you very much
@MattAspland
@MattAspland 3 жыл бұрын
No problem! :)
@sonyaburkholz2105
@sonyaburkholz2105 2 жыл бұрын
Can you color the tires?? I want to make the red color come out when there are 30 seconds left.
@luciferteaparty
@luciferteaparty 2 жыл бұрын
Ey you made this on my birthday last year
@thatchyhurdle4271
@thatchyhurdle4271 Жыл бұрын
does anyone know how you would make it possible so when you walk through a door the timer resets back to the original time
@Mericali916
@Mericali916 Жыл бұрын
I know this video is 2-years old, but is there a way to use the timer logic on a material? I want it to show on a modeled tv screen mesh. Now sure if I could add the logic to a material or if anything like that is possible. Thank you for putting the time into this tutorial either way.
@suhail6670
@suhail6670 3 жыл бұрын
great content keep it up bro
@MattAspland
@MattAspland 3 жыл бұрын
Thank you much dude, I really appreciate it :)
@sovietgirlinseoul7257
@sovietgirlinseoul7257 2 жыл бұрын
The timer works very well. But can I add a sound here too? I want to make a sound when there are 30 seconds left.
@freakmania2426
@freakmania2426 8 ай бұрын
its best practice to put game timer or countdown in game mode blueprint, if its a multiplayer game its mandatory to do it
@le_kaki_rouge
@le_kaki_rouge 3 жыл бұрын
Hi I was told never to put a delay in front of the event tick, is it true?
@j_productive
@j_productive 2 жыл бұрын
You're the best
@YouWillDoAsYouAreTold
@YouWillDoAsYouAreTold 3 жыл бұрын
thanks
@MrAcetex0620
@MrAcetex0620 3 жыл бұрын
Good tutorial. I only wanted the timer on one level. So instead of placing code on third person character I did it on the widget itself. Called the widget like normal in the which level BP that needed timer. Thank you.
@Junqers
@Junqers 2 жыл бұрын
Hey there I've been trying to get it working only on certain levels, would appreciate your guidance! :D
@user-dj6oi5hw3m
@user-dj6oi5hw3m 5 ай бұрын
passing software dev classes thanks to Matt
@leszczynski3044
@leszczynski3044 2 жыл бұрын
What if you wanna save it for when the player saves games
@-Life-qk2uj
@-Life-qk2uj Жыл бұрын
Nice i got one problem is possible to make counter with save game,like i play and have 200minute left and i save game and i save game on 200minute left tommorow i play counter go down as i load my save game
@arashhurbash7513
@arashhurbash7513 2 жыл бұрын
beautiful coding teqnique
@BrownSkittle
@BrownSkittle 3 жыл бұрын
This was great. Thank you for showing me how to add a countdown timer! Question to anyone who can answer: if I’m changing the countdown time for different levels, where should I place the code (in what blueprint) and how do I change the time variables easily? Any help would be much appreciated!
@MattAspland
@MattAspland 3 жыл бұрын
Hey, thank you and no problem! :) Also, either the character blueprint or gamemode blueprint would be a good place for it. And an easy way to change it would be to promote them to variables so you can just change the variables for minutes and seconds, which will automatically change them in the code. Hope that makes sense, let me know if you need more explanation :)
@BrownSkittle
@BrownSkittle 3 жыл бұрын
@@MattAspland Thank you Matt for the reply. I do have both (minutes & seconds) as variables. However, if I want the time to be different in level 1 than in level 2 changing the variables still makes the time the same in both levels. What do you recommend to have 1:30 timer in level 1. Then in Level 2 have a timer of 2:10?
@MattAspland
@MattAspland 3 жыл бұрын
@@BrownSkittle No worries, and okay alright. What I'd recommend then is to go off of event begin play and get the level name to see if you are in level 1 or level 2. Then if you are in level 1, set the variables to 1:30 and if it is level 2, set them to 2:10. Also, where I wrote level 1 and level 2, that is in an == and make sure that is the same name as your levels, written the exact same way too. I'll write this code in Unreal and link a screenshot below so you know what I mean. This should work for you, hope this helps and let me know if you want me to explain it a little more :) imgur.com/a/UqfBSnJ
@BrownSkittle
@BrownSkittle 3 жыл бұрын
@@MattAspland I have been searching for a simple solution for hours and that did the trick really quick! As you can probably tell I am still a noob but thank you so much Matt for taking the time to not only reply, but to build the code, take a screenshot, and share it with me. I truly appreciate that. I can't wait to share with you the game I'm making once I am done! Have a great day man and you are awesome!
@MattAspland
@MattAspland 3 жыл бұрын
@@BrownSkittle No problem man, it's always a pleasure to help out! Thank you too man, I can't wait to see how it comes out too, I'm sure it'll be great. I wish you all the best of luck with your game! Have a great day too! :)
@DannRees
@DannRees 3 жыл бұрын
This is a very weird way of doing it. Why not just used a TimerByEvent node? Delaying for a second on tick is like saying "Sixty times a second (or whatever your FPS is), wait a second". You can also calculate minutes/seconds from just counting the seconds in one variable and using / and %. TimerByEvent also allows you to pause and stop the timer easily.
@jaedenroberts7821
@jaedenroberts7821 3 жыл бұрын
........
@badirelaryf626
@badirelaryf626 3 жыл бұрын
Thanks a lot for this great tutorial! I am a beginner and your explanation got it working right away!! I have one question: How can I keep the timer counting down through all my levels? every time I go from level to level it starts counting from the beginning again.
@MattAspland
@MattAspland 3 жыл бұрын
Hey, no problem man, that's great to hear! I assume you could do that by creating this code in the game mode blueprint, or player blueprint, and maybe setting the current time into a variable for you to load upon switching levels. However, you may need to create a save game to properly load the correct time remaining. Inside the save game you can set the minutes and seconds. Save these when switching levels, and load them once the level has loaded. I have a video on general saving and loading, and the above paragraph should help be a little more specific. Save and Load Tutorial: kzfaq.info/get/bejne/mdWApLZlyrrUmIE.html I hope this helps, and let me know if there is anything else I can do, or explain a little more :)
@badirelaryf626
@badirelaryf626 3 жыл бұрын
hi Matt, Thank you again for your help. I tried everything you suggested, but unfortunately it doesn't work and the time still restarts at every level. But like I said I am new to this and I think this is a little bit out of my league ;-)
@MattAspland
@MattAspland 3 жыл бұрын
@@badirelaryf626 Ah right okay, well it can always be something to come back too. Or I can add it to my video to do list as well. Unless there is something else I can do to help :)
@badirelaryf626
@badirelaryf626 3 жыл бұрын
That would be great if you could do something like a video in addition to this tutorial video in the nearby future ;-) I'll wait it out, and keep an eye on your videos. Thanks again!!
@ashwinmuthukumar
@ashwinmuthukumar 2 жыл бұрын
i want the game to quit when the player is idle for 10 seconds.... can anyone help me?
@SnakeForcePictures
@SnakeForcePictures 2 жыл бұрын
Thank you for the tutorial. Just a question: How to put the countdown in only one level and not a the start of the game please?
@SnakeForcePictures
@SnakeForcePictures 2 жыл бұрын
Finally I copied the code in new actor blueprint which I putted in my desired level and it works.
@apollotrek9918
@apollotrek9918 3 жыл бұрын
Hey Matt, quick question if you get to read this, how would you make the timer continue to count after being killed & respawned so it doesn't reset the timer and punishes the player? Cheers.
@guysheraizin7455
@guysheraizin7455 3 жыл бұрын
yeah I have this problem to
@apollotrek9918
@apollotrek9918 3 жыл бұрын
@@guysheraizin7455 I had to email him for some help, you'll want to put the code into the Game Mode Blueprint so it doesn't die with the player's death and change around the Player's reference variables for Game Mode References
@brentharemza4879
@brentharemza4879 3 жыл бұрын
how does your timer start at 1:15? i did it all correctly but i cant seem to set the time to start counting down. its just at zero.
@MattAspland
@MattAspland 3 жыл бұрын
Hi, did you remember to set the default values of your minutes and seconds variables?
@brentharemza4879
@brentharemza4879 3 жыл бұрын
@@MattAspland where would i do that?
@MattAspland
@MattAspland 3 жыл бұрын
@@brentharemza4879 It would be in the variables we have created, these will be on the left of your screen under "Variables" in your blueprint where this code is.
@Charmaine1077
@Charmaine1077 3 ай бұрын
I followed the tutorial but I keep getting the "Blueprint Runtime Error: "Accessed None trying to read property Char REF". Blueprint: Timer Function: Get Minutes Text 0 Graph: Get_Minutes_Text_0 Node: Return Node" error. I do not understand why.
@thevzxs2549
@thevzxs2549 11 ай бұрын
For me I made it 3 minutes. It adds two seconds then on the seconds goes to 00 and then adds 2 seconds again. The minutes do not change and keep at 3. What should I do?
@r_e_d_squirrel367
@r_e_d_squirrel367 2 жыл бұрын
super duper cooper
@ForestBoyDev
@ForestBoyDev 3 жыл бұрын
Is there an easy way to make it so the timer only happens on certain levels? It all works for me but I dont want the timer on every single level?
@MattAspland
@MattAspland 3 жыл бұрын
Hey, yeah I think this should work. If you go off of Event Begin Play, and then "Get Current Level Name" and promote that to a variable. Then check to see if this is equal to another string, with the value of the Level Name you would like. Put that in a branch and out of the true go into your timer, or set the minutes and seconds to what you like. I hope that makes sense and fixes this for you :)
@ForestBoyDev
@ForestBoyDev 3 жыл бұрын
@@MattAspland would that be on the level blueprint or third person? Sorry! Ima noob ahah. Awesome tuts though, learning loads!
@MattAspland
@MattAspland 3 жыл бұрын
No worries mate, it would be in the third person character blueprint. I wish you the best of luck with your learning, you got this. And thank you man, happy to hear it :)
@mr.zeping4800
@mr.zeping4800 3 жыл бұрын
can use this for my game (the new car racing one)
@MattAspland
@MattAspland 3 жыл бұрын
Yeah that sounds great! Best of luck with it, glad this could help you :)
@aya.alabhar
@aya.alabhar 2 жыл бұрын
How to stop the timer after winning the game?
@abdullahsohail5395
@abdullahsohail5395 3 жыл бұрын
Can u please make a video how to make objects fall by itself like pic book etc when my character reach that point . I am making a horror game and I really need it liked your video please make next video on that
@MattAspland
@MattAspland 3 жыл бұрын
Hey, I can definitely do that in the future, it won't be my next video, but it can be one soon :)
@DigitalLoom
@DigitalLoom 3 жыл бұрын
thank you for this !!! but how do we get it to start from 0 and then go forward
@MattAspland
@MattAspland 3 жыл бұрын
no problem, and essentially you would do the opposite, so for example adding instead of subtracting. If you need a video and better explanation on this let me know :)
@DigitalLoom
@DigitalLoom 3 жыл бұрын
@@MattAspland thank you for the reply! so i tried what you told me in my main bps cars event graph i replaced the minus class with the + integer i was able to get the clock to go forward by setting seconds to 0 but its not accurate. it counts only on the minute side then it restarts at zero!!! very confusing!! but if you could make a quick video from where you left off making it tick going forward i would really appreciate your effort and time!!!!
@MattAspland
@MattAspland 3 жыл бұрын
Okay no worries, I could make that soon I think :)
@ahyin9567
@ahyin9567 2 жыл бұрын
8:38 so max is 59:59?
@dewaldoosthuizen3778
@dewaldoosthuizen3778 2 жыл бұрын
please make a nice stopwatch !
@uu8ro
@uu8ro 2 жыл бұрын
my timer is not visible. does anyone know what could be the problem?
@charzxd6515
@charzxd6515 2 жыл бұрын
your not adding to viewport
@tesquilo
@tesquilo 3 жыл бұрын
Can you make how to stop timer when you reach end of level or something like that. Awsomeeeeeee 😄😉
@MattAspland
@MattAspland 3 жыл бұрын
I could look into that yeah :)
@tesquilo
@tesquilo 3 жыл бұрын
@@MattAspland now you have a lot of homework heheh thx again 😉
@MattAspland
@MattAspland 3 жыл бұрын
Yep hahaha, no worries :)
@yghtim
@yghtim Жыл бұрын
when the frame rate of the game goes down, the clock will slow down. Will it not?
@MRxBADGER
@MRxBADGER 3 жыл бұрын
Does this timer work for multiplayer?
@MattAspland
@MattAspland 3 жыл бұрын
I haven't properly tested it yet, but I believe it would yes. Just make sure to put it on every player's screen, not just the one. Unless that's what you want of course.
@g-dojjo
@g-dojjo 3 жыл бұрын
Thanks for this tutorial i wanna using this for my game project but i have 1 question :D We can add more time in game ? example if im take 1 item its give a 15 sec. ? (sorry for bad english :( )
@MattAspland
@MattAspland 3 жыл бұрын
Hey, no problem :) And yep you could do that. On your pickup you could cast to your character and get the seconds variable then add 15 to it. If that variable gets to 60 or above, set the minutes to + 1 and the seconds back to 0. Hope that makes sense :)
@g-dojjo
@g-dojjo 3 жыл бұрын
@@MattAspland Thanks for your help ^^ I want try this today and i think i can do this with your video ^^ thank you so much you are life saver ! :D
@MattAspland
@MattAspland 3 жыл бұрын
@@g-dojjo No problem man, that's great to hear. Always happy to help! Let me know if you need any extra help with it :)
@g-dojjo
@g-dojjo 3 жыл бұрын
​@@MattAspland Thanks again!!and good to hear that :D Now im testing it and work like a charm! ^^ Im trying make a Road Fighter(NES game) Style game :D
@MattAspland
@MattAspland 3 жыл бұрын
@@g-dojjo That's great to hear, no problem dude :) And that sounds amazing too, I wish you all the best of luck with it, I'm sure it will be amazing! :)
@ArtVandelayInc
@ArtVandelayInc 3 жыл бұрын
Isn't it an expensive way to make a timer using an event tick? Right now I don't know a different method so I'm asking for some wisdom
@MattAspland
@MattAspland 3 жыл бұрын
It can be yeah, but since I am only using it for this one thing, it isn't too bad. However, to be more efficient, you can use a custom event instead and loop it at the end of your code by "Call Function 'Custom Event Name'". Hope that makes sense, let me know if you want a more in-depth explanation :)
@TylerClarkTech
@TylerClarkTech 2 жыл бұрын
it's ticking very fast.
@elbozomemeoriginals7296
@elbozomemeoriginals7296 3 жыл бұрын
why can i place minutes in the event graph of widget
@MattAspland
@MattAspland 3 жыл бұрын
Hey, this is because when we cast to our character where we are storing the variables, we can then access them and use them. I have a video on explaining cast nodes if that helps to understand it more :) kzfaq.info/get/bejne/gNKEprCotbq7mX0.html
@elbozomemeoriginals7296
@elbozomemeoriginals7296 3 жыл бұрын
but i want a timer that counts how many old we have stun the enemy
@MattAspland
@MattAspland 3 жыл бұрын
@@elbozomemeoriginals7296 Sorry I'm not sure I understand, you want a timer which counts up since you stunned an enemy?
@elbozomemeoriginals7296
@elbozomemeoriginals7296 3 жыл бұрын
@@MattAspland yes
@MattAspland
@MattAspland 3 жыл бұрын
@@elbozomemeoriginals7296 Right okay, what you could use is the "Timer by event" node, and out of that "get time elapsed". Hope this helps point you in the right direction :)
@partacanna
@partacanna 2 жыл бұрын
My game count down is 110 minutes.
@Generic4332
@Generic4332 Жыл бұрын
didnt work
@adamjensen253
@adamjensen253 2 жыл бұрын
My most favourite youtube channel. Thank you Matt, for all your hard work.
UE5 Blueprint Tips - Timers
17:26
UnrealityBites
Рет қаралды 10 М.
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 15 МЛН
Inside Out 2: Who is the strongest? Joy vs Envy vs Anger #shorts #animation
00:22
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 26 МЛН
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 43 МЛН
Unreal Engine 4 Guide - Scoreboard
15:23
Tefel - Astro Colony
Рет қаралды 41 М.
Timer / Countdown - Unreal Engine 5 Tutorial [UE5]
18:20
NiceShadow
Рет қаралды 4,5 М.
How To Create Portal Doors | Teleporting - Unreal Engine 4 Tutorial
19:34
Set Timer By Function Name/Event | Unreal Engine 5 Tutorial
15:52
Tyler Serino
Рет қаралды 12 М.
How to make TIMER in unreal engine 4 and 5
6:54
Sir Fansi
Рет қаралды 20 М.
How to Make a Game Start Countdown in Unreal Engine 5
7:49
Gorka Games
Рет қаралды 6 М.
AI Sight Detection And Chase With Music - Unreal Engine 4 Tutorial
10:51
How to Make a Lever for Virtual Reality with Unreal Engine
17:31
VR Playground
Рет қаралды 10 М.
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 15 МЛН