[RGSS3] Day and Night system help.

● ARCHIVED · READ-ONLY
Started by Animez3 1 posts View original ↗
  1. I'm trying to make a day & night script but it isn't working the way I want it to. here's the code: 

    class Scene_Map < Scene_Basealias time_cycle_start startdef startsuperSceneManager.clear$game_player.straighten$game_map.refresh$game_message.visible = falsecreate_spritesetcreate_all_windows@menu_calling = falsedn_sys_refenddef updatesuper$game_map.update(true)$game_player.update$game_timer.update@spriteset.updateupdate_scene if scene_change_ok?puts Time_Cycle::CD_Clock.update_time_cycleenddef dn_sys_ref@time_cycle=Time_Cycle::DN_System.newendend# The time cycle namespace groups up all classes relating to the games time system.module Time_Cycle class CD_Clock# A clock system. This thing def self.update_time_cyclereturn Time.now.hourendend# This is day and night system. It handles the cycle of time pertaining to the change# in accoustics in occurdance to the particular point in the day.class DN_System<CD_Clock #$internal_clock=Time.now#Afternoon=Tone.new.set(34,-34,-68,0)#Night=Tone.new.set(-68,-68,0,68)def initializetime_cycleenddef time_cyclecase Time_Cycle::CD_Clock.update_time_cyclewhen 01...07@night_tone = Viewport.new@night_tone.tone.set(-68,-68,0,68)when 07...12# Default screen tint.when 12...20@afternoon_tone = Viewport.new@afternoon_tone.tone.set(34,-34,-68,0)when 20...24@night_tone = Viewport.new@night_tone.tone.set(-68,-68,0,68)endendendendIt's suppose to automatically change the tint at a certain time. Like at 8:00 PM it is suppose to automatically change from the afternoon tint to the night time tint. But as of now the tint only changes at 8:00 PM if I change the scene for some reason like if I open then close the menu. So I figured the way I could solve this is if I create a reference to a specific Time object that "updates" every frame in the map scene(I don't know much about the use of the update method but it seems to be a loop)  so I did this : 

    # There is more I want to do with this class in this namespace later but for now testing # this one method.class CD_Clock# A clock system. This thing def self.update_time_cyclereturn Time.now.hourendendI figured the return would return the hour from the Time object in this update method here: 

    class Scene_Map < Scene_Basedef updatesuper$game_map.update(true)$game_player.update$game_timer.update@spriteset.updateupdate_scene if scene_change_ok?puts Time_Cycle::CD_Clock.update_time_cycleendand it seems to do this because it constantly print the hour from that Time object. So now that the time is being updated every frame I felt the last thing that needed to be done was to use that Time object in the case statement below: 

    module Time_Cycle class CD_Clock# A clock system. This thing def self.update_time_cyclereturn Time.now.hourendend# This is day and night system. It handles the cycle of time pertaining to the change# in accoustics in occurdance to the particular point in the day.class DN_System<CD_Clock #$internal_clock=Time.now#Afternoon=Tone.new.set(34,-34,-68,0)#Night=Tone.new.set(-68,-68,0,68)def initializetime_cycleenddef time_cyclecase Time_Cycle::CD_Clock.update_time_cyclewhen 01...07@night_tone = Viewport.new@night_tone.tone.set(-68,-68,0,68)when 07...12# Default screen tint.when 12...20@afternoon_tone = Viewport.new@afternoon_tone.tone.set(34,-34,-68,0)when 20...24@night_tone = Viewport.new@night_tone.tone.set(-68,-68,0,68)endendendendbut it didn't work. Now I don't know what to do. Can anyone help me please? 

    P.S. I don't want anyone else's day and night script I worked really hard to make this one all I want on this is help please and thank you.