Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # * [ACE] Bugfixes for Selchar's Calendar and Weather System
- #===============================================================================
- # * Made by: Sixth (www.rpgmakervxace.net, www.forums.rpgmakerweb.com)
- # * Version: 1.0
- # * Updated: 11/12/2016
- # * Requires: Selchar's Calendar and Weather System
- #-------------------------------------------------------------------------------
- # * < Change Log >
- #-------------------------------------------------------------------------------
- # * Version 1.0 (11/12/2016)
- # - Initial release.
- #-------------------------------------------------------------------------------
- # * < Description >
- #-------------------------------------------------------------------------------
- # * This script fixes the incorrect time calculation in
- # Selchar's Calendar and Weather script.
- # * Moves the common event calls to the end of the time update method, so you
- # can use accurate time/variable checks in your common events if needed.
- # * Automatically generates the correct "day in year" value for the variable.
- # Doing this manually is a pain if you want to start your game somewhere
- # not at the start of the year.
- # * Adds a new, working script call to jump to a specific time.
- # If the time is already passed on the current day, it jumps to the specified
- # time on the next day.
- # Got an option to skip time based common events and jump straight to the
- # specified time. If you choose to not skip the common events, the time will
- # stop if a common event is triggered somewhere between the time of running
- # the script call and the specified time destination automatically.
- #-------------------------------------------------------------------------------
- # * < Script Calls >
- #-------------------------------------------------------------------------------
- # * To jump to a specific time, use this script call:
- #
- # HM_SEL.jump_to_time(hour,minute,skip_flag)
- #
- # Replace hour with the hour you want to jump to. Values: 0 - 23.
- # Default value: 6.
- #
- # Replace minute with the minute you want to jump to. Values: 0 - 59.
- # Default value: 0.
- #
- # Replace skip_flag with:
- # true = Skips time based common events during this script call.
- # false = Time based common events will break the forced time progression
- # automatically if they trigger.
- # The default value: true.
- #
- # If you omit any of the arguments, their default value will be loaded!
- #
- # Examples:
- #
- # HM_SEL.jump_to_time(18,24,false)
- # Jumps to 18:24. If that time already passed on the current day, skips to
- # the same time on the next day.
- # If there would be a time based common event during this forced time
- # progression, the time will stop the moment it would trigger.
- #
- # HM_SEL.jump_to_time(0,0)
- # Jumps to midnight.
- # Time based common events will be skipped with this script call.
- #
- # NOTE:
- # The script call "next_day" and "next_day(x)" from Selchar's script will
- # NOT work anymore, so don't use that!
- # This one does the same but with more options, and hey, this one works! :P
- #-------------------------------------------------------------------------------
- # * < Installation >
- #-------------------------------------------------------------------------------
- # * Place this scipt right below
- # Selchar's Harvest Moon style Variable Based Calendar and Weather System
- # (wow, what a long name o.o) script but above any addons for it!
- #-------------------------------------------------------------------------------
- # * < Compatibility Info >
- #-------------------------------------------------------------------------------
- # * No known incompatibilities.
- #-------------------------------------------------------------------------------
- # * < Known Issues >
- #-------------------------------------------------------------------------------
- # * No known issues.
- #-------------------------------------------------------------------------------
- # * < Terms of Use >
- #-------------------------------------------------------------------------------
- # * Free to use for whatever purposes you want.
- # * Credit me (Sixth) in your game, pretty please! :P
- # * Posting modified versions of this script is allowed as long as you notice me
- # about it with a link to it!
- #===============================================================================
- $imported = {} if $imported.nil?
- $imported["SixthHMSelFix"] = true
- #===============================================================================
- # Settings:
- #===============================================================================
- module HM_SEL
- #-----------------------------------------------------------------------------
- # Starting Time and Date Settings:
- #-----------------------------------------------------------------------------
- # From now on, you will need to set the starting time and date here.
- # This setting will not be loaded from Selchar's script anymore!
- #
- # Do NOT change the "DAYC" variable setting!
- # That will be automatically calculated for you based on the starting date
- # you set.
- #-----------------------------------------------------------------------------
- def self.init_var
- if $game_variables[DAYA] == 0 # Don't change this line!
- $game_variables[MIN] = 10 # Starting minute
- $game_variables[HOUR] = 18 # Starting hour
- $game_variables[DAYA] = 7 # Weekday: 1 = Monday, ... 7 = Sunday
- $game_variables[DAYB] = 25 # Day of the month
- $game_variables[MONTH] = 4 # Starting month
- $game_variables[YEAR] = 1978 # Starting year
- $game_variables[WEATHA] = 1 # Initial weather. 1: Sun, 2: Rain, 3: Snow
- $game_variables[WEATHB] = 1 # Next day weather.
- $game_variables[DAYC] = get_days_passed # Day of the year - Don't change!
- show_tint # Don't change this line!
- show_weather # Don't change this line!
- end
- end
- #===============================================================================
- # End of settings! O.o
- #===============================================================================
- def self.time_manager
- init_var
- unless time_stop?
- if $sel_time_frame == FRAMES_TIL_UPDATE
- prog_minute
- end
- $sel_time_frame += 1
- end
- end
- def self.prog_minute(skip=false)
- $sel_time_frame = 0
- tint_flag = false
- weather_flag = false
- # Increase time:
- $game_variables[MIN] += $game_variables[MINUTE_CYCLE]
- # End of hour check:
- while $game_variables[MIN] >= 60
- tint_flag = true
- $game_variables[MIN] -= 60
- $game_variables[HOUR] += 1
- # End of day check:
- if $game_variables[HOUR] >= 24
- weather_flag = true
- $game_variables[HOUR] = 0
- $game_variables[DAYA] += 1 # Weekday
- $game_variables[DAYB] += 1 # Day of Month
- $game_variables[DAYC] += 1 # Day of Year
- $game_variables[DAYA] = 1 if $game_variables[DAYA] == 8 # Fix weekday
- # End of month check:
- if $game_variables[DAYB] > DAYS_IN_MONTH[$game_variables[MONTH]]
- $game_variables[DAYB] = 1
- $game_variables[MONTH] += 1
- # End of year check:
- if $game_variables[MONTH] > DAYS_IN_MONTH.size
- $game_variables[MONTH] = 1
- $game_variables[YEAR] += 1
- $game_variables[DAYC] = 1
- end
- end
- end
- end
- # No idea what is this for, but setting festival day, I guess:
- if festivalcheck($game_variables[DAYC])
- $game_variables[FESTIVAL_VAR] = FESTIVALDAYS[$game_variables[DAYC]]
- else
- $game_variables[FESTIVAL_VAR] = 0
- end
- # Tint stuffs:
- show_tint if tint_flag
- # Weather stuffs:
- weather_manager if weather_flag
- # Common event check:
- call_common_event unless skip
- end
- # Automatically calculates the correct day in the year.
- # Setting this up manually can be annoying.
- def self.get_days_passed
- tdays = 0
- DAYS_IN_MONTH.each do |mid,total|
- next unless $game_variables[MONTH] > mid
- tdays += total
- end
- tdays += $game_variables[DAYB]
- return tdays
- end
- def self.call_common_event
- hour = $game_variables[HOUR]
- min = $game_variables[MIN]
- if COMMON_EVENTS[hour] != nil
- if COMMON_EVENTS[hour][0] == min
- $game_temp.reserve_common_event(COMMON_EVENTS[hour][1])
- end
- end
- end
- def self.show_tint(dura = 60)
- hour = $game_variables[HOUR]
- t = TONES[hour] unless no_tone?
- t = TONE_DEFAULT if t.nil?
- $game_map.screen.start_tone_change(t, dura)
- end
- # New script call to jump to a specific time.
- # This one actually works, unlike HM_SEL.next_day, so use this one instead!
- # You can skip time based common events if you want.
- # If you won't skip them, whenever one is triggered, this script call will
- # stop the forced time progression to execute it!
- def self.jump_to_time(thour=6,tmin=0,cmev=true)
- $sel_time_frame = 0
- old_prog_val = $game_variables[MINUTE_CYCLE]
- $game_variables[MINUTE_CYCLE] = 1
- until $game_variables[HOUR] == thour && $game_variables[MIN] == tmin
- prog_minute(cmev) # Forced time progression.
- break if $game_temp.common_event_reserved? # Break if common event!
- end
- $game_variables[MINUTE_CYCLE] = old_prog_val
- end
- end
- #==============================================================================
- # !!END OF SCRIPT - OHH, NOES!!
- #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement