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.

24hr clock for business.

I have made a bank, but I was wondering if there was a way I could make an in game clock so whenever it reaches a certain time, the doors close and you can't enter anymore.

I'm using VX, and if you can help me out with this, credit will be given if and when this game finishes.

Thanks in advance.

-ToneLoc
 

khmp

Sponsor

No problem. The easiest way is to make the event, whether it be a door or a person, figure out the current time. Based on that time you would either allow business to go on or display a message saying closed. 24 hour clock is kind of vague when it comes to creating this though. Do you mean game time or real world/system time? In either case you might want to shrink the amount of time it takes a shop to open and close.

Let's say you wanted to base this off of game time. You can set the current game time to a variable using the "Control Variables" event command. Set whatever variable you want to "Other" and select "Play Time". This will retrieve the total amount of seconds that have passed in the game. For the sake of ease make 1 second equate to 30 seconds in the game world. 2 secs game time = 1 min, 120 secs game time = 1 hour/2 minutes real word, 1440 secs game time = 12 hours/24 minutes real word. That's pretty reasonable but you might want to play around with the numbers. You want this hour based.

Figure out the time:
var1 = Play Time               # Game Time Seconds
var1 = var1 * 30              # Game World Seconds
var1 = var1 / 60               # Game World Minutes
var1 = var1 / 60               # Game Time Hours
var1 = var1 % 24              # Cap Game Time Hours to 24 hour cycle.

Decide whether the store is open:
conditional branch var1 < 13
                                     # Store is open
else
                                     #Store is closed
end

Good luck with it ToneLoc1983! :thumb:
 

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