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

● ARCHIVED · READ-ONLY
Started by Zane 20 posts View original ↗
  1. 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.
    Spoiler
    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.

    Spoiler
    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.

    Spoiler
    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.

    Spoiler
    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.

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

    common event again.

    Spoiler
    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.

    Spoiler
    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.
    Spoiler
    Download - Day and Night Cycle Demo - Size 1.43mb
  2. Instead of using four switches to indicate what stage of the day it is, why not have used one variable instead? :)
  3. 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...
  4. That is an interesting way of doing it :) it would save 4 switches for something else.
  5. yeah, plus that will keep the ideas on your tut to variables alone rather than having the readers think about variables and switches... :)
  6. Alrighty when I'm on my computer today I will update the tutorial some more :)
  7. :::Josh::: said:
    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

    Spoiler
    attachicon.gifTUT 1.png
    Spoiler
    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.gifTUT2.png

    attachicon.gifTUT 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.

    Spoiler
    attachicon.gifTUT 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.

    Spoiler
    attachicon.gifTut 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.

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

    common event again.

    Spoiler
    attachicon.giftut 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.

    Spoiler
    attachicon.giftut 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!

    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!
  8. There is no scripting involved just open up your database and follow the steps above. :)
  9. I see, can you tell me how to have to player enter and exit towns back and forth from the world map?
  10. 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.
  11. 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..
  12. 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.
  13. 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.
  14. 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.
  15. Adding a conditional branch to each time number actually fixed the problem.
  16. 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.
  17. 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.
  18. 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:
  19. @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...
  20. 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