Home
Help
Search
Calendar
Login
Register
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Click here to join us on IRC (#charas on irc.freenode.net)!
Charas-Project
»
Game Creation
»
Requests
»
Tutorials
»
Day/night generator
« previous
next »
Print
Pages: [
1
]
Author
Topic: Day/night generator (Read 2001 times)
X_marks_the_ed
trygtt o sizg msw kisg
Royal
Posts: 4,394
WHAT THE WHY ARE THESE BUTTONS
Day/night generator
«
on:
March 04, 2006, 07:32:36 PM »
I'm not sure if anyone has posted one before, but what the heck?
Requirements:
------------------
-1 timer all throughout the game
-A timescale for which your game will run on. (For example: 1 minute here is an hour in the game.)
-A variable named 'Time'
For those of you who understand RPG maker code:
----------------------------------------------------------------
Create a common event named Night_day with the following code:
<>Branch if Timer 2 is 0M 00S Less/equal
-<>Branch if Var [XXXX:time] is 24
--<>Variable Oper: [XXXX:time] Set, 1
--<>Timer 2 Operation: Set, XM XXS
--<>Timer 2 Operation: Start
--<>
-:Else handler
--<>Variable Oper: [XXXX:time] +,1
--<>Branch if Var [XXXX:time] is 13 or more
---<>Tint Screen: (R050,G050,B050,S100)
---<>
--:Else handler
---<>Tint Screen: (R100,G100,B100,S100)
---<>
--:End
--<>Timer 2 Operation: Set, XM XXS
--<>Timer 2 Operation: Start
--<>
-:End
-<>
:Else handler
-<>
:End
<>
The easier method:
------------------------
1. Make sure you meet ALL of the requirements.
2.
3. Make a Parallel Process (no trigger switch) common event named 'Night-day.'
4. Make a conditional branch (branch A, we'll refer to). Check whichever timer (timer X, we'll refer to) is available in your game. Set the minutes and seconds you want to represent an hour in the game. Select "or less." Check off the box asking for a custom handler if condition not met.
---Inside branch A---
5. Create another branch (branch B). Check "variable" and select the variable "time". check number and enter the value "24" (or however many hours your game's world has). Select "equal to". Check the box asking for a custom handler if condition is not met.
---Inside branch B---
6. Add a variable operation. Check "single variable" and select the variable "time". Check "set equal". Check "number" and enter the value "1".
7. Add a timer operation. Check the available timer. Check "set". Check "set to" and enter the amount of time you want each game hour to last.
8. Add another timer operation. Check "start". You may choose whether or not to display timer onscreen.
---Inside Branch B ELSE---
9. Add a variable operation. Check "add". Enter the value "1".
10. Create a third branch (Branch C). It should still be on variable and time. Enter the value "13" (Or 1 more than half of your total hour number). Select "Greater than or equal to". And check the box asking for a custom handler if condition is not met.
---Inside Branch C---
11. Add a Tint Screen step. Move red, green, and blue to 50. Uncheck "wait during transition".
---Inside Branch C ELSE---
12. Add a Tint screen step. Move red, green, and blue to 100. Uncheck "wait during transition".
---Inside Branch B ELSE (after C ELSE)---
13. Copy and paste number 7's Timer Operation.
14. Add a timer operation. Select the timer you a re using, and select "start".
This should do the trick, now, after every time the timer you used reaches 0, it should add another hour. Then, it will calculate which hour it is. Then, it uses a schedule to determine how dark or light it is (whether it's night or day).
To create objects that refer to the time, (for example, an old man that if you talk to him at midnight, he'll give you something) use the variable "time." The variable "time" is really the hour of the day. This should also reset itself whenever it is a new day.
Note:
DAMN delete button! Whenever I don't mean to press it, it doesn't ask if I want to continue deleting, it just deletes it!
Answering Darkflood's question:
Thanks. I never though of that.
To clear up any confusion, this tutorial is not about just darkening the screen, this tutorial makes it so that, on it's own, it turns from night to day, even in the middle of a map.
Logged
Print
Pages: [
1
]
« previous
next »
Charas-Project
»
Game Creation
»
Requests
»
Tutorials
»
Day/night generator