PDA

View Full Version : Day and Night


Webmaster Tyler
August 10th, 2005, 07:08 PM
All you need are:

One Common Event.
Switch: Day Time
Switch: Night Time

Common Events:

Name: Day Night
Event Start Condition: Parallel Process
Event Commands: (start)

<>Cycle
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>switch:daytime off
<>switch: nigth time on
<>set screen tone: 50,50,50,100
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>switch: nigth time off
<>set screen tone: 100,100,100,100


Now you can do what ever you want with it!
O yea this is only for Rpg maker 2003

Webmaster Tyler
August 10th, 2005, 09:39 PM
srry for the Double Post
Heres one for Rpg Maker XP
#=======================================#
# ■ class Game_Title #
# written by Deke
# Rewiten by Near Fantastica
# 16.02.05
#------------------------------------------------------------------------------#
#=======================================#
class Game_Time

attr_accessor :minute_length

def initialize
@minute_length=2.0 #length of game minute in real seconds
@hour_length= 60.0 #minute in an hour
@day_length=24.0 #hours in a day
@month_length=30.0 #days in a month
@year_length=12.0 #months in a year
@minutes=0 #starting minute count
start_minute=56
add_minutes(start_minute)
start_hour=23 #starting hour count
add_hours(start_hour)
start_day=5 #starting day count
add_days(start_day)
start_month=1 #starting month count
add_months(start_month-1)
start_year=129 #starting year count
add_years(start_year)
end

def add_minutes(minutes)
@minutes +=minutes
end

def add_hours(hours)
@minutes +=hours*@hour_length
end

def add_days(days)
@minutes += days*@hour_length*@day_length
end

def add_months(months)
@minutes +=months * @hour_length*@day_length*@month_length
end

def add_years(years)
@minutes += years * @hour_length*@day_length*@month_length * @year_length
end


def get_year
minutes=get_total_minutes
year=minutes / @hour_length / @day_length / @month_length / @year_length
return year
end

def get_month
minutes=get_total_minutes
month=minutes / @hour_length / @day_length / @month_length % @year_length + 1
return month
end

def get_day
minutes=get_total_minutes
day=minutes / @hour_length / @day_length % @month_length
return day
end

def get_hour
minutes=get_total_minutes
hour=minutes / @hour_length % @day_length
return hour
end

def get_total_minutes
total_sec=Graphics.frame_count / Graphics.frame_rate
minute=(total_sec/@minute_length+@minutes)
return minute
end

def get_minute
minutes=get_total_minutes % @hour_length
return minutes
end

def get_tone
period_length=Math::PI*(get_hour / @day_length)
red_shift= -100+ 115*Math.sin(period_length)
green_shift= -140+ 155*Math.sin(period_length)
blue_shift= -150+ 165*Math.sin(period_length)
return Tone.new(red_shift, green_shift, blue_shift, 0)
end


end # of class Game_Time

#=======================================#
# ■ class Window_Time #
# written by Deke #
#------------------------------------------------------------------------------#
#=======================================#
class Window_Time < Window_Base

#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Time" window font
self.contents.font.size = $defaultfontsize
refresh
end

#--------------------------------------------------------------------------
def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
@minute=$game_time.get_minute.floor
hour = $game_time.get_hour
pm_flag= hour >=12 ? true : false
hour= hour >= 12 ? hour-12 : hour
day=$game_time.get_day
month=$game_time.get_month
year=$game_time.get_year
if hour.floor==0
text=sprintf("%02d:%02d",12,@minute)
else
text=sprintf("%02d:%02d",hour,@minute)
end
if pm_flag
text += " PM"
else
text += " AM"
end
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, text, 2)
text = sprintf("%02d-%02d-%02d", month, day, year)
self.contents.font.color=system_color
self.contents.draw_text(4,32,120,32,text)
end

#--------------------------------------------------------------------------
def update
if $game_time.get_minute.floor != @minute
refresh
end
end
end # of class

#=======================================
class Game_Temp
#--------------------------------------------------------------------------
# ● Refer setup to Game Temp
#--------------------------------------------------------------------------
alias dns_game_temp_initalize initialize
#--------------------------------------------------------------------------
# ● Refer the Attr
#--------------------------------------------------------------------------
attr_reader :map_infos #Added Lines
attr_reader :outside_array #Added Lines
#--------------------------------------------------------------------------
# ● Refer setup to Scene Map
#--------------------------------------------------------------------------
def initialize
dns_game_temp_initalize
@outside_array = Array.new
@map_infos = load_data("Data/MapInfos.rxdata")
for key in @map_infos.keys
@outside_array[key] = @map_infos[key].name.include?("*")
end
end
end

