*Last Update - 8/8/14* Day and Night cycle using a common event!

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
This is the old tutorial from October 12, 2013 - August 7, 2014. You may continue to read it if you wish, however most if not all of the information is old and is not qualified enough to be a decent working tutorial.
Day and Night Cycle Tutorial

Introduction:

Have you ever wanted to use a day and night system inside your game?

Maybe have it effect when you can enter shops, or even how your story line goes.

If you are a RPG Maker user then you know scripts should always be a last resort.

Why stuff your game with someone's script when you can easily do this yourself!

This tutorial is good for VXA and VX.

Time of Day:

Everybody knows there are at least 4 Major time of day cycles

Dawn,Day,Dusk,Night So you need 4 different tint tones.

Now, you can use VXA's preset tints or make your own.

What will be needed:

1 variable

1 common event

4 switches (optional)

4 tint settings

Setting up your variable:

You may name this to whatever you like!

But for the tutorial lets call it time cycle.

Set this to 0

TUT 1.png
Common Event:

This is the longest part. But it should only take 1min and 30sec to set up.

Here set up all your separate conditional branches with your tints and variable instants. 

Remember the switches are optional and I will explain why. Also make sure to un-check

Wait for completion when setting up your tints.

Setup the cycle starters with the numbers 6, 12, 18 ,24 (28 is the cycle reset)

Remember after the variable has increased 28 times make sure you reset it to 4

to keep the pattern even.

Ignore that it says day cycle it supposed to be time cycle

TUT2.png

TUT 3.png

Switches (Optional Feature):

Though not required I do recommend it.

Lets say you have a weapon shop.

you can set up event pages when certain

switches are on. Like when the shop is

closed. Nobody works a 24/7 shift.

Here is an example.

TUT 4.png
On page 1 set up your normal door event and then on page 2,

If the night switch is on then you will get a message saying its closed.

How to get the actual cycle to work:

So everything on the list is checked off we have all our branches set up etc.

Now how do we get the cycle going?

Simple. When moving maps we can add +1 to the variable and then call the

Common Event.

Tut 5.png

Moving to maps that go inside houses or dungeons:

Just about every RPG has at least 1 House and/or 1 Dungeon.

Sometimes it may look silly to have a sunset tint inside your House and/or 

Dungeon. We need to make the cycle continue but not change the effect

inside the house because we still want the simulation of day and night.

So this is how we implement it.

When entering a home, add the variable like before but do not call the common event.

Also make sure you use the fade out screen and change your tint back to normal or

(0, 0, 0, 0)

and then fade in the screen otherwise it will look very weird.

tut 6.png
Exiting a home is the same way follow the steps above but now you may call the

common event again.

tut 7.png
Choosing a time of day when you begin your game:

You don't have to start the cycle at morning. You may

begin your story at anytime of the day or night.

This part may sound a bit tricky but it isn't.

Do you recall those numbers you made?

6 , 12 , 18 , 24?

Those are your cycle starters

all you have to do is start on a blank map. (all black)

Set your variable to one of those numbers. Then call

your common event. And transfer your player. For 

best results do it in this order shown here.

tut last.png
Ending: 

Almost anything is possible with eventing. This is a good starting structure for new players or experienced players. Feel free to like this post if the tutorial was helpful! Comment if you any

questions or want to share your thoughts about the tutorial. See you later!

 ​
This tutorial is the new one from August 8, 2014 - Now. It's a demo with all the proper information that works fully using 1 variable only. It is advised that you follow and study this demo as the old tutorial is no longer supported and anyone following it will not receive help or feedback.
Download - Day and Night Cycle Demo - Size 1.43mb
 
Last edited by a moderator:

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,558
Reaction score
5,603
First Language
Dutch
Primarily Uses
RMMV
Instead of using four switches to indicate what stage of the day it is, why not have used one variable instead? :)
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,006
First Language
Tagalog
Primarily Uses
RMVXA
I agree with Celianna, better just use a single variable to determine stage of the day... you can even just utilize the Time cycle variable for this... that would be a better suggestion than the 4 switches method...

Also, having the cycle move only when changing maps is not the normal case... you should probably add a tut too for having the day night cycle progress in real time using a parallel process common event...

as for the tinting, you could always have an array of the map ids of indoor maps and check the current map id if it's in the array so that you don't need to create an event inside each indoor map just to adjust the tint...

other than that, hmmm... it might be helpful for those who need a basis on how to make the DN cycle...
 
Last edited by a moderator:

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
That is an interesting way of doing it :) it would save 4 switches for something else.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,006
First Language
Tagalog
Primarily Uses
RMVXA
yeah, plus that will keep the ideas on your tut to variables alone rather than having the readers think about variables and switches... :)
 

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
Alrighty when I'm on my computer today I will update the tutorial some more :)
 

The Dragon God

Indie Game Dev, Concept Artist
Veteran
Joined
Oct 16, 2013
Messages
246
Reaction score
6
First Language
English
Primarily Uses
Day and Night Cycle Tutorial

