Digital countdown timer

Tutorial collection, comprehensive listings on main site.

Digital countdown timer

Postby Tutorial on Wed Jan 02, 2013 6:50 pm

category
General Half-Life 2/Entities

description
Learn how to make a 59 second digital countdown clock.

keywords
clock, countdown, digital, timer, button, logic_timer.

This tutorial will teach you how to make a 59 second digital countdown which activates after pressing a button.

To start off with we will want to create the numbers, select the front faces of each piece and select a bright texture (i recommend lights/white001) select all the pieces and change them all to func_wall.
name each individual piece, this is what i named mine:

Image

Select all the pieces and change the fx color to something really dark like 10 10 10

Image

Make a logic_timer which starts disabled, has a refire interval of 10 seconds and a name. i named mine 1seconds

Image

to start off with we will make a number 9, to do this we will use the logic_timer and add 7 outputs, make them exactly the same as the image:

Image

What you have done is changed some of the colors of the pieces for the right digital number, if you were to set the logic_timer to start enabled and run the map as a test what would happen is after 11 seconds of looking at the digital numbers you would suddenly see a red number 9 because the fx color is RGB (Red Green Blue) the parameters have all been changed from the default dark 10 10 10 to 255 10 10, leaving second12 blank creates the number 9, use the top image as a reference if you are still confused.

Next we will work on making the number 8, this will be easy all we have to do is copy all the outputs we created for the number 9 and change second12 so that it is red aswell and you will have a number 8, make sure instead of a delay of 1 second there is a delay of 2 seconds instead so for the first second you get the number 9 and the second a number 8:

If you were to run the map this time after 11 seconds you would get a number 9 and then 1 second after that the number 8.

Now to make a number 7 we will have to remove the light from second8, second11, second12 and second13 like this:

Image

All you are doing is changing the colors so that they match what numbers look like, i'll leave it up to you to do the rest you should be able to understand how it works now, just do all the numbers down to 0 and remember to keep adding a 1 second delay for each number or the numbers will glitch up.

When you have finished adding the numbers 9 to 0 you are finished with the logic_timer, don't forget to change it back to start disabled if you were running the map for tests.

What you will do now is make a func_button, set it up so the delay before reset is greater than 60 seconds if you want the countdown to be used more than 1 time, copy and paste all the outputs you put into your logic_timer into the outputs for the button and change them a little bit make it so these ones work on pressed instead of ontimer, also make it so on pressed the logic_timer is enabled with no delay, the reason you need to copy all the work you did in logic_timer over to here is because for the first 10 seconds after the logic_timer is enabled it won't do anything, there needs to be a 10 second delay so it does its count from 9 to 0 so in order to make up for the first 10 seconds not being displayed they have to be added to the button so they work instantly 1 time.

Now we will work on the left side of the digital countdown, there is no point of making a second logic_timer for these as these numbers will only be displayed 1 time so we will add them to the func_button, make the number 5 and don't forget that now you are working on second1 to second7 and not second8 to second14.

Image

Instead of a 1 second gap you'll want to make it a 10 second gap for all these numbers, make all the numbers from 5 to 0.

Finally, make an output for the button which makes it so that after 60 seconds of being pressed the logic_timer is disabled.

And thats it! You have created a countdown timer which counts down from 1 minute.

- NAPREDATOR
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Re: Digital countdown timer

Postby Ade on Thu Jul 17, 2014 11:13 am

Could you make one for minutes (at least 1 digit for it), seconds and milliseconds, please?
User avatar
Ade
Regular
Regular
 
Joined: Mon May 12, 2014 10:26 am

Return to Tutorials

Who is online

Users browsing this forum: No registered users

cron