Home
Sitemap
Site News
Downloads
FAQ
Contact
• Basic Tutorials •
Maps
The Database
Events
Graphic Resources
• More Advanced Tutorials •
Maps
Events
The Database
Event Systems
• RGSS •
Script Fixes
Script Systems
• Other •
Using RMXP
Mini Tutorials
Miscellaneous
• Reference •
Reference

In this tutorial you will learn...

• How to make a compound day and night system…
• …Complete with morning, day, evening and night


Hey there, and welcome to my second advanced eventing tutorial! In this tutorial, I will be showing you how to make a compound day and night system. A compound system is not in real-time, so if you want to have a real-time day and night system, you'll have to head over to my Script System tutorials and have a look at the Real-Time Clock system that I have there.

So, let's get going! Just before we begin, I'll tell you what you need:
ê Three common events
ê Three switches
ê A variable

Note: At the moment, this system is incompatible with the Random Weather System that we saw in the previous tutorial. However, I am going to write a tutorial where you can make a system incoorporating both aspects to give you a day and night system with random weather. However, until then, you won't be able to use the random weather system and the compound day and night at the same time, unfortunately.

So, get yourself a map where we can demonstrate this system. Now, as this system is based completely on common events, more or less exactly the same as the random weather system a moment ago, we're going to go straight into the database and head over to the common events tab, and create a new common event called Day and Night Timer, or something similar. When we've done that, we need to set the trigger to Autorun, and the condition to a new switch called Day and Night Timer being ON. Your common event should look something like the following…



Okay so far? Now we're going to need to come back to this common event later and put in some more commands, but for now, we're going to put in the following: first a Control Timer command that sets up the timer to the interval you would like it to be between the times of day. I am going to set it to twenty minutes (although you might like to set it to something like 10 seconds for testing purposes!). After that, we need to put in a command turning OFF the Day and Night Timer switch that we used as the trigger, and then after that, we need to add a command turning on a new switch called something like Day and Night Check. Okay? Here is a screenshot…



Right. Now we're going to make a new common event, called Day and Night Check. Here, we need to set the trigger to parallel, and the switch to the one that we turned on a moment ago (Day and Night Check). This will be the event that checks our timer, and when it has reached zero, changes the time of day. So, in the command section, we need to first put in a conditional branch, checking whether the timer is 0 min, 0 sec. or less. In side that conditional branch, we need one command: to turn a third switch on, called Time of Day Change. So, your second common event should look something like the following…



Right. Once we have done that, we need to make a third and final common event called Time of Day Change. Set the trigger to parallel, and the switch to being the switch that we just turned on: Time of Day Change. Now, in this common event, the commands are a little longer. Firstly, add a command turning off the Day and Night Check switch; we don't need that event going any more. Now we're going to change the time of day, but we're going to go about it in a bit of a special way. We're going to store a number according to the time of day in a variable, and that way, the system can see what time of day it is, and then move it onto the next time of day - Day will be 0, evening will be 1, night will be 2 and morning will be 3. So, our first command is going to be a conditional branch checking whether the variable Time of Day (we'll need to create this) is equal to zero. If it is, the time of day is obviously day, so we'll change the time of day to the next one on - evening - and set the variable to 1, meaning evening. I know that it's a little confusing, but here is a picture to help a bit.



Okay, so that is what happens when the time of day is 0 (day). We need to add an embedded conditional branch into the else section of the one we've just done, checking if the variable is equal to 1 (evening). If it is, we'll enter the screen tints for changing to night, and then set the variable to 2 (night). Okay? Then, in the else section of that, we check if the variable is equal to 2 (night) and if it is, we'll change the screen tint to morning, and change the variable to 3 (morning). Okay? Here is another picture…



Great! Now we only have three more things to do. Firstly, you may be asking why we have an empty else branch at the bottom. Well, if you're familiar with embedded conitional branching, then you'll know that this is for the only possible value left of the variable, which can only be 3. So, if it is 3, we enter a command to change the screen tint to day, and then change the variable to 0 (day). And that's it for the embedded conditional branching! Now, at the bottom of this, we need to add a command that will send the system back to the beginning. So, add in a command turning the Day and Night Timer switch back on, and then, when the screen tint has finished changing, the system will go back to the timer. Voilà! Here is a picture of the finished common event:



Just before we test our system, however, we need to add one more command in to the Day and Night Timer common event. At the top, add in a command turning off the Time of Day Change switch - and there we go! A completed compound day and night system. Feel free to change the timer value and the screen tints and the time they take to change. Bear in mind, however, that without scripting, the maximum timer value is 99 minutes and 59 seconds, and the maximum screen tint frames to change is 200.

Test out your system and see if it works. If you would like to make the timer invisible, have a look at my Hiding the Timer script fix tutorial. The next tutorial will be on making a system where you can view paper, lists and maps etc. in game.

:: << Previous Tutorial ::      :: Home ::      :: Next Tutorial >> ::

RPG Maker XP © 2005 Enterbrain Inc.           © 2004 Xiph. Org Foundation           Ruby © 1993 - 2003 Yukihiro Matsumoto
This site, including images and textual content, were created by and belong to me.
© 2006 - 2011 All rights reserved.

This website and tutorials have all been written in my free time (what there is of it!), and hosting can be rather costly, so any donations are very gratefully received - no matter how small - even if you can spare 50p I would be grateful!