Introduction:

Have you ever wanted to use a day and night system inside your game?

Maybe have it effect when you can enter shops, or even how your story line goes.

If you are a RPG Maker user then you know scripts should always be a last resort.

Why stuff your game with someone's script when you can easily do this yourself!

This tutorial is good for VXA and VX.

Time of Day:

Everybody knows there are at least 4 Major time of day cycles

Dawn,Day,Dusk,Night So you need 4 different tint tones.

Now, you can use VXA's preset tints or make your own.

What will be needed:

1 variable

1 common event

4 switches (optional)

4 tint settings

Setting up your variable:

You may name this to whatever you like!

But for the tutorial lets call it time cycle.

Set this to 0

attachicon.gif
TUT 1.png
Common Event:

This is the longest part. But it should only take 1min and 30sec to set up.

Here set up all your separate conditional branches with your tints and variable instants. 

Remember the switches are optional and I will explain why. Also make sure to un-check

Wait for completion when setting up your tints.

Setup the cycle starters with the numbers 6, 12, 18 ,24 (28 is the cycle reset)

Remember after the variable has increased 28 times make sure you reset it to 4

to keep the pattern even.

Ignore that it says day cycle it supposed to be time cycle

attachicon.gif
TUT2.png

attachicon.gif
TUT 3.png

Switches (Optional Feature):

Though not required I do recommend it.

Lets say you have a weapon shop.

you can set up event pages when certain

switches are on. Like when the shop is

closed. Nobody works a 24/7 shift.

Here is an example.

On page 1 set up your normal door event and then on page 2,

If the night switch is on then you will get a message saying its closed.

How to get the actual cycle to work:

So everything on the list is checked off we have all our branches set up etc.

Now how do we get the cycle going?

Simple. When moving maps we can add +1 to the variable and then call the

Common Event.


Moving to maps that go inside houses or dungeons:

Just about every RPG has at least 1 House and/or 1 Dungeon.

Sometimes it may look silly to have a sunset tint inside your House and/or 

Dungeon. We need to make the cycle continue but not change the effect

inside the house because we still want the simulation of day and night.

So this is how we implement it.

When entering a home, add the variable like before but do not call the common event.

Also make sure you use the fade out screen and change your tint back to normal or

(0, 0, 0, 0)

and then fade in the screen otherwise it will look very weird.

Exiting a home is the same way follow the steps above but now you may call the

common event again.

Choosing a time of day when you begin your game:

You don't have to start the cycle at morning. You may

begin your story at anytime of the day or night.

This part may sound a bit tricky but it isn't.

Do you recall those numbers you made?

6 , 12 , 18 , 24?

Those are your cycle starters

all you have to do is start on a blank map. (all black)

Set your variable to one of those numbers. Then call

your common event. And transfer your player. For 

best results do it in this order shown here.

Ending: 

Almost anything is possible with eventing. This is a good starting structure for new players or experienced players. Feel free to like this post if the tutorial was helpful! Comment if you any

questions or want to share your thoughts about the tutorial. See you later!

How do I enter and exit towns. I just started RPG Maker VX Ace. Sadly I'm using the Trial version untill I can get my Product key. I want to do this script it's awesome!
 

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
There is no scripting involved just open up your database and follow the steps above. :)
 

The Dragon God

Indie Game Dev, Concept Artist
Veteran
Joined
Oct 16, 2013
Messages
246
Reaction score
6
First Language
English
Primarily Uses
I see, can you tell me how to have to player enter and exit towns back and forth from the world map?
 

The Dragon God

Indie Game Dev, Concept Artist
Veteran
Joined
Oct 16, 2013
Messages
246
Reaction score
6
First Language
English
Primarily Uses
OH btw I did everything you have on Common Events - General Settings. But that's all I got so far. I need help with the rest of the steps.
 

cairn

Villager
Member
Joined
Oct 31, 2013
Messages
10
Reaction score
0
First Language
English
Primarily Uses
How am is it meant to change to the current time of day when you exit a building? I don't get that part.. I've tried calling the common event, and adding a variable but nothing happens..
 

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
If your following the pattern it might not change right away because you might not have hit a certain number yet to change the weather.

It only changes when the variable is 6,12, or 18 so if you enter a building and added 1 to the variable when you come back out you only add 1 to it. So your number is only 2 which is not high enough.
 

cairn

Villager
Member
Joined
Oct 31, 2013
Messages
10
Reaction score
0
First Language
English
Primarily Uses
Well then, that makes this tutorial pretty broken if the time of day doesn't take effect unless it's on a certain number. A way around this is to add another conditional branch for every number up to the maximum then reset.
 

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
This is not broken. The numbers can be anything you want. I did not say you had to follow anything. It was a EXAMPLE. You also can change to add 6 to the variable. If you really wanted to idc. It is men't to create a length of day. Not to change every cycle per map. Im sorry but your way of adding a conditional branch is not needed at all. In fact it would make my tutorial useless.
 

cairn

