Chaos Project

RPG Maker => Event Systems => Topic started by: Seltzer Cole on May 29, 2012, 04:37:08 am

Title: Day/Night Cycle
Post by: Seltzer Cole on May 29, 2012, 04:37:08 am
First and foremost this is a parallel process. It does not keep track of days, it just gives the game a dawn, day, dusk, and night.

This system will give you a 14 minute day/night within your game. Changing the time to more or less than 14 minutes is easy to do and I will explain that as well. Dawn is 3 minutes, Day is 5, Dusk 3, Night 5. Which = 14 Minutes.

The Common Event needed,
Spoiler: ShowHide
(http://i19.photobucket.com/albums/b170/Glenns_Sword/Clock.jpg)
: Branch End
@>


Understanding the Common Event,
Spoiler: ShowHide
The "Wait 20" equals 1 second.
There are only 2 variables used that can be named to whatever you want. One is used for keeping track of seconds and the other keeps track of minutes. The wait will continually increase the "Variable Day/Night Seconds" by 1 until it hits 60, then it will increase the "Variable Day/Night Minutes" by 1 and reset the seconds so it can start the process over. When "Variable Day/Night Minutes" reaches 14 which is approximately 14 minutes, it resets the minutes so everything can start over and it would then be morning.
A picture is displayed for dawn, day, dusk, and night as the "Change Screen Color Tone" is used to dim the screen out or brighten it so it appears that the sun is rising and falling towards night time.
You will need to set a "Condition Switch" to turn this common event on, so just stick it at the beginning of your game or whenever you would like to turn it on/off to control whether the cycle of the sun plays a factor.
You need pictures to display. I will add in free ones below.
To change the times at which the 4 times of day appear, just edit the Conditional Branch Variable of the Minute (Of dawn, day, dusk and night) and change it to whatever you wish.


Uses for this Common Event,
Spoiler: ShowHide
- Particular times of the day based quests
- Particular times of the day based skills such as farming
- Particular times of the day based enemies such as enemies that only appear at night
- etc.... you get the idea

There are multiple ways you could improve on this. I am lazy right now so I won't add anything to it. But idea's are adding in not only day/night cycle but keeping track of days/months/years.


The pictures needed,

Spoiler: ShowHide
(http://i19.photobucket.com/albums/b170/Glenns_Sword/Dawn.jpg)

(http://i19.photobucket.com/albums/b170/Glenns_Sword/Day.jpg)

(http://i19.photobucket.com/albums/b170/Glenns_Sword/Dusk.jpg)

(http://i19.photobucket.com/albums/b170/Glenns_Sword/Night.jpg)

Just copy and save them on your PC. Then go into your Material Base and upload them as Pictures.


If you feel that I failed to mention anything than ask. I didn't really give a detailed description on understanding or how to add this into your game, so if you are new to the program, ask me and i'll answer. The reason you need a switch for this by the way is in case you enter a building and hate that the lights are still out at night time. This isn't apart of the idea in my game though so I didn't add that. But yeah... Thanks and bye.
Title: Re: Day/Night Cycle
Post by: GrimTrigger on May 29, 2012, 08:25:23 pm
I have a script that handles this, but this is interesting none the less. I'm starting to learn to use conditional branches and variables to perform more complicated functions, so this was useful to look at.
Title: Re: Day/Night Cycle
Post by: ForeverZer0 on May 29, 2012, 08:45:24 pm
Quote from: Seltzer Cole on May 29, 2012, 04:37:08 am
The "Wait 20" equals 1 second.


This is only when the game is not run in Smooth Mode, which everybody does, so 40 frames equals 1 second unless you are one of them few. If you want to change it, press F1 while playing the game and change the option.
Title: Re: Day/Night Cycle
Post by: Blizzard on May 30, 2012, 01:44:56 am
No, that works in events regardless. Frame rate within the game is different than frame rate that is being displayed. Smooth Mode just makes the game skip a frame during rendering, but it still takes that frame into account during calculation. So basically in events it's always 20 (because in events it's actually every other frame, it's made like that in the scripts) and in the scripts it's 40 regardless of Smooth Mode.