# DAY AND NIGHT

### Making a good in-game change of time with VARIABLES!

So you want to make time pass in a dynamic way? Well, I'm here to show you how.

What you'll need is:
5 switches (for day, dusk, night, dawn, and inside.)
3 variables** (for seconds, minutes, hours)
1 common event

* You can also use a timer for this, but I have no clue how to do it effectively.
** Can also just use two variables for this for shorter time span.

First off, go to your common event screen.

Now make a common event named Time (or whatever it is you prefer). Make it a Parallel Process. (Optional) Add a trigger switch to it if you want to control whether the time changes or not based on events in the game. Name it the same as your common event.

Next, make your three variables named seconds, minutes, and hours, as well as the four switches named Day, Dusk, Night, and Dawn. (Or day, afternoon, night, and early morning.)

Now if you want to make your day take a literal twenty-four hours to go full circle, simply do the following:
Add a wait 1 second command, followed by a Variable Seconds add 1 command.

Put a conditional branch after it, saying "If Variable Seconds equals 60", followed by a Variable Minutes add 1 command, and a Variable Seconds equal 0 command.

Now in the else handler, add a "If Variable Minutes equals 60" command, followed by a Variable Hours add 1 command, and a Variable Minutes equal 0 command.

Now this is where things get a little tricky. We need to add a conditional branch in this second else handler, and subsequently add a new conditional branch in each new Else Handler until you have a total of five new conditional branches. They are "If Hours equals 4" "If Hours equal 8" "If Hours equal 16" "If Hours equal 20" and "If Hours equal 24".

In each of those variables, we set a different color for them, as well as the switch. For starters, in Hours equals four, we turn off the switch Night, turn on the switch Dawn(Early Morning), and switch the color with the Tint Screen command to: R060 G070 B090 S100 The transition time should be a natural 2 seconds. (This transition time applies to all the time variables.)

Day should be the default 100 for all color categories. It should be placed in the Hours equal 8 condition.

Dusk(Afternoon) should be R110 G050 B050 S070. It should be placed in the Hours equal 16 condition.

Night should be R020 G030 B050 S100. It should be placed in the Hours equal 20 condition.

Now in the Hour equals 24 branch, just put Hour equals 0, to symbolize the start of a new day.

Now, say you don't want the day to take twenty-four REAL hours. What do you do? Just two things:
Remove the Seconds Equal 60 Condtional Branch, and replace the Add 1 to Second variable to Add 1 to Minute Variable.

Last but not least, if you don't want the time change to make the inside look any different, make a new switch called Inside, and put the conditional branch If Switch Inside is On. Then make the color look like day, and make it an instant change.

And there you have it. Now your game changes color with time!

## Posts

Pages: 1
Thats actually pretty cool. Mustve taken forever to figure this out.
stupid computer said error and still posted 2nd one. oops.
Huh, I thought it would give me notices for this.
And it did. I had plenty of help from the community, though. I just decided to make the tutorial so no one else would have to ask how to do this.
Would have to gander a guess that it would work the same in VX... Right?
post=205077
Would have to gander a guess that it would work the same in VX... Right?
There's a good 80% chance in your favor, but don't keep your hopes too high.
sbester
N
4719
I have a much more primitive day/night system I'm using for Eden Legacy III. Basically copies that of Dragon Quest 3.
I do the day and night method as well. I use it as a main switch for a black market, locked doors at night, some only open at night. But i'm having one issue; How can i set it so that staying at the inn passes time? I use 2k3 and cant find the option to set the event in the inn..
I do the day and night method as well. I use it as a main switch for a black market, locked doors at night, some only open at night. But i'm having one issue; How can i set it so that staying at the inn passes time? I use 2k3 and cant find the option to set the event in the inn..
You could just have an NPC with a message asking if you want to stay at the inn, then have a choice showing yes or no. In the Yes branch, simulate staying at the Inn(reduce money by X amount, restore HP, hide screen and play music if you want). That way you can add the changes to the time variables as well.
Yellow Magic
munch munch munch munch munch munch munch munch
1371
Kudos for PrtScrn'ing rather than typing all the 'code' out by hand!
Yellow Magic
munch munch munch munch munch munch munch munch
1371
EDIT: Poudle Dost
nice tut, you helped me alot :D
Um,I tried it and it did not work.
cam anyone help me?
Pages: 1