|
|
In this tutorial you will learn...
How to make a random weather system…
…Using absolutely no scripting
How to use embedded conditional branches
A bit about common events in general
Hey there, and welcome to the first of my Event System tutorials! In these tutorials I will be showing you how to make useful systems for your
RPG without using any scripting whatsoever (or if I do, it will be extremely simple copy-and-paste stuff). In this tutorial, I will be using
just common events to make this system. Just before we start, I'll let you know what we will be using:
ê Three common events
ê Three switches
ê Two variables
So, let's make some random weather!
Grab yourself a nice blank map that you will apply your random weather to. Here is something I put together quickly:
Okay, now we've got somewhere that we can test out our system, we need to start making it. Head over to your database from the Tools menu, or
press F9 on your keyboard. When you're there, go to the common events tab. Now, we won't have used this much before, but it's about to come in
very handy! So, create a new common event using the change maximum button at the bottom, and call it Weather Timer, or something similar. Now,
you see the trigger box? In here, we're going
to set it to Autorun, and set the condition as having a new switch, called Weather Timer, ON. Okay? This event is going to control the timer that sets
how long we wait between random weather changes. Here is a screenshot of my common event so far…
Okay, now we need to input the commands. We're going to use a variable called Weather Timer or something similar to be set to a random value.
This will decide which time duration lapses between the changing of the weather, for a bit of variety. So, the first command in your first common
event is going to be setting this variable to a random value. The limit is up to you: this will determine the number of different times, so, for
example, if you set the value from 0 - 4, there would be five (remember, 0-based!) possible durations between weather changes. Here is my variable
page…
Okay, now we need to set a conditional branch for each value of the variable. So, insert a conditional branch into your common event with the
conditions variable Weather Timer is equal to 0, and make sure that the 'Set Handling when conditions do not apply' box IS checked. You will
now have an event page looking something similar to this:
Okay so far? Now, before we add the commands in the conditional branches, we need to add the other branches in. Because we have more than two
outcomes, we are going to have to use embedded conditional branches. These are not especially complicated, but they do get a bit confusing if
you don't know exactly what you're doing! So, in the else section of the first conditional branch, we need to add another conditional branch
exactly the same as the first, but with the condition being that the variable is set to 1. Follow? Here is a picture:
Okay? Now, in the Else section of that conditional branch, add another, but with the condition set to 2. Finally, in the Else section of that
conditional branch, add another with the condition set to 3. Follow? We don't need one with a four, because - well, you tell me. (If we've
checked the variable for every value except four, then the only value left can be four - so we don't need another branch.) Your event page
should be looking something like the following...
Okay, now that we have branches for all possible outcomes of the variable, it's time to put in the commands on what the event should do for each
value. In each branch, we're going to put three commands: firstly, a control timer command setting the timer to varying times, secondly, a
control switch command that turns OFF the Weather Timer switch, and turns on another switch called Weather Check. With the times, you can make
up the amount of time that passes between the change in the weather for more realism. You might like to put the times shorter for testing
purposes; you can always change them later on. So far, your event commands should be something like this:
So, now that we've done the timer commands, we need to make another common event. Call this event Weather Check, and set the trigger to parallel,
with the condition being that the switch Weather Check is on. See what we're doing? In this event, we're not going to need that many commands -
all we need to put in is a conditional branch checking whether the timer is 0 min, 0 sec or less, and if it is, we turn another switch, called
something like Weather Change, on. Got that? Here's a screenshot…
Okay? Right. Now we've got the long bit to go. Create a final common event, called Weather Change, and set the trigger to parallel, with the
condition being that switch Weather Change is on. Okay? Now, in this event's commands, we're going to put the commands that happen to change the
weather. Before we do this, however, we need to put in a command turning OFF the switch Weather Check to prevent the previous common event from
looping unecessarily. Okay? Now we're ready to make some weather.
Because this is a random weather system, the next command is going to be - yup, you got it: controlling a new variable to a
random value. I've created a new variable called Weather Effects, and I am going to have three different types of weather, in addition to no
weather (which is a total of four different weathers - so I am controlling my variable to be a random number between zero and three (remember:
zero-based!). After this, we need to add in another embedded conditional branch, not dissimilar to the one that we did earlier on. Follow the
pattern that we used earlier, and you should come up with something like this:
Right - nearly there now! Remember that we don't need to branch for three, because if it isn't 0, 1 or 2, then it can only be 3. Once we've
got that, we need to put the actual commands in to change the weather. Normally, I have the zero-value of the random variable being 'no weather'
I.e. no weather effects - so you might think that we can leave this blank. However, if we already have weather going, we need to erase the
current weather effects. So, under the zero branch of the conditional branches, I add Set Weather Effects (see my
Weather Effects tutorial for more detailed information on this feature) to None, so that it cancels any rain etc. that we may have
already. The duration I will set to quite a long time, to make it seem realistic: around about 150 frames (bear in mind, however, that without
scripting, you cannot have a duration more than 200 frames. Annoying, huh?)
So, that is the command for cancelling the current weather. Now, if we have rain, we will have had sound effects, so I need to add a Fade Out
BGS command (second page of event commands, at the bottom), and set it to 4 seconds (just over 150 frames). I also need to return the screen
tint to normal, using a Change Screen Color Tone command from the second page. I leave all the values at zero, but set the duration to 190
(one second longer than in takes the rain to fade, almost like clouds disappearing). Finally, if I have some fog showing, I would like this to
fade out as well. I can use the Change Fog Opacity command on the second page to do this. When I click that button, I will get the following
box:
This is pretty self-explanatory: the opacity box is the target opacity, and the duration is the time it takes to happen. I want the fog to
disappear slightly faster than the rain, so I will set the duration to 100 frames. Okay? Now we have no weather. With the other conditional
branches, I'll add in custom commands so that it will make rain, a storm, and just cloudy weather with fog and wind, using the appropriate
Set Weather, Play BGS, Change Screen Color Tone and Change Fog Opacity commands. I'll post a picture of
my finished event commands…
Note the turning on of the Weather Timer switch at the end - we need to do this so that the timer resumes after the weather effects have been
changed. Okay, we're nearly done! We just need to do one more tiny thing. Go back to your first common event, Weather Timer, and at the top, add a control
switch command, turning OFF the Weather Change switch. That will stop unecessary looping of the parallel common event, and stop lag.
The top of your first common event should now look like this:
Now we
can test out our system! All we need in-game is a placeholder event turning on the intial Weather Timer switch, and once that has been turned
on, the system will keep going in the background. If you would like to know how to stop the weather effects when going through a door, etc.,
then I will write a mini tutorial on it and post it when it's done.
Congratulations! We have successfully made a random weather system! The next tutorial will be on making a compound day and night system using
the same techniques that we have used here, so you should find it pretty easy. See you there!
:: Home ::
:: Next Tutorial >> ::
|
|