#Autismo Level Time System, Day/Night Cycle script for VX Ace #by Anonymous module DRG #VARIABLES MIN_VAR = 2 #Variable for the minutes HOUR_VAR = 3 #Variable for hours DAY_VAR = 4 #Variable for days MONTH_VAR = 5 #Variable for months YEAR_VAR = 6 #variable for years PROG_VAR = 7 #Variable for progress(How many minutes pass every step) #How many days are in each month. You can change this #Lenghts MINUTES_IN_HOUR = 60 HOURS_IN_DAY = 24 DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] MONTHS_IN_YEAR = 12 #Careful about DAYS_IN_MONTH, you should have as many entries in the array as #you have MONTHS_IN_YEAR #TIME OF DAY TINT TINT_SHIFT_MINUTES = [15, 30, 45] TNV = [-15, -30, -45, -60, -75, -90, -105, -120, -135, -150, -165, -180, -195, -210, -225] TMV = [-255, -210, -195, -180, -165, -150, -135, -120, -105, -90, -75, -60, -45, -30, -15] TINT_DURATION = 120 #TINT_SHIFT_MINUTES refers to at which minutes in an hour #the screen will start tinting for night and morning, I hardcoded #it so only 3 values are accepted in the array #TNV and TMV are the values of the tint at night and morning respectively #just like before, I hardcoded it so you must put these many values #for it to work.. i think at least #TINT_DURATION is how long it takes for the tint to occur #At lines 105 and 135 you can go and change the hours at which #the tinting starts for night and morning respectively #based on the current month(except for the morning one, that's #always the same) end class Game_Player < Game_Character alias drg_time_system_move_straight move_straight def move_straight(d, turn_ok = true) drg_time_system_move_straight(Input.dir4) if @move_succeed $game_variables[DRG::MIN_VAR] += $game_variables[DRG::PROG_VAR] end end end class Game_Interpreter alias time_system_game_interpreter_initialize initialize def initialize time_system_game_interpreter_initialize @days_in_month = 0 @night_start_hours = [] @morning_start_hours = [] end alias time_system_game_interpreter_update update def update time_system_game_interpreter_update() turn_minutes_to_hours() turn_hours_to_days() turn_days_to_months() turn_months_to_years() set_night_start_hours() do_night_transitions() set_morning_start_hours() do_morning_transitions() end def turn_minutes_to_hours if $game_variables[DRG::MIN_VAR] >= DRG::MINUTES_IN_HOUR $game_variables[DRG::HOUR_VAR] += 1 $game_variables[DRG::MIN_VAR] -= DRG::MINUTES_IN_HOUR end end def turn_hours_to_days if $game_variables[DRG::HOUR_VAR] >= DRG::HOURS_IN_DAY $game_variables[DRG::DAY_VAR] += 1 $game_variables[DRG::HOUR_VAR] -= DRG::HOURS_IN_DAY end end def turn_days_to_months if $game_variables[DRG::DAY_VAR] >= DRG::DAYS_IN_MONTH[$game_variables[DRG::MONTH_VAR]-1] $game_variables[DRG::MONTH_VAR] += 1 $game_variables[DRG::DAY_VAR] -= DRG::DAYS_IN_MONTH[$game_variables[DRG::MONTH_VAR]-1] end end def turn_months_to_years if $game_variables[DRG::MONTH_VAR] >= DRG::MONTHS_IN_YEAR $game_variables[DRG::YEAR_VAR] += 1 $game_variables[DRG::MONTH_VAR] = 1 end end def set_night_start_hours case $game_variables[DRG::MONTH_VAR] when 1 @night_start_hours = [17, 18, 19, 20] when 2 @night_start_hours = [18, 19, 20, 21] when 3 @night_start_hours = [19, 20, 21, 22] when 4 @night_start_hours = [20, 21, 22, 23] when 5 @night_start_hours = [21, 22, 23, 0] when 6 @night_start_hours = [22, 23, 0, 1] when 7 @night_start_hours = [21, 22, 23, 0] when 8 @night_start_hours = [20, 21, 22, 23] when 9 @night_start_hours = [19, 20, 21, 22] when 10 @night_start_hours = [18, 19, 20, 21] when 11 @night_start_hours = [17, 18, 19, 20] when 12 @night_start_hours = [16, 17, 18, 19] end end def set_morning_start_hours @morning_start_hours = [3, 4, 5, 6] end def do_night_transitions if $game_variables[DRG::HOUR_VAR] == @night_start_hours[0] if $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[0] tone = Tone.new(DRG::TNV[0], DRG::TNV[0], 0, DRG::TNV[0]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[1] tone = Tone.new(DRG::TNV[1], DRG::TNV[1], 0, DRG::TNV[1]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[2] tone = Tone.new(DRG::TNV[2], DRG::TNV[2], 0, DRG::TNV[2]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) end elsif $game_variables[DRG::HOUR_VAR] == @night_start_hours[1] if $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[0] tone = Tone.new(DRG::TNV[3], DRG::TNV[3], 0, DRG::TNV[3]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[1] tone = Tone.new(DRG::TNV[4], DRG::TNV[4], 0, DRG::TNV[4]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[2] tone = Tone.new(DRG::TNV[5], DRG::TNV[5], 0, DRG::TNV[5]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) end elsif $game_variables[DRG::HOUR_VAR] == @night_start_hours[2] if $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[0] tone = Tone.new(DRG::TNV[6], DRG::TNV[6], 0, DRG::TNV[6]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[1] tone = Tone.new(DRG::TNV[7], DRG::TNV[7], 0, DRG::TNV[7]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[2] tone = Tone.new(DRG::TNV[8], DRG::TNV[8], 0, DRG::TNV[8]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) end elsif $game_variables[DRG::HOUR_VAR] == @night_start_hours[3] if $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[0] tone = Tone.new(DRG::TNV[9], DRG::TNV[9], 0, DRG::TNV[9]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[1] tone = Tone.new(DRG::TNV[10], DRG::TNV[10], 0, DRG::TNV[10]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[2] tone = Tone.new(DRG::TNV[11], DRG::TNV[11], 0, DRG::TNV[11]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) end end end def do_morning_transitions if $game_variables[DRG::HOUR_VAR] == @morning_start_hours[0] if $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[0] tone = Tone.new(DRG::TMV[0], DRG::TMV[0], 0, DRG::TMV[0]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[1] tone = Tone.new(DRG::TMV[1], DRG::TMV[1], 0, DRG::TMV[1]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[2] tone = Tone.new(DRG::TMV[2], DRG::TMV[2], 0, DRG::TMV[2]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) end elsif $game_variables[DRG::HOUR_VAR] == @morning_start_hours[1] if $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[0] tone = Tone.new(DRG::TMV[3], DRG::TMV[3], 0, DRG::TMV[3]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[1] tone = Tone.new(DRG::TMV[4], DRG::TMV[4], 0, DRG::TMV[4]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[2] tone = Tone.new(DRG::TMV[5], DRG::TMV[5], 0, DRG::TMV[5]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) end elsif $game_variables[DRG::HOUR_VAR] == @morning_start_hours[2] if $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[0] tone = Tone.new(DRG::TMV[6], DRG::TMV[6], 0, DRG::TMV[6]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[1] tone = Tone.new(DRG::TMV[7], DRG::TMV[7], 0, DRG::TMV[7]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[2] tone = Tone.new(DRG::TMV[8], DRG::TMV[8], 0, DRG::TMV[8]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) end elsif $game_variables[DRG::HOUR_VAR] == @morning_start_hours[3] if $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[0] tone = Tone.new(DRG::TMV[9], DRG::TNV[9], 0, DRG::TMV[9]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[1] tone = Tone.new(DRG::TMV[10], DRG::TMV[10], 0, DRG::TMV[10]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) elsif $game_variables[DRG::MIN_VAR] <= DRG::TINT_SHIFT_MINUTES[2] tone = Tone.new(DRG::TMV[11], DRG::TMV[11], 0, DRG::TMV[11]) $game_map.screen.start_tone_change(tone, DRG::TINT_DURATION) end end end end