The RPG Maker Resource Kit

RMRK RPG Maker Creation => General Tutorials and Eventing => RPG Maker General => Tutorials Database => Topic started by: Alerith on December 11, 2006, 10:11:52 PM

Title: AG- Day and Night system
Post by: Alerith on December 11, 2006, 10:11:52 PM
This is incredibly easy. I dont see why everyone keeps asking for a script.

Step 1: Create a Common Event for your time triggers.
Step 2: Create a switch that will activate the common event. (Ex: Switch 001: Daynight)
-----------------------------------------------------------------------

First create an event in the map where the game starts. Set it to Auto Start then put the following events in:

Switch Operation: 001: Daynight is ON
Erase Event

Now that that is done, go into the common event and enter the following:

[Loop]
Tint screen: -87, -87, -87, transition frames: 40
Wait: 999 frames.
Tint Screen: 0, 0, 0, transition frames: 40
[End Loop]

Your first command will be to loop the event over and over so that it continues through your game.

Your second command is going to be to tint the screen. Take all the colors down to -87ish. That will be sufficient for night.

Your third command will be to wait 999 frames. This is plenty of time for day and for night.

Your fourth command will be to tint the screen again. Take all colors back to 0 each. This will return the tint to the normal screen brightness.

----------------------------------------------------------------------------------

If you want certain events to happen during day or night, then you do this:


[Loop]
Trigger Operation: 002: Daylight is OFF
Tint screen: -87, -87, -87, transition frames: 40
Trigger Operation: 002: Nighttime is ON
Wait: 999 frames.
Trigger Operation: 002: Daylight is ON
Tint Screen: 0, 0, 0, transition frames: 40
Trigger Operation: 002: Nighttime is OFF
[End Loop]

This way, you can set certain events to only be active when the nighttime or daytime switches are active, therefore allowing you to make events corresponding to day and night.

This also works if you want to create a werewolf system for your character. (*hint hint*)

Title: Re: AG- Day and Night system
Post by: Cheal on December 12, 2006, 12:01:24 AM
Looks awesome! I'm definetly going to try this out.  ;D
Title: Re: AG- Day and Night system
Post by: Alerith on December 12, 2006, 12:05:58 AM
Sorry, one thing I forgot to mention:

If you want day or night to last longer, just add more wait commands. 999 is the limit per command, but you can add as many 999 (or whatever value you need) as you want until you get it to the length you want.
Title: Re: AG- Day and Night system
Post by: Cheal on December 12, 2006, 12:35:01 AM
I kind of figured that was the case...

Anyways, this seems a whole lot easier than the scripts I've seen. Again, good job!  ;D
Title: Re: AG- Day and Night system
Post by: J-Crew on December 12, 2006, 12:56:08 AM
There's no doubt that this is a good tutorial, but I think you should describe how to do certain events at set times. I'm eager to hear some of your ideas. And don't you think the events add too much lag to your game?
Title: Re: AG- Day and Night system
Post by: Blizzard on December 12, 2006, 01:38:59 PM
It's a nice idea, but the event code for your DNS is ruggish.

Code: [Select]
[Loop]
Trigger Operation: 002: Daylight is OFF
Common Event: Wolf
Tint screen: -87, -87, -87, transition frames: 40
Trigger Operation: 002: Nighttime is ON
Wait: 999 frames.
Trigger Operation: 002: Daylight is ON
Common Event: Human
Tint Screen: 0, 0, 0, transition frames: 40
Trigger Operation: 002: Nighttime is OFF
[End Loop]

If I wait 990 frames and change the map the counter will go from the beginning again. Sorry, but I don't think this is a good tutorial, because it's not sophisticated.

@J-Crew: My DDNS was once common-event-based. It had like 10 times more commands and that in 3 different common events (so 30 times more event code) and it didn't lag. Right now I have quite a few common events and quite some scripts working during the map scene and I don't have lag. Of course I am also using an Event-Anti-Lag System.
Title: Re: AG- Day and Night system
Post by: Alerith on December 12, 2006, 06:10:30 PM
If I wait 990 frames and change the map the counter will go from the beginning again. Sorry, but I don't think this is a good tutorial, because it's not sophisticated.

Your absolutely right. I never really counted like that. When your playing the game, you won't really notice, but I guess since we are all game designers, it sticks out pretty bad.

Thanks for pointing that out.
Title: Re: AG- Day and Night system
Post by: Blizzard on December 12, 2006, 09:14:40 PM
No problem. We're all here to help each other. :)