Villager
Member
Joined
Oct 31, 2013
Messages
10
Reaction score
0
First Language
English
Primarily Uses
Adding a conditional branch to each time number actually fixed the problem.
 

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
I don't why it would be needed. The number is in the variable you have to add. +1 the common event checks to see if the variable is equal to a set number like 6. Its like your not reading the tutorial. All you were doing when you left the house was CHECKING to see if you hit 6 12 or 18. Your not going to hit it every time.
 

cairn

Villager
Member
Joined
Oct 31, 2013
Messages
10
Reaction score
0
First Language
English
Primarily Uses
Okay I just re-wrote the whole thing and designed my own which allows a full dynamic always running day/night cycle which only takes just abit more work.

1.Create a common event, make it parallel process, and use a condition switch you activate at the beginning of the game

2. In the common event comment where you want morning, afternoon, evening and midnight to start

3. Inbetween these times put as many 600frames as you want minutes for how long you want that part of the day to be

4. At the end of every one of the 4 day types, put a variable named something like DAY/NIGHT and ADD 1 to it

5. You are now done with the common event, leave it alone and go back to your main world map and create a parallel process.. In that parallel process you put a condition switch for if variable DAY/NIGHT is 0 or above change the tint to ( whatever you want as morning )

6. Copy this page and paste it 4 times, using the same condition variable for each one but raising the DAY/NIGHT variable by one each time until you end up at your last page ( PAGE 4 ) with if DAY/NIGHT variable is 3 or above.

7. Whenever you enter a building, simply turn your tint back to normal AFTER the player transfer.. So even when your in a building, time is still ticking by outside and the weather changing etc.

That's it.. Done.. Now you have a day and night cycle that is fully simulated and always working in the background and doesn't rely on you to be calling for it as a common event. If you want shops to only open at night, then you simply create a switch for that shop and put it at the beginning of where your night time begins in your common event wait countdown and make it turn off at start of night, and back on at the beginning of morning.

If you don't understand it, then I can take some pictures and make a picture tutorial explaining it better for you.
 
Last edited by a moderator:

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
I think you did what celianna suggested. Honestly I was supposed to update this but when I got back on to my actual computer to change things I got sidetracked with my inbox its cool you did it this way  :rock-right: It helps users that's what I was aiming to do. You don't agree with my methods see if you can improve it better is what Im basically saying. (I already knew how to do it  this way) Also impressed by how you conducted yourself as I was testing you on that secretly. Good work. Here is a like. B)   :thumbsup-right:

Edit: Oh I thought you were going with celianna's idea. Its also 12:26am I'm extremely tired. So I most likely didn't read it right all the way. After what adiktuzmiko said I actually opened my eyes a read it over again. So the common event still stands. BD   :thumbsup-right:
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,006
First Language
Tagalog
Primarily Uses
RMVXA
@cairn - Actually, instead of doing the tint in the outside maps, it's better to do it on the common event... because if you have lots of outside maps, then you need to copy-paste that into all those outside maps... And if you ever decide to change the tinting, then you would need to recopy and repaste or edit them one by one... while doing them inside the parallel common event means you keep them in a single event...
 
Last edited by a moderator:

kerbonklin

Hiatus King
Veteran
Joined
Jan 6, 2013
Messages
1,726
Reaction score
276
First Language
English
Primarily Uses
RMMV
If you don't mind, i'll post my simple common-evented Day/Night cycle here to maybe help people. It's set up to change the time of day every 5 map transfers. (If a transfer has the Call CE) (Took the idea from Sword of Mana for the GBA)

Map transfer event with variable change and Call CE (Don't include Call CE for maps that won't change time, like inside buildings/towns.)

cKvV0TV.png


CE for time of day change switches + tints (I have 4 timezones per day) If you want to use switch-controlling you can always check for a switch you make before checking the variables.

TQdnSnA.png


UMRQHAY.png
 
Last edited by a moderator:

Latest Threads

Latest Profile Posts

SA57Face.pngSA57_IDLE.gifThis is just a "Chinese opera actor" who is totally not a serial killer. Now, we just need to clean up a pile of dead bodies found in his backyard. :kaojoy:
E7DsT3VXsAInVpu

working on my avatar, because i couldn't stand looking at it anymore :D
still not finished though...
alpacaraptors = love!
''Finds icons that fits the game you're making'' Only covers 20% of what you need :p
I'm very manic-y right now. I didn't sleep and I wanted to get a bunch of stuff done, but didn't get anything done except the bare bones concept for a POSSIBLE game.
And I can't sleep now because I'm probably gonna be hanging out with my brother and I gotta discuss a bunch of BroCoG (our game group) junk with him plus it's far to late to sleep NOW.
poppetQuestBarryApproaches.jpg
While I wait for judging, I decided to start adding more "friends" to my attic. :LZSgrin:

I swear I need a whole sound pack of menacing squeaky toy noises. :kaoswt:

Forum statistics

Threads
113,585
Messages
1,076,008
Members
147,568
Latest member
dnelson83
Top