#=======================================
class Scene_Map
#--------------------------------------------------------------------------
# ● Refer setup to Scene Map
#--------------------------------------------------------------------------
alias dns_scene_map_main main
alias dns_scene_map_update update
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
if $game_temp.outside_array[$game_map.map_id]
tone=$game_time.get_tone
@minute=$game_time.get_minute.floor
$game_screen.start_tone_change(tone, 0)
end
# スプライトセットを作成
@spriteset = Spriteset_Map.new
# メッセージウィンドウを作成
@message_window = Window_Message.new
# トランジション実行
Graphics.transition
# メインループ
loop do
$light_effects.refresh
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# スプライトセットを解放
@spriteset.dispose
# メッセージウィンドウを解放
@message_window.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
$light_effects.hide
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
$light_effects.update
conditional1 =$game_temp.outside_array[$game_map.map_id] and $game_time.get_minute.floor != @minute
conditional2 =$game_temp.outside_array[$game_map.map_id] and @current_id != $game_map.map_id
if conditional1 or conditional2
tone=$game_time.get_tone
$game_screen.start_tone_change(tone, 0)
@minute = $game_time.get_minute.floor
$game_map.need_refresh=true
@current_id=$game_map.map_id
end
if $game_temp.outside_array[$game_map.map_id] == false and @current_id != $game_map.map_id
$game_screen.start_tone_change(Tone.new(0,0,0,0),0 )
@current_id=$game_map.map_id
end
dns_scene_map_update
end
end

#================================================= =====
class Scene_Title
#--------------------------------------------------------------------------
# ● Refer setup to Scene Map
#--------------------------------------------------------------------------
alias dns_scene_title_update update
#--------------------------------------------------------------------------
# ● Refer setup to Scene Map
#--------------------------------------------------------------------------
def update
$game_time=Game_Time.new
#Dubealex Addition (from XRXS) to show Map Name on screen
dns_scene_title_update
end
end

#================================================= =======
class Scene_Load
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$game_time =Marshal.load(file) #Added Line
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end # of Scene_Load updates

#================================================= ======
class Scene_Save
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($game_time,file) # Added Line
end
end # of Scene_Save updates

#================================================= =======

class Game_Map
#--------------------------------------------------------------------------
# ● Refer the attr
#--------------------------------------------------------------------------
attr_reader :outside
attr_reader :map_id
#--------------------------------------------------------------------------
# ● Outside
#--------------------------------------------------------------------------
def outside
return $game_temp.outside_array[@map_id]
end
end

#================================================= =============================
# ■ Light Effect System
#------------------------------------------------------------------------------
#  By: Near Fantastica
# Date: 13/2/05
#
# Addes light Effects to the DNS so objects glow and have ground effect lighting...
#================================================= =============================

