Quote: (@RPGVirtuoso) Cats go crazy after they fuck. ...
blade2k » articles & tutorials

jump to:
Tutorials » Game Creation » RPG Maker 2000

Spik's All System


Reading Article
Author: spik
Posted on 08/14/2004
print :: back to list
A tutorial for a Day/Night System, in real time and with an optional weather system.

-

-------------------------------------------------------
Spik's DAY - NIGHT - TIME - WEATHER SYSTEM
--------------------------------------------------------

I.Intro

II. Whats needed?

III. Source time!

IV. Outro

V. ...and the rest!

--------------------------------------------------------
I. Intro
--------------------------------------------------------

Well, as you probably guessed, this is my Day/Night
system, but with a twist, it runs by Real Time Clock,
(not if u choose to change the settings) and also
you can add a Rain System.

I'll be using this in my RPG, 'Shattered Omen.'

Anyway, lets negbin! uhh...begin...


--------------------------------------------------------
II. Whats needed?
--------------------------------------------------------
----------
Variables:
-
0001:Seconds
0002:Minutes
0003:Hours
0004:Day
-
0005:RAIN PERCENT
0006:RAIN TIMER
----------

Switches
-
0001:Day
0002:Night
0003:Lighting Effects?
-
0004:Weather Effects?
0005:Its raining :(
-
0006:Clock Active?
----------

At the end of ur intro (or start of game) turn on
(DAY/NIGHT) (CLOCK ACTIVE?) and set day,hours,
seconds,and minutes as something.

(IDEA! Set them at random, for a random start time.)

Thats should be all, lets code it!

--------------------------------------------------------
III. Source Time
--------------------------------------------------------
----------
TIME SYSTEM
----------
Ok, create a 'common event,' titled, lets say, TIME SYSTEM.
Make sure its set to Parallel Process. Then the Trigger
Switch should be [0006:Clock Active] (or whatever switch
you're using.

Now, lets get to the basics.

Create a CYCLE. Place all this inside.
Make a 'Wait' for 1.0 secs. This will make it real time.
Then, make a 'Change Variable' and +1 to V0001: Seconds.
After that a Fork Condition, no Else case. Set this
as when Seconds is the same as 60.
We should have this:


<> CYCLE
<> Wait 1.0s.
<> Variable Ch:[0001:Seconds] + , 1
<> FORK Optn: Varbl[0001:Seconds]-60
<>
:END Case
:END CYCLE


Inside that, place two 'Change Variables'
One which sets SECONDS as 0, and MINUTES +1.
Like this:


<> CYCLE
<> Wait 1.0s.
<> Variable Ch:[0001:Seconds] + , 1
<> FORK Optn: Varbl[0001:Seconds]-60
<> Variable Ch:[0001:Seconds] Set, 0
<> Variable Ch:[0002:Minutes] + , 1
<>
:END Case
:END CYCLE


Repeat the process, with some changes.
After the FORK, add a fork for 60 minutes.
Inside, set minutes as 0 and add one Hour.


<> CYCLE
<> Wait 1.0s.
<> Variable Ch:[0001:Seconds] + , 1
<> FORK Optn: Varbl[0001:Seconds]-60
<> Variable Ch:[0001:Seconds] Set, 0
<> Variable Ch:[0002:Minutes] + , 1
<>
:END Case
<> FORK Optn: Varbl[0002:Minutes]-60
<> Variable Ch:[0002:Minutes] Set, 0
<> Variable Ch:[0003:Hours] + , 1
<>
:END Case
<>
:END CYCLE


This is coming togther. For the TIME SYSTEM,
one more thing is needed.
Another fork. When Hours is 24, set it as 0.


<> CYCLE
<> Wait 1.0s.
<> Variable Ch:[0001:Seconds] + , 1
<> FORK Optn: Varbl[0001:Seconds]-60 <(NOTE: Change the 60 to change minute length)
<> Variable Ch:[0001:Seconds] Set, 0
<> Variable Ch:[0002:Minutes] + , 1
<>
:END Case
<> FORK Optn: Varbl[0002:Minutes]-60 <(NOTE: Change the 60 to change hour length)
<> Variable Ch:[0002:Minutes] Set, 0
<> Variable Ch:[0003:Hours] + , 1
<>
<> FORK Optn: Varbl[0003:Hours]-24 <(NOTE: Change the 24 to change day length)
<> Variable Ch:[0003:Hours] Set, 0
<>
:END Case
<>
:END CYCLE

There you go, a functional time system.
To make something display time:

<>Messg:Time:
: :V[0003]:V[0002]:V[0001]

OPTIONAL: Days.
This is where we'll add Days.

<> FORK Optn: Varbl[0003:Hours]-24
<> Variable Ch:[0003:Hours] Set, 0
<>
:END Case

In here, add another Variable Change after, adding 1 to
days.Then, have a fork, where if days are 8 (or
whatever u have them as)
it goes back to 1. Thats badly explained, so ill
put it down:

<> FORK Optn: Varbl[0003:Hours]-24
<> Variable Ch:[0003:Hours] Set, 0
<> Variable Ch:[0004:Days] + , 1
<> FORK Optn: Varbl[0004:Days]-8
<> Variable Ch:[0004:Days] Set, 1
<>
:END Case
<>
:END Case

Alright, added to the source:
_______________________________________________________


<> CYCLE
<> Wait 1.0s.
<> Variable Ch:[0001:Seconds] + , 1
<> FORK Optn: Varbl[0001:Seconds]-60
<> Variable Ch:[0001:Seconds] Set, 0
<> Variable Ch:[0002:Minutes] + , 1
<>
:END Case
<> FORK Optn: Varbl[0002:Minutes]-60
<> Variable Ch:[0002:Minutes] Set, 0
<> Variable Ch:[0003:Hours] + , 1
<>
<> FORK Optn: Varbl[0003:Hours]-24
<> Variable Ch:[0003:Hours] Set, 0
<> Variable Ch:[0004:Days] + , 1
<> FORK Optn: Varbl[0004:Days]-8
<> Variable Ch:[0004:Days] Set, 1
<>
:END Case
<>
:END Case
<>
:END CYCLE

_______________________________________________________
And there we go, a time system. If u understand, it
should be simple to add months
and years ect.

----------
Day/Night System
----------

This will only work with the current system. It will
also include the Days feature, this
is going all the way!

Ok.

First make a fork, where it is only effected if
[0003: Lighting Effects] is on, with
no else case needed.
Inside place 2 forks. Of where it changes to day
and night. I used 6pm (18) and 7am (7). These
should be set to activate:
For 6pm - same as 18
For 7am - same as 7

we have:

<> FORK Optn:Switch[0003:Lighting Effects] - ON
<> FORK Optn:Varbl[0003:Hours]-18
<>
:END Case
<> FORK Optn:Varbl[0003:Hours]-7
<>
:END Case
:END Case

Now, inside set the screen tone to the colors
you wish to use i suggest 40.40.40.100 and
100.100.100.100. No wait until done.


After that turn the time of day switch on and
the other off. These are optional, i just have
them for game testing.
Thats pretty much it.



<> CYCLE
<> Wait 1.0s.
<> Variable Ch:[0001:Seconds] + , 1
<> FORK Optn: Varbl[0001:Seconds]-60
<> Variable Ch:[0001:Seconds] Set, 0
<> Variable Ch:[0002:Minutes] + , 1
<>
:END Case
<> FORK Optn: Varbl[0002:Minutes]-60
<> Variable Ch:[0002:Minutes] Set, 0
<> Variable Ch:[0003:Hours] + , 1
<>
<> FORK Optn: Varbl[0003:Hours]-24
<> Variable Ch:[0003:Hours] Set, 0
<> Variable Ch:[0004:Days] + , 1
<> FORK Optn: Varbl[0004:Days]-8
<> Variable Ch:[0004:Days] Set, 1
<>
:END Case
<>
:END Case
<> FORK Optn:Switch[0003:Lighting Effects] - ON
<> FORK Optn:Varbl[0003:Hours]-18
<>Set Screen Tone [R040,G040,B040],1.0sec
<>Change Switch:[0001:Day]-OFF Set
<>Change Switch:[0001:Night]-ON Set
<>
:END Case
<> FORK Optn:Varbl[0003:Hours]-7
<>Set Screen Tone [R100,G100,B100],1.0sec
<>Change Switch:[0001:Day]-ON Set
<>Change Switch:[0001:Night]-OFF Set
<>
:END Case
<>
:END Case
<>
:END CYCLE

(SUGGESTION: turn off LIGHTING EFFECTS while
indoors, making the screen go black, and
stuff like that. It may make Screen Tone
changes cool crap while its on.)

We're doing good. Now its Time for...
----------
Weather System
----------

w00p, one of my favs!

alright. This can be big! well, it is!

Lets start of with a nice Forf Conditions
were [0004:Weather Effects] is On.
This will let us turn off rain when we
are indoors/dungeons ect.

Inside our fork we need a fork with
[0005:Its raining] as the condition. and
a Else Case as well.

Inside that (not the else case) put a
Change Variable, and add Randm 1*3 to
the RAIN TIMER variable.
Then, play (i suggest) the RTP Rain1.
After that a fork for when RAIN TIMER
is above 100.

Lets see what this looks like:

<>FORK Optn:Switch[0004:Weather Effects] - ON
<>FORK Optn:Switch[0005:Its raining] - ON
<>Variable Ch:[0006:RAIN TIMER]+ , Randm(1*3)
<>Play SE: Rain1
<>FORK Optn:Varbl[0006:RAIN TIMER]-100abov
<>Variable Ch:[0006:RAIN TIMER]Set, 0
<>Call Weather Effect : None
<>Change Switch:[0005:Its Raining]- OFF Set
<>
:END CASE
<>
:ELSE CASE
<>
:END CASE
<>
:END CASE

Well, i went abit ahead. but u can see, in
the new fork, set RAIN TIMER as 0, and remove
weather effects. Then turn off 0005:Its Raining.
Simple. Eh?

Now, for th else case!
Give us a Change Variable for [0005:RAIN PERCENT]
with set random from
0 to 200. (or whatever your rain chance is!)
Then three forks. One when RAIN PERCENT is 9,
one when its 10, and 11. No elses.
Inside 9, call weather effect, light rain.
In 10, medium rain,
and in 11, heavy rain.
Then after those (in the forks) turn on the ITS RAINING
switch.


(make sure it matches this total, some changes were made)

This should be complete and looking like:

<>FORK Optn:Switch[0004:Weather Effects] - ON
<>FORK Optn:Switch[0005:Its raining] - ON
<>FORK Optn:Varbl[0005:RAIN PERCENT]-9
<>Call Weather Effect : Ra, Lo
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE
<>FORK Optn:Varbl[0005:RAIN PERCENT]-10
<>Call Weather Effect : Ra, Me
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE
<>FORK Optn:Varbl[0005:RAIN PERCENT]-11
<>Call Weather Effect : Ra, Hi
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE <>Variable Ch:[0006:RAIN TIMER]+ , Randm(1*3)
<>Play SE: Rain1
<>FORK Optn:Varbl[0006:RAIN TIMER]-100abov
<>Variable Ch:[0006:RAIN TIMER]Set, 0
<>Call Weather Effect : None
<>Change Switch:[0005:Its Raining]- OFF Set
<>
:END CASE
<>
:ELSE CASE
<>Variable Ch:[0005:RAIN PERCENT]Set, Randm(0*200)
<>FORK Optn:Varbl[0005:RAIN PERCENT]-9
<>Call Weather Effect : Ra, Lo
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE
<>FORK Optn:Varbl[0005:RAIN PERCENT]-10
<>Call Weather Effect : Ra, Me
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE
<>FORK Optn:Varbl[0005:RAIN PERCENT]-11
<>Call Weather Effect : Ra, Hi
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE
<>
:END CASE
<>
:END CASE


That was a mouth full.

>NOTE: TURN OFF THE WEATHER EFFECTS SWITCH >BEFORE< A TELEPORT WERE IT
ISNT USED. LOOKS BEST!<

----------
THEN FINAL CODE
---------
<> CYCLE
<> Wait 1.0s.
<> Variable Ch:[0001:Seconds] + , 1
<> FORK Optn: Varbl[0001:Seconds]-60
<> Variable Ch:[0001:Seconds] Set, 0
<> Variable Ch:[0002:Minutes] + , 1
<>
:END Case
<> FORK Optn: Varbl[0002:Minutes]-60
<> Variable Ch:[0002:Minutes] Set, 0
<> Variable Ch:[0003:Hours] + , 1
<>
<> FORK Optn: Varbl[0003:Hours]-24
<> Variable Ch:[0003:Hours] Set, 0
<> Variable Ch:[0004:Days] + , 1
<> FORK Optn: Varbl[0004:Days]-8
<> Variable Ch:[0004:Days] Set, 1
<>
:END Case
<>
:END Case
<> FORK Optn:Switch[0003:Lighting Effects] - ON
<> FORK Optn:Varbl[0003:Hours]-18
<>Set Screen Tone [R040,G040,B040],1.0sec
<>Change Switch:[0001:Day]-OFF Set
<>Change Switch:[0001:Night]-ON Set
<>
:END Case
<> FORK Optn:Varbl[0003:Hours]-7
<>Set Screen Tone [R100,G100,B100],1.0sec
<>Change Switch:[0001:Day]-ON Set
<>Change Switch:[0001:Night]-OFF Set
<>
:END Case
<>
:END Case
<>FORK Optn:Switch[0004:Weather Effects] - ON
<>FORK Optn:Switch[0005:Its raining] - ON
<>Variable Ch:[0006:RAIN TIMER]+ , Randm(1*3)
<>Play SE: Rain1
<>FORK Optn:Varbl[0006:RAIN TIMER]-100abov
<>Variable Ch:[0006:RAIN TIMER]Set, 0
<>Call Weather Effect : None
<>Change Switch:[0005:Its Raining]- OFF Set
<>
:END CASE
<>
:ELSE CASE
<>Variable Ch:[0005:RAIN PERCENT]Set, Randm(0*200)
<>FORK Optn:Varbl[0005:RAIN PERCENT]-9
<>Call Weather Effect : Ra, Lo
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE
<>FORK Optn:Varbl[0005:RAIN PERCENT]-10
<>Call Weather Effect : Ra, Me
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE
<>FORK Optn:Varbl[0005:RAIN PERCENT]-11
<>Call Weather Effect : Ra, Hi
<>Change Switch:[0005:Its Raining]- ON Set
<>
:END CASE
<>
:END CASE
<>
:END CASE
<>
:END CYCLE


That should do it!/
Found a bug? Email or Aim me:

sp1k@hotmail.com
x spik x

--------------------------------------------------------
IV. Outro
--------------------------------------------------------
Well, thats it, for my first tutorial, its a mouthful.

Enjoy!


--------------------------------------------------------
V. ...and the rest!
--------------------------------------------------------

Thanx everyone! O.o

V1.0 - Everything Written

V1.1 - Update made with RAIN SYSTEM.





--------------------------------------------------------
Spik 2001-4 ©