Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> [Eventing]Extremely Simple Day/Night, For those who dont want it to be complicated
Nuque
post Oct 19 2008, 11:03 AM
Post #1


Level 8
Group Icon

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled




Okay, are you someone who just wants a watch and for their maps to get darker through the day? Then this is for you.

Steps 1 + 2 are parallel process common events with a switch activation
For steps 1 + 2 create an autorun map event that turns on a switch and then erases itself
For step 3 place the script anywhere, I put it below the default scripts and before main. Just copy and paste

[Show/Hide] Core System
Step 1: Minutes and Hours
CODE

Put in the following commands in a common event: (Dont forget a switch to activate it!!)

@>Control Variables:[0002:Hours] = 10 (When you want day to start. This is also when the screen will become daytime)
@>Loop
@>Wait 1 frame(s)
@>Control Variables: [0003: Seconds] += 1
@>Conditional Branch: [0003: Seconds] = 25
@>Control Variables: [0001: Minutes] += 1
@>Control Variables: [0003: Seconds] = 0
@>Conditional Branch: Variable [0001: Minutes] == 60
@>Control Variable: [0001: Minutes] == 0
@>Control Variable: [0002: Hours] += 1
@>
: Branch End
@>Conditional Branch: Variable [0002: Hours] ==13
@>Condition Branch: [0004: AM/PM] = 1
@>Control Variables: [0002: Hours] = 1
@>Control Variables: [0004: AM/PM] = 2
@>Control Switches: [0001: PM] = OFF
Else
@>Control Variables: [0002: Hours] = 1
@>Control Variables: [0004: AM/PM] = 1
@>Control Switches: [0001: PM] = ON
: Branch End
@>
: Repeat Above
@>





Step 2: Day and Night
CODE


Put in the following in a common event: (Dont forget a switch to activate it!!)

@>Loop
@>Condition Branch: Switch [0001: PM] = ON
@>Conditional Branch Variable [0002: Hours] = 10 < make this number when night starts! (here its 10 pm)
@>Change Screen Color Tone: (-187, -119, -34, 68)
@>Control Switches: [0002: Night] = ON
@>
: Branch End
@>
: Branch End
@>Condition Branch: Switch [0001: PM] = OFF
@>Conditional Branch Variable [0002: Hours] = 6 < make this number when morning starts! (here its 6 am)
@>Change Screen Color Tone: ( 0, 34, 0, 0)
@>Control Switches: [0002: Night] = OFF
@>
: Branch End
@>
: Branch End
@>Condition Branch: Switch [0001: PM] = ON
@>Conditional Branch Variable [0002: Hours] = 10 < make this number when day starts! (here its 10 am)
@>Change Screen Color Tone: ( 0, 0, 0, 0)
@>
: Branch End
@>
: Branch End
@> Wait: 1 frame(s)
@>
: Repeat Above
@>

Cool, aint it?

Test it out, its awesome!!!!
Heres a screenie to look at:



Note that the hud is optional and does not have to be used, instead you can use a watch on the menu screen, an item, or a map event.
This is covered in the next spoiler tag.



[Show/Hide] Watch/Hud
Option A: Watch On Menu Screen

Edit def refresh in Window_PlayTime to look like this:
CODE

def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = $game_variables[2]
min = $game_variables[1]
text = sprintf("%02d:%02d", hour, min)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end

If it shows 0s, change these lines:
hour = $game_variables[2] Change 2 to your hour variable
min = $game_variables[1] Change 1 to your minute variable


Option B: Hud
CODE