class Light_Effect_System
#--------------------------------------------------------------------------
# ● Refer the attr
#--------------------------------------------------------------------------
attr_accessor :picture_le
attr_accessor :event_list
attr_accessor :type_list
#--------------------------------------------------------------------------
# ● Initialization
#--------------------------------------------------------------------------
def initialize
@event_counter = 0
@picture_le = Array.new
@event_list = Array.new
@type_list = Array.new
end
#--------------------------------------------------------------------------
# ● Setup Light Effects on Map Change
#--------------------------------------------------------------------------
def setup
# Setup Event Max
@event_counter = 0
for i in 1..999
if $game_map.map.events[i].id > @event_counter
@event_counter = $game_map.map.events[i].id
end
end
#
for i in 1..@event_counter
if $game_map.map.events[i] == nil
next
end
case $game_map.map.events[i].name
when "Ground"
ground(i)
when "Fire"
fire(i)
when "Lamp Post"
lamp(i)
when "Left Lantern"
left_lantern(i)
when "Right Lantern"
right_lantern(i)
end
end
end
#--------------------------------------------------------------------------
# ● Updates the Array based on time of day
#--------------------------------------------------------------------------
def update
if $game_time.get_hour > 7 and $game_time.get_hour < 14
hide
else
show
end
end
#--------------------------------------------------------------------------
# ● Updates the XY of the sprites
#--------------------------------------------------------------------------
def refresh
for i in 0..$light_effects.picture_le.size - 1
case $light_effects.type_list[i]
when "Ground"
$light_effects.picture_le[i].x = ($game_map.events[$light_effects.event_list[i]].real_x - 200 - $game_map.display_x) / 4
$light_effects.picture_le[i].y = ($game_map.events[$light_effects.event_list[i]].real_y - 200 - $game_map.display_y) / 4
$light_effects.picture_le[i].visible = true
when "Fire"
$light_effects.picture_le[i].x = ($game_map.events[$light_effects.event_list[i]].real_x - 300 - $game_map.display_x) / 4
$light_effects.picture_le[i].y = ($game_map.events[$light_effects.event_list[i]].real_y - 300 - $game_map.display_y) / 4
$light_effects.picture_le[i].visible = true
when "Left Lamp Post"
$light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 5
$light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 15
when "Right Lamp Post"
$light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 25
$light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 15
$light_effects.picture_le[i].visible = true
when "Left Lantern"
$light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 20
$light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 5
$light_effects.picture_le[i].visible = true
when "Right Lantern"
$light_effects.picture_le[i].x = (-0.25 * $game_map.display_x) + ($game_map.events[$light_effects.event_list[i]].x * 32) - 10
$light_effects.picture_le[i].y = (-0.25 * $game_map.display_y) + ($game_map.events[$light_effects.event_list[i]].y * 32) - 5
$light_effects.picture_le[i].visible = true
end
end
end
#--------------------------------------------------------------------------
# ● Redraws the Array
#--------------------------------------------------------------------------
def redraw
if @picture_le != []
for i in 0..@picture_le.size - 1
@picture_le[i].bitmap.dispose
end
@picture_le = Array.new
@event_list = Array.new
@type_list = Array.new
end
end
#--------------------------------------------------------------------------
# ● Shows Array
#--------------------------------------------------------------------------
def show
if @picture_le != []
for i in 0..@picture_le.size - 1
@picture_le[i].visible = true
end
end
end
#--------------------------------------------------------------------------
# ● Hides Array
#--------------------------------------------------------------------------
def hide
if @picture_le != []
for i in 0..@picture_le.size - 1
@picture_le[i].visible = false
end
end
end
#--------------------------------------------------------------------------
# ● Setup Light Effects for Ground
#--------------------------------------------------------------------------
def ground(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.zoom_x = 200 / 100.0
light_effects.zoom_y = 200 / 100.0
light_effects.z = 1000
light_effects.opacity = 50
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Ground")
end
#--------------------------------------------------------------------------
# ● Setup Light Effects for Fire
#--------------------------------------------------------------------------
def fire(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.zoom_x = 300 / 100.0
light_effects.zoom_y = 300 / 100.0
light_effects.z = 1000
light_effects.opacity = 100
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Fire")
end
#--------------------------------------------------------------------------
# ● Setup Light Effects for Lamp
#--------------------------------------------------------------------------
def lamp(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.z = 1000
light_effects.opacity = 100
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Left Lamp Post")
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.z = 1000
light_effects.opacity = 100
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Right Lamp Post")
end
#--------------------------------------------------------------------------
# ● Setup Light Effects for Lantern
#--------------------------------------------------------------------------
def left_lantern(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.z = 1000
light_effects.opacity = 150
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Left Lantern")
end
#--------------------------------------------------------------------------
# ● Setup Light Effects for Lantern
#--------------------------------------------------------------------------
def right_lantern(event_index)
light_effects = Sprite.new
light_effects.bitmap = RPG::Cache.picture("LE.PNG")
light_effects.z = 1000
light_effects.opacity = 150
light_effects.visible = false
@picture_le.push(light_effects)
@event_list.push(event_index)
@type_list.push("Right Lantern")
end
end

#================================================= =============================
# ■ Game_Map
#------------------------------------------------------------------------------
#  Add defenision of the names to Game Map Class
#================================================= =============================

class Game_Map
#--------------------------------------------------------------------------
# ● Refer the attr
#--------------------------------------------------------------------------
attr_accessor :map
#--------------------------------------------------------------------------
# ● Refer setup to Game Map
#--------------------------------------------------------------------------
alias les_game_map_setup setup
#--------------------------------------------------------------------------
# ● Refers the Map Setup
#--------------------------------------------------------------------------
def setup(map_id)
$light_effects.redraw
les_game_map_setup(map_id)
$light_effects.setup
end
end

#================================================= =============================
# ■ Scene_Title
#------------------------------------------------------------------------------
#  It is the class which processes the title picture
#================================================= =============================

class Scene_Title
#--------------------------------------------------------------------------
# ● Refer setup to Scene Title
#--------------------------------------------------------------------------
alias les_scene_title_update update
#--------------------------------------------------------------------------
# ● Sets up the light effects
#--------------------------------------------------------------------------
def update
$light_effects = Light_Effect_System.new
les_scene_title_update
end
end

Make person appear at night?
Change

Code:

def update
if $game_time.get_hour > 7 and $game_time.get_hour < 14
hide
else
show
end
end

to
Code:

def update
if $game_time.get_hour > 7 and $game_time.get_hour < 14
hide
$game_switches[1] = true
else
show
$game_switches[1] = false
end
end

On day switch 0001 will be on.
24-hour clock?
Code:

def refresh
self.contents.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
@minute=$game_time.get_minute.floor
hour = $game_time.get_hour
day=$game_time.get_day
month=$game_time.get_month
year=$game_time.get_year
text=sprintf("%02d:%02d",hour,@minute)
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, text, 2)
text = sprintf("%02d-%02d-%02d", month, day, year)
self.contents.font.color=system_color
self.contents.draw_text(4,32,120,32,text)
end

Dudedude
August 28th, 2005, 04:47 AM
I dont under stand the RPGM2K3 one!

halfling2
August 28th, 2005, 06:22 PM
Can you copy and pastescripts coz that's really freakin' long.

Webmaster Tyler
August 28th, 2005, 07:56 PM
Yea of cousre you can! that would be stupid if you couldnt

funnybunny
August 31st, 2005, 04:12 AM
All you need are:

One Common Event.
Switch: Day Time
Switch: Night Time

Common Events:

Name: Day Night
Event Start Condition: Parallel Process
Event Commands: (start)

<>Cycle
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>switch:daytime off
<>switch: nigth time on
<>set screen tone: 50,50,50,100
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>switch: nigth time off
<>set screen tone: 100,100,100,100


Now you can do what ever you want with it!
O yea this is only for Rpg maker 2003

This won't work unless you have one big map, and I don't think most people will have. You code will reset once you have teleported(I think).

I would do it like this:

<>Cycle
<>var night +1
<>If var night = 300
<>switch:daytime off
<>switch: nigth time on
<>set screen tone: 50,50,50,100
<>End
<>If var night >= 600
<>switch:daytime on
<>switch: nigth time off
<>set screen tone: 100,100,100,100
<>Set var night to 0
<>End
<>wait 1.0
<>End cycle

This will also work when you teleport to an other map

Datriot
August 31st, 2005, 07:21 AM
Yeah, I agree with you funnybunny, that's better for rm2k3, although I use a completely different system for my Day/Noght scripts.:)

Webmaster Tyler
September 3rd, 2005, 12:46 AM
This won't work unless you have one big map, and I don't think most people will have. You code will reset once you have teleported(I think).

I would do it like this:

<>Cycle
<>var night +1
<>If var night = 300
<>switch:daytime off
<>switch: nigth time on
<>set screen tone: 50,50,50,100
<>End
<>If var night >= 600
<>switch:daytime on
<>switch: nigth time off
<>set screen tone: 100,100,100,100
<>Set var night to 0
<>End
<>wait 1.0
<>End cycle

This will also work when you teleport to an other map

But then if you use urs then if you go into a house it would be day and night in there to!

funnybunny
September 3rd, 2005, 04:40 AM
But then if you use urs then if you go into a house it would be day and night in there to!
Yes, but you can change it with the tint screen thing(same with yours too you know) but with my code the time will keep running so you can use the conditions better and you actully know when it is going to be day or night.

just place this after the teleport event when you enter the house

<>set screen tone: 100,100,100,100 wait 0.0

and place this after the teleport event when you leave the house

<>IF nigth time on
<>set screen tone: 50,50,50,100 wait 0.0
<>End
<>IF daytime on
<>set screen tone: 100,100,100,100 wait 0.0
<>End

That would fix the problem, also you can add the second code to a common event and call that, would save some time if you want to change something.

rubyrulez
September 3rd, 2005, 01:34 PM
Well, here is how I programmed the Pokemon: Dawn Day/Night system. First and Foremost, you need to program the clock.

<>Branch if Var [Hours] is 0 or more
<>Tint: (R30, G30, B70, S120), Wait 1 sec
<>
:Else Handler
<>
:End
<>Branch if Var [Hours] is 6 or more
<>Tint: (R100, G60, B60, S120), Wait 1 sec
<>
:Else Handler
<>
:End
<>Branch if Var [Hours] is 9 or more
<>Tint: (R100, G100, B100, S100), Wait 1 sec
<>
:Else Handler
<>
:End
<>Branch if Var [Hours] is 18 or more
<>Tint: (R100, G60, B60, S120), Wait 1 sec
<>
:Else Handler
<>
:End
<>Branch if Var [Hours] is 20 or more
<>Tint: (R30, G30, B70, S120), Wait 1 sec
<>
:Else Handler
<>
:End
<>

It works for me...

Webmaster Tyler
September 3rd, 2005, 01:44 PM
Well, here is how I programmed the Pokemon: Dawn Day/Night system. First and Foremost, you need to program the clock.

<>Branch if Var [Hours] is 0 or more
<>Tint: (R30, G30, B70, S120), Wait 1 sec
<>
:Else Handler
<>
:End
<>Branch if Var [Hours] is 6 or more
<>Tint: (R100, G60, B60, S120), Wait 1 sec
<>
:Else Handler
<>
:End
<>Branch if Var [Hours] is 9 or more
<>Tint: (R100, G100, B100, S100), Wait 1 sec
<>
:Else Handler
<>
:End
<>Branch if Var [Hours] is 18 or more
<>Tint: (R100, G60, B60, S120), Wait 1 sec
<>
:Else Handler
<>
:End
<>Branch if Var [Hours] is 20 or more
<>Tint: (R30, G30, B70, S120), Wait 1 sec
<>
:Else Handler
<>
:End
<>

It works for me...


Yours looks really good i really like it :shocked:

funnybunny
September 3rd, 2005, 01:54 PM
Well, here is how I programmed the Pokemon: Dawn Day/Night system. First and Foremost, you need to program the clock.

It works for me...
would your code not change color all the time? sinds you used the "is # or more" instaid of the "same as", well if you tested it and it works good job then :).

PS I'm not sute if it is a paralel event of a call one. And the else cases can be removed, the have no function

rubyrulez
September 3rd, 2005, 04:57 PM
would your code not change color all the time? sinds you used the "is # or more" instaid of the "same as", well if you tested it and it works good job then :).

PS I'm not sute if it is a paralel event of a call one. And the else cases can be removed, the have no function

Well, since there is no option that lets you choose 2 numbers and the event occurs when the value of the variable is between those 2 numbers, I used that system and it works extremely well for me. Using the 'same as' would make it more difficult, as you would have to program the event for each hour. BTW, the event is a call event.

funnybunny
September 4th, 2005, 05:04 AM
Well I was thinking about your code and it still seems weird, Example:

var hour = 10 and you call the event because you came out of a house where the tint is (R100, G100, B100, S100)
<>Branch if Var [Hours] is 0 or more
<>Tint: (R30, G30, B70, S120), Wait 1 sec
<>
:End
What the code will do is change the tint to(R30, G30, B70, S120)
after a second it will continu to the next part of coding,
<>Branch if Var [Hours] is 6 or more
<>Tint: (R100, G60, B60, S120), Wait 1 sec
<>
:End
Because the variable is also higher then 6 he will then change the tint to (R30, G30, B70, S120) and continu to the next part of coding.
<>Branch if Var [Hours] is 9 or more
<>Tint: (R100, G100, B100, S100), Wait 1 sec
<>
:End
Same here.
<>Branch if Var [Hours] is 18 or more
<>Tint: (R100, G60, B60, S120), Wait 1 sec
<>
:End
<>Branch if Var [Hours] is 20 or more
<>Tint: (R30, G30, B70, S120), Wait 1 sec
<>
:End
this part he will skip 'cause the Branch prevents it.

So the result is when this event is called, the screen first goes dark to change back to the original tint :\
That seems a bit weird to me, I didn't test it but this is what will happen IMO(I could be wrong).

rubyrulez
September 4th, 2005, 01:47 PM
Actually, it does work perfectly, because coding like that acts as an in-between command (as I said, you can't choose 2 values and tell the event to occur between those variables.) This style of coding acts like choosing 2 values and having the event occur between. I would reccomend testing it before you say something like that...

funnybunny
September 5th, 2005, 02:45 AM
Actually, it does work perfectly, because coding like that acts as an in-between command (as I said, you can't choose 2 values and tell the event to occur between those variables.) This style of coding acts like choosing 2 values and having the event occur between. I would reccomend testing it before you say something like that...
ah I see, okay that is solved then :)

As for the testing, I don't have the clock code from you so I can't realy fully test it. Maybe post that too.

rubyrulez
September 5th, 2005, 03:37 AM
ah I see, okay that is solved then :)

As for the testing, I don't have the clock code from you so I can't realy fully test it. Maybe post that too.

Ah, now the clock code is very extensive, so I will post a general version of it.
The event is a Parallel Process event

<>Wait 1 sec
<>Var Oper: [Seconds] +1
<>Branch if Var: [Seconds] is 60 or more
<>Var Oper: [Minutes] +1
<>Var Oper: [Seconds] Set 0
<>Branch if Var: [Minutes] is 60 or more
<>Var Oper: [Hours] +1
<>Var Oper: [Minutes] Set 0
<>Var Oper: [Seconds] Set 0

The clock I coded also includes Days, Months and Years (30 days per month, though.), and it is also set to change seasons based on the month, but this is the basic version of my clock. BTW, the wait command won't stop the hero from moving, what it does is count off the seconds and add 1 to the Variable seconds. After the Seconds variable hits 60, it resets and 1 is added to the vairable minutes. After that hits 60, it will add 1 to the variable hours and reset both minutes and seconds. If you want to go further, once the hours variable hits 24, reset it and add 1 to the day variable, and so on...

Hope this helps...

ztrex
September 7th, 2005, 10:26 PM
Oh **** i can't understand a word of this...

Cursed
October 4th, 2005, 09:43 PM
I think this is the best tutorial I've read so far.

Shiny_link
November 2nd, 2005, 05:32 AM
All you need are:

One Common Event.
Switch: Day Time
Switch: Night Time

Common Events:

Name: Day Night
Event Start Condition: Parallel Process
Event Commands: (start)

<>Cycle
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>switch:daytime off
<>switch: nigth time on
<>set screen tone: 50,50,50,100
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>wait 60 seconds
<>switch: nigth time off
<>set screen tone: 100,100,100,100


Now you can do what ever you want with it!
O yea this is only for Rpg maker 2003


with this one, when I go into a house or building it will come up with an error message. So whats wrong with it...

PokemonXP
November 4th, 2005, 11:19 AM
I'm a noob and was wondering if all this posting of stuff is for XP or 00? I'm confused unless someone puts what its for. How do you make it, XP, so that the screen will tint at nighttime like in Pokemon GSC?

Cursed
November 4th, 2005, 11:21 PM
Read the thread entirely.

axlefoley
November 19th, 2005, 07:44 PM
Is there a way to get the game to recognise realtime?

MasaXGPMat
November 20th, 2005, 09:53 AM
theres an error with the rmxp day and night system

it says ???? 'Day and Night' ? 584 ??? SyntaxError ?????

how do i fix it

Ati
December 6th, 2005, 02:57 PM
Oh yeah sane prob with me, we might did something wrong...

Blizzy
December 7th, 2005, 03:20 AM
Ah, now the clock code is very extensive, so I will post a general version of it.
The event is a Parallel Process event

<>Wait 1 sec
<>Var Oper: [Seconds] +1
<>Branch if Var: [Seconds] is 60 or more
<>Var Oper: [Minutes] +1
<>Var Oper: [Seconds] Set 0
<>Branch if Var: [Minutes] is 60 or more
<>Var Oper: [Hours] +1
<>Var Oper: [Minutes] Set 0
<>Var Oper: [Seconds] Set 0

The clock I coded also includes Days, Months and Years (30 days per month, though.), and it is also set to change seasons based on the month, but this is the basic version of my clock. BTW, the wait command won't stop the hero from moving, what it does is count off the seconds and add 1 to the Variable seconds. After the Seconds variable hits 60, it resets and 1 is added to the vairable minutes. After that hits 60, it will add 1 to the variable hours and reset both minutes and seconds. If you want to go further, once the hours variable hits 24, reset it and add 1 to the day variable, and so on...

Hope this helps...
this is my clock:

<> Wait 1 sec
<> Var [Seconds] += 1
<> Var [Seconds] % 61
<> Var [Minutes] % 61
<> Branch if Var [Seconds] == 60
<> Var [Minutes] += 1
<> End
<>Branch if Var [Minutes] == 60
<> Var [Hours] += 1
<>End

the % does this effect:
Var [value] % 11
result: 1,2,3,4,5,6,7,8,9,10,1,2,4,5,6,7,8,9,10, etc.