Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How to make a time system

Hi I'm Darth J and I am going to be your teacher for this lesson.
I am going to teach you how to make time system.
First get your self four variables and name them: Hours1, Hours2, Minutes1 and Minutes2 got all that? Good.
Now we need a common event so go get one and I'll eat a sandwich while I wait.
Show hage eww hot oge "gulp" sorry so have you got one? "chours of "yes Darth J"" Good.
now put a loop event into it. Ok when you have that put a wait command into the first line this command needs to be half your frame rate. The default is forty and that means forty frames a second. Now the wait command doubles the frames you actualy want to wait so if you wait forty frames event wise you wait eighty game wise got that? Good.
So if you havent tamperd with the frame rate wait 20 frames. Now I need a glass of water so you do that while I go and get one."Five minutes later" ok so have done that? "chours of "yes Darth J"" Good. "Glug" Now at the end of those 20 waited frames add an event that controls the "minutes2" variable and make it add one to that variable. When you have done that add a conditonal branch that when the variable "minutes2" is nine you change "minutes1"
by adding 1 to that variable and setting "minutes2" to zero. After you make that one make another conditonal branch that states when "minutes1" is six you add one to "hours2" and "minutes1" is set to zero. so you have got an hour set up thats brilliant but the are four more conditonal branches to go :cry:. now make another conditonal branch that states when "hours2" is nine and another conditonal branch states that "minutes1" is six you can add one to "hours1" and set "hours2" to zero. Now you need a conditonal branch that says when variable "hours1" is two and another that says when variable "hours2" is 4 change both "hours1" and "hours2" back to zero. and there you have it if you are confused it should look like this:
Timehelp.jpg
And there is your time system oh and before I forget make an item called clock non consumable and when used it shows the time the text should look like this :The time is: \v[19]\v[20]:\v[21]\v[22]
Simply change the numbers to the numbers that your time variables are.
When I have had a few replys telling me how great I am and how useful this is I will gice a lesson on how to make shops be open and closed a different times.
And theres the bell now off to your next class.
 
Ahoy!
----------
well since no one else has posted, and seeing how i havnt psoted, and have been a bit of a leecher (which i dont condone), let me say AWESOME! =)

I used a similar method... took me hours to figure it out on my own tho, but eventually I added on another chunk with it =).


I highly recommend this method, seeing how the time system most people go by that only deals in events have a incredibly high lag time for under normal computers, and a little bit of noticeable lag on normal computers. ^^

(oh my only suggest, instead of using an item to always check the time, you can do a conditional branch for a common event, that allows you to press a button to view it =), but the conditional branch can start off by making it necessary for to have the clock in your inventory ^^)
 
This should be properly formatted, it is very hard to understand in its current form. Also, you should always assume that will want there system to be slightly different than yours, and I didn't see you explaining how to do that.

Your code should be explained in full, as well. Never just go "Put a loop in", say "Put a loop in, because it will cycle through our event until it is broken, or the event is exited, which we need because time is a loop and cannot move forward without it". Takes longer to type, but it's definitely going to teach people more.

But other than these issues, there is nothing wrong with it(except maybe your grammar, is english your primary language?), and it seems to work fairly well.
 
Well, it's not just spelling. It's your grammar and formatting too. I'll help you out this time, if you'd like. I can reformat it and PM it to you, if you'd like, but only this time.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top