class Window_YourHUD < Window_Base
def initialize
super(0, 416, 640, 64)
self.contents = Bitmap.new(640 - 32, 64 - 32)
refresh
end
def refresh
self.contents.clear
reset_variables
return if !@actor
draw_actor_hp(@actor, 0, 0)
draw_actor_sp(@actor, 160, 0)
self.contents.font.color = system_color
self.contents.draw_text(320, 0, 60, 32, "Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = $game_variables[2]
min = $game_variables[1]
text = sprintf("%02d:%02d", hour, min)
self.contents.font.color = normal_color
self.contents.draw_text(400, 0, 60, 32, text, 2)
end
def reset_variables
@actor = $game_party.actors[0]
@old_hp = @actor ? @actor.hp : 0
@old_maxhp = @actor ? @actor.maxhp : 0
@old_sp = @actor ? @actor.sp : 0
@old_maxsp = @actor ? @actor.maxsp : 0
end
def update
super
refresh if (@actor = $game_party.actors[0] or
@old_hp = @actor ? @actor.hp : 0 or
@old_maxhp = @actor ? @actor.maxhp : 0 or
@old_sp = @actor ? @actor.sp : 0 or
@old_maxsp = @actor ? @actor.maxsp : 0)
end
end
class Scene_Map
alias yourhud_main main
alias yourhud_update update
def main
@yourhud = Window_YourHUD.new
yourhud_main
@yourhud.dispose
end
def update
@yourhud.update
yourhud_update
end
end


If there is an error, change the lines
hour = $game_variables[2]
min = $game_variables[1]
to
hour = $game_variables[y] y = your hour variable
min = $game_variables[x] x = your min. variable





Addon 1 : Bed System (Map Event)
CODE

@>Change Screen Color Tone: ( 0, 34, 0, 0)
@>Wait: 20 frame(s)
@>Play ME: '014-Inn01", 100, 100
@>Control Variables: [0002: Hours] = 7 <<This is your time when waking up
@>Control Variables: [0001: Minutes] = 30 << This is your minutes, together its 7:30
@>Control Variables: [0003: Seconds] = 0
@>Control Variables: [0004: AM/PM] = 2
@>Wait: 60 frame(s)
@>Change Screen Color Tone: (0, 0, 0, 0)
@>


Coming Soon:

1. Weather System - just needs to be added (extremely buggy, ill post it, but you have to help me out!)
2. Houses dont get dark until bedtime (9:30?) - to be done
3. Bed System - DONE!
4. Lightning in my weather system (also easily done)

Sorry if im lazy, ill get these done eventually.




!!!!NEW!!!!
Demo Available!!!

This post has been edited by shantanu: Nov 22 2008, 05:04 PM
Attached File(s)
Attached File  DayNight_Demo.zip ( 190.34K ) Number of downloads: 43
 


__________________________
[Show/Hide] Koushaku Productions

Current Koushaku Productions Members:
2
Current Koushaku Productions Projects: 3
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
Nuque
post Oct 22 2008, 01:34 PM
Post #2


Level 8
Group Icon

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled




Libelnon, thank you, I think I will add that in to make the sytem less laggy. Ill add it now!


Night_Runner, you are not right.
I checked it seconds after your first post on this thread just to make sure. Now I am positive of one thing, and that is that it works
I think maybe you copied something wrong?

This post has been edited by shantanu: Oct 22 2008, 01:43 PM


__________________________
[Show/Hide] Koushaku Productions

Current Koushaku Productions Members:
2
Current Koushaku Productions Projects: 3
Go to the top of the page
 
+Quote Post
   

Posts in this topic
- shantanu   [Eventing]Extremely Simple Day/Night   Oct 19 2008, 11:03 AM
- - punk13   Looks cool 1) in common events do you mean the one...   Oct 19 2008, 11:19 AM
- - shantanu   here are some answers fer ya 1. An parallel proce...   Oct 19 2008, 11:34 AM
- - Night_Runner   Edited: Have you tried this while changing maps? I...   Oct 19 2008, 04:26 PM
- - -Mystic-   Not bad, though this is simple... Though XD a tru...   Oct 19 2008, 09:03 PM
|- - shantanu   uh, Night_runner, quite frankly, you are completel...   Oct 20 2008, 12:29 PM
- - Night_Runner   No problems shantanu, but did you actually physica...   Oct 21 2008, 05:56 PM
- - Libelnon   Hei - Shantanu - I wrote a tutorial on a event bas...   Oct 22 2008, 11:51 AM
- - Night_Runner   Here's a link Project2.zip Sorry I'm so m...   Oct 22 2008, 02:08 PM
- - Libelnon   Heh, just a note - When you use time scripts, I us...   Oct 23 2008, 11:50 AM
- - shantanu   Night_Runner, I checked that out, and there doesnt...   Oct 23 2008, 01:31 PM
- - hackje   ho do i add the script i've never used scripts...   Oct 24 2008, 02:05 AM
- - Libelnon   do us a favour - PM me when you've fully updat...   Oct 25 2008, 02:41 AM
|- - shantanu   Im pmed you, libelnon. I modified the events and n...   Oct 25 2008, 04:29 PM
- - Night_Runner   Where did you get that HUD from? I get the overwhe...   Oct 30 2008, 01:54 PM
- - Achilles   Putting anything besides the time in the HUD was a...   Oct 30 2008, 05:05 PM
- - Omegas7   Nice, but you should move this to the tutorials se...   Oct 30 2008, 05:07 PM
- - Libelnon   well, maybe when we have perfected this, we should...   Nov 9 2008, 03:25 AM
- - shantanu   Bed System is now available!!! And als...   Nov 20 2008, 03:26 PM
- - -Mystic-   Not bad at all, but you should go by a 24hr clock...   Nov 21 2008, 04:05 PM
|- - IchigekiHissatsuShinigami   QUOTE (-Mystic- @ Nov 21 2008, 04...   Dec 8 2008, 07:47 AM
- - shantanu   I updated it, and now it is a lot less clogged up....   Nov 22 2008, 05:13 PM
- - -Mystic-   Yea, it's a reference.   Nov 22 2008, 11:29 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th May 2013 - 09:06 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker