Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # ***TPS-Addon: Phases and Weather***
- #
- # Author: eugene222 (Evgenij)
- # Version: 1.0
- # Date: 21.05.2014
- # Requires: Time and Period System V. 1.2 by eugene222
- #===============================================================================
- # Changelog:
- #
- # 21.05.2014 - V. 1.0 - created
- #
- #===============================================================================
- # Terms of Use:
- # You can use this script for free and commercial projects as long as you give
- # credits.
- #===============================================================================
- # Description:
- # With this script you can create custom weathers and phases
- # You can assign your custom weathers to your phases.
- #
- # THIS SCRIPT IS A LITTLE BIT COMPLEX.
- #
- # Scriptcalls:
- # $game_time.phase_active?(name) # Checks if the phase "name" is active
- # Example:
- # $game_time.phase_active?(:winter) - returns true if the :winter phase is
- # active
- #
- #===============================================================================
- module TPS_PHASES
- #-----------------------------------------------------------------------------
- # Show Weather Effects in Battle?
- #-----------------------------------------------------------------------------
- USE_WEATHER_IN_BATTLE = true
- #-----------------------------------------------------------------------------
- # How much should the maximum for weather change per day be?
- # - false if no maximum
- #-----------------------------------------------------------------------------
- MAXIMUM_WEATHER_PER_DAY = false
- #-----------------------------------------------------------------------------
- WEATHERS = { # Diese Zeile nicht verändern
- #-----------------------------------------------------------------------------
- # :weather_name =>[:type, power, min-time, max-time, sound, indoor-sound]
- #
- # - type: :none, :snow, :rain or :storm
- # - power: 1-9
- # - min-dauer: min time in ingame minutes
- # - max-dauer: max time in ingame minutes
- # - sound: sound for outdoor maps
- # - indoor-sound: sound for indoor maps
- #
- # This is how your sound config should look like:
- #
- # ["filename", volume, pitch] or nil wenn no sound
- #
- #
- #-----------------------------------------------------------------------------
- :no_weather => [:none, 0 , 120, 180, nil, nil],
- :weak_rain => [:rain, 3, 80, 140, ["Rain", 100, 100], ["Rain", 70, 100]],
- :normal_rain => [:rain, 6, 80, 160, ["Rain", 100, 100], ["Rain", 70, 100]],
- :strong_rain => [:rain, 9, 100, 160, ["Rain", 100, 100], ["Rain", 70, 100]],
- :long_rain => [:rain, 6, 160, 280 ,["Rain", 100, 100], ["Rain", 70, 100]],
- :weak_storm => [:storm, 3, 80, 140, ["Storm", 100, 100], ["Storm", 70, 100]],
- :normal_storm => [:storm, 6, 80, 160, ["Storm", 100, 100], ["Storm", 70, 100]],
- :strong_storm => [:storm, 9,100, 160, ["Storm", 100, 100], ["Storm", 70, 100]],
- :long_storm => [:storm, 6, 160, 280, ["Storm", 100, 100], ["Storm", 70, 100]],
- :weak_snow => [:snow, 3, 80, 140, ["Wind", 20, 100], nil],
- :normal_snow => [:snow, 6, 80, 160, ["Wind", 30, 100], nil],
- :strong_snow => [:snow, 9, 100, 160, ["Wind", 50, 100], nil],
- :long_snow => [:snow, 6, 160, 280, ["Wind", 30, 100], nil],
- #-----------------------------------------------------------------------------
- } # Diese Zeile nicht verändern
- #-----------------------------------------------------------------------------
- CONDITIONS = { # Diese Zeile unverändert lassen
- #-----------------------------------------------------------------------------
- # If you dont understand something below, ask me in the forum, I try to explain
- # or help at best.
- #
- # Priority for weather and other things that will come
- # priorty: zahl
- #
- # Time when the phase is active:
- # time: :all oder
- # time: [starttime..endtime, :periode, etc..]
- #
- # Weekdays:
- # days: :all or
- # days: ["Monday", "Thursday", "Friday"]
- #
- # Months:
- # months: :all or
- # months: {"January" => [0..10, 12..31, etc..], etc..} or
- # months: {"January" => :all, "March" => [0..15, etc..], etc.. }
- #
- # Years:
- # years: :all or
- # years: [2004, 2005, 2006, etc..]
- #
- # Switch when is on when the phase is active:
- # switch: id
- #
- # Common Event which starts when the phase is active(Optional):
- # common_event: id
- #
- # Weathers for the phase (Optional):
- #
- # weathers: {
- #
- # :wetter => wahrscheinlichkeit,
- # }
- #
- # Deactivate this phase when other phases are active
- # exclude: [phase_name, phase_name, phase_name, usw..]
- #
- #
- # LOOK AT THE EXAMPLES BELOW AND HOPEFULLY YOU WILL UNDERSTAND BETTER
- #
- #-----------------------------------------------------------------------------
- #-----------------------------------------------------------------------------
- # PREDEFINED PHASES:
- #-----------------------------------------------------------------------------
- #---------------------------------------------------------------------------
- # Spring:
- #---------------------------------------------------------------------------
- :spring => {
- priority: 1,
- time: :all,
- days: :all,
- months: {"Março" => :all, "Abril" => :all, "Maio" => :all},
- years: :all,
- switch: 10,
- weathers: { :no_weather => 80,
- :weak_rain => 10,
- :normal_rain => 10,
- :strong_rain => 5,
- :weak_storm => 5,
- :normal_storm => 5,
- },
- },
- #---------------------------------------------------------------------------
- # Summer:
- #---------------------------------------------------------------------------
- :summer => {
- priority: 1,
- time: :all,
- days: :all,
- months: {"Junho" => :all, "Julho" => :all, "Agosto" => :all},
- years: :all,
- switch: 11,
- weathers: { :no_weather => 100,
- :weak_rain => 10,
- :normal_rain => 5,
- },
- },
- #---------------------------------------------------------------------------
- # Autumn:
- #---------------------------------------------------------------------------
- :autumn => {
- priority: 1,
- time: :all,
- days: :all,
- months: {"Setembro" => :all, "Outubro" => :all, "Novembro" => :all},
- years: :all,
- switch: 12,
- weathers: { :no_weather => 35,
- :weak_rain => 15,
- :normal_rain => 10,
- :strong_rain => 10,
- :long_rain => 10,
- :weak_storm => 10,
- :normal_storm => 5,
- :strong_storm => 5,
- },
- },
- #---------------------------------------------------------------------------
- # Winter:
- #---------------------------------------------------------------------------
- :winter => {
- priority: 1,
- time: :all,
- days: :all,
- months: {"Dezembro" => :all, "Janeiro" => :all, "Fevereiro" => :all},
- years: :all,
- switch: 13,
- weathers: { :no_weather => 40,
- :weak_snow => 20,
- :normal_snow => 15,
- :strong_snow => 10,
- :long_snow => 5,
- :weak_rain => 5,
- :normal_rain => 5,
- :strong_rain => 5,
- :weak_storm => 5,
- },
- },
- #---------------------------------------------------------------------------
- # Holiday 1:
- # - Active at 1st January.
- #---------------------------------------------------------------------------
- :holiday1 => {
- priority: 0,
- time: :all,
- days: :all,
- months: {"Janeiro" => [1]},
- years: :all,
- switch: 15,
- },
- #---------------------------------------------------------------------------
- # Holiday 2:
- # - Active at 6st January.
- #---------------------------------------------------------------------------
- :holiday2 => {
- priority: 0,
- time: :all,
- days: :all,
- months: {"Janeiro" => [6]},
- years: :all,
- switch: 16,
- },
- #---------------------------------------------------------------------------
- # Pup Opening Time:
- # - Every day at evening and night active, deactive at :holiday1
- #---------------------------------------------------------------------------
- :pub_opening_time => {
- priority: 0,
- exclude: [:holiday1],
- time: [:evening, :night],
- days: :all,
- months: :all,
- years: :all,
- switch: 17,
- },
- #---------------------------------------------------------------------------
- # Itemshop Opening Phase:
- # - Every day except weekend from 8:00 AM till 8:00 PM active,
- # inactive when :holiday1 or :holiday2 is active.
- #---------------------------------------------------------------------------
- :item_shop_opening_time => {
- priority: 0,
- exclude: [:holiday1, :holiday2],
- time: [480..1200],
- days: ["Segunda", "Terça", "Quarta", "Quinta", "Sexta"],
- months: :all,
- years: :all,
- switch: 18,
- },
- #-----------------------------------------------------------------------------
- } # Diese Zeile nicht verändern
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- # END OF CONFIG
- #===============================================================================
- $imported ||= {}
- $imported[:e222_tps_phases] = 1.0
- unless $imported[:e222_tps_core]
- msgbox("\"TBS-Addon: Phases and Weather\" requires the \"TBS-Core\" script.\n"+
- "The \"TBS-Core\" script must be placed above the addon script.")
- exit
- end
- class Game_Time
- #-----------------------------------------------------------------------------
- attr_reader :active_phases
- #-----------------------------------------------------------------------------
- alias :tps_phases_reinitialize :reinitialize
- #-----------------------------------------------------------------------------
- # Reinitialize
- #-----------------------------------------------------------------------------
- def reinitialize
- tps_phases_reinitialize
- return unless TPS_PHASES::CONDITIONS
- @all_phases ||= {}
- @active_phases ||= {}
- make_all_condition_variables
- make_time_condition_cache
- refresh_conditions
- end
- #-----------------------------------------------------------------------------
- # Sort Active Phases
- #-----------------------------------------------------------------------------
- def sort_active_phases
- @active_phases = @all_phases.select {|name, status| status == true}.keys
- @active_phases.sort_by! {|name| TPS_PHASES::CONDITIONS[name][:priority]}
- end
- #-----------------------------------------------------------------------------
- # Make All Condition Variables
- #-----------------------------------------------------------------------------
- def make_all_condition_variables
- cond = TPS_PHASES::CONDITIONS.clone
- @condition_effects = cond.select {|k, v| v[:effects]}.keys
- @time_conditions = select_and_remove(cond) {|k, v| v[:time] != :all}.keys
- @day_conditions = select_and_remove(cond) {|k, v| v[:days] != :all}.keys
- @day_conditions += select_and_remove(cond) do |k, v|
- v[:months].values.any? {|value| value != :all}
- end.keys
- @month_conditions = select_and_remove(cond) {|k, v| v[:months] != :all}.keys
- @year_conditions = select_and_remove(cond) {|k, v| v[:years] != :all}.keys
- end
- #-----------------------------------------------------------------------------
- # Select and Remove From Hash
- #-----------------------------------------------------------------------------
- def select_and_remove(hash)
- tmp_hash = hash.select {|k, v| yield(k, v)}
- hash = hash.delete_if {|k, v| yield(k, v)}
- return tmp_hash
- end
- #-----------------------------------------------------------------------------
- # Make Time Conditions Cache
- #-----------------------------------------------------------------------------
- def make_time_condition_cache
- @time_conditions = Hash[ @time_conditions.map { |name|
- [name, return_time_hash(TPS_PHASES::CONDITIONS[name][:time])]
- }]
- end
- #-----------------------------------------------------------------------------
- # Make Day Conditions Cache
- #-----------------------------------------------------------------------------
- def make_day_condition_cache
- @day_conditions = {}
- TPS_PHASES::CONDITIONS.each do |key, value|
- @time_conditions[key] = return_time_hash(value[:time])
- end
- end
- #-----------------------------------------------------------------------------
- # Return Time Hash
- #-----------------------------------------------------------------------------
- def return_time_hash(times)
- hash = Hash.new(false)
- times.each do |time_or_period|
- if time_or_period.is_a?(Symbol)
- @period_hash.reject {|k, v| v != time_or_period}.keys.each do |time|
- hash[time] = true
- end
- elsif time_or_period.is_a?(Range)
- time_or_period.each { |time| hash[time] = true }
- else
- hash[time_or_period] = true
- end
- end
- return hash
- end
- #-----------------------------------------------------------------------------
- # Refresh Condition Switches
- #-----------------------------------------------------------------------------
- def refresh_conditions
- refresh_time_conditions
- refresh_day_conditions
- refresh_month_conditions
- refresh_year_conditions
- end
- #-----------------------------------------------------------------------------
- # Next Minute
- #-----------------------------------------------------------------------------
- alias :tps_phases_next_minute :next_minute
- def next_minute
- tps_phases_next_minute
- refresh_time_conditions
- end
- #-----------------------------------------------------------------------------
- # Next Day
- #-----------------------------------------------------------------------------
- alias :tps_phases_next_day :next_day
- def next_day
- tps_phases_next_day
- refresh_day_conditions
- end
- #-----------------------------------------------------------------------------
- # Next Month
- #-----------------------------------------------------------------------------
- alias :tps_phases_next_month :next_month
- def next_month
- tps_phases_next_month
- refresh_month_conditions
- end
- #-----------------------------------------------------------------------------
- # Next Year
- #-----------------------------------------------------------------------------
- alias :tps_phases_next_year :next_year
- def next_year
- tps_phases_next_year
- refresh_year_conditions
- end
- #-----------------------------------------------------------------------------
- # Refresh Time Conditions
- #-----------------------------------------------------------------------------
- def refresh_time_conditions
- return if @time_conditions.empty?
- @time_conditions.each do |name, value|
- update_condition(name)
- end
- end
- #-----------------------------------------------------------------------------
- # Refresh Day Conditions
- #-----------------------------------------------------------------------------
- def refresh_day_conditions
- return if @day_conditions.empty?
- @day_conditions.each do |name|
- update_condition(name)
- end
- end
- #-----------------------------------------------------------------------------
- # Refresh Month Conditions
- #-----------------------------------------------------------------------------
- def refresh_month_conditions
- return if @month_conditions.empty?
- @month_conditions.each do |name|
- update_condition(name)
- end
- end
- #-----------------------------------------------------------------------------
- # Refresh Year Conditions
- #-----------------------------------------------------------------------------
- def refresh_year_conditions
- return if @year_conditions.empty?
- @year_conditions.each do |name|
- update_condition(name)
- end
- end
- #-----------------------------------------------------------------------------
- # Update Condition
- #-----------------------------------------------------------------------------
- def update_condition(name)
- status = check_condition(name)
- return if @all_phases[name] == status
- $game_switches[TPS_PHASES::CONDITIONS[name][:switch]] = status
- status ? add_phase(name) : remove_phase(name)
- start_common_event(name) if status
- end
- #-----------------------------------------------------------------------------
- # Start Common Event
- #-----------------------------------------------------------------------------
- def start_common_event(phase)
- return unless TPS_PHASES::CONDITIONS[phase][:common_event]
- $game_temp.reserve_common_event(TPS_PHASES::CONDITIONS[phase][:common_event])
- end
- #-----------------------------------------------------------------------------
- # Add Phase
- #-----------------------------------------------------------------------------
- def add_phase(name)
- return if @all_phases[name]
- puts "[TPS: Phases and Weather] Phase added: #{name}"
- @all_phases[name] = true
- sort_active_phases
- end
- #-----------------------------------------------------------------------------
- # Remove Phase
- #-----------------------------------------------------------------------------
- def remove_phase(name)
- return unless @all_phases[name]
- puts "[TPS: Phases and Weather] Phase removed: #{name}"
- @all_phases[name] = false
- sort_active_phases
- end
- #-----------------------------------------------------------------------------
- # Check Condition
- #-----------------------------------------------------------------------------
- def check_condition(name)
- return false unless TPS_PHASES::CONDITIONS[name]
- return false unless check_exclude_condition(name)
- return false unless check_year_condition(name)
- return false unless check_month_condition(name)
- return false unless check_day_condition(name)
- return false unless check_time_condition(name)
- return true
- end
- #-----------------------------------------------------------------------------
- # Check Exclude Condition
- #-----------------------------------------------------------------------------
- def check_exclude_condition(name)
- return true unless TPS_PHASES::CONDITIONS[name][:exclude]
- TPS_PHASES::CONDITIONS[name][:exclude].each do |phase|
- return false if phase_active?(phase)
- end
- return true
- end
- #-----------------------------------------------------------------------------
- # Check Year Condition
- #-----------------------------------------------------------------------------
- def check_year_condition(name)
- return true unless TPS_PHASES::CONDITIONS[name][:years]
- return true if TPS_PHASES::CONDITIONS[name][:years] == :all
- return true if TPS_PHASES::CONDITIONS[name][:years].include?(@current_year)
- return false
- end
- #-----------------------------------------------------------------------------
- # Check Month Condition
- #-----------------------------------------------------------------------------
- def check_month_condition(name)
- month_conditions = TPS_PHASES::CONDITIONS[name][:months]
- return true if month_conditions == :all
- if month_conditions[:all]
- return true if check_month_days(month_conditions[:all])
- end
- if month_conditions[current_month_vocab]
- return true if month_conditions[current_month_vocab] == :all
- return true if check_month_days(month_conditions[current_month_vocab])
- end
- return false
- end
- #-----------------------------------------------------------------------------
- # Check Month Days
- #-----------------------------------------------------------------------------
- def check_month_days(day_ranges)
- return true if day_ranges.any? { |days|
- (days.is_a?(Range) && days.include?(current_day) || days == current_day)
- }
- return false
- end
- #-----------------------------------------------------------------------------
- # Check Day Condition
- #-----------------------------------------------------------------------------
- def check_day_condition(name)
- return true if TPS_PHASES::CONDITIONS[name][:days] == :all
- return true if TPS_PHASES::CONDITIONS[name][:days].include?(current_day_vocab)
- return false
- end
- #-----------------------------------------------------------------------------
- # Check Time Condition
- #-----------------------------------------------------------------------------
- def check_time_condition(name)
- return true if TPS_PHASES::CONDITIONS[name][:time] == :all
- return @time_conditions[name][@current_time]
- end
- #-----------------------------------------------------------------------------
- # Phase Active ?
- #-----------------------------------------------------------------------------
- def phase_active?(name)
- return @active_phases.include?(name)
- end
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- # Weather:
- #===============================================================================
- class Game_Time
- #-----------------------------------------------------------------------------
- # Reinitialize
- #-----------------------------------------------------------------------------
- alias :tps_weather_reinitialize :reinitialize
- #-----------------------------------------------------------------------------
- def reinitialize
- return unless TPS_PHASES::CONDITIONS
- @current_weather ||= :none
- @current_abs_weather ||= nil
- @weather_duration ||= 0
- @weather_strength ||= nil
- @current_rolls ||= 0
- tps_weather_reinitialize
- make_weather_conditions
- end
- #-----------------------------------------------------------------------------
- # Sort Active Phases
- #-----------------------------------------------------------------------------
- alias :tps_weather_sap_e222 :sort_active_phases
- #-----------------------------------------------------------------------------
- def sort_active_phases
- tps_weather_sap_e222
- make_weather_conditions
- end
- #-----------------------------------------------------------------------------
- # Make Weather Conditions
- #-----------------------------------------------------------------------------
- def make_weather_conditions
- cond = TPS_PHASES::CONDITIONS
- @weather_conditions = cond.select {|k, v| weather_condition?(k, v)}.keys
- @weather_conditions.sort_by! {|k| cond[k][:priority]}
- end
- #-----------------------------------------------------------------------------
- # Next Minute
- #-----------------------------------------------------------------------------
- alias :tps_weather_next_minute :next_minute
- #-----------------------------------------------------------------------------
- def next_minute
- tps_weather_next_minute
- update_weather
- end
- #-----------------------------------------------------------------------------
- # Next Day
- #-----------------------------------------------------------------------------
- alias :tps_weather_next_day :next_day
- #-----------------------------------------------------------------------------
- def next_day
- tps_weather_next_day
- @current_rolls = 0 if max_rolls
- end
- #-----------------------------------------------------------------------------
- # Update Weather
- #-----------------------------------------------------------------------------
- def update_weather
- return unless can_roll?
- @weather_duration > 0 ? @weather_duration -= 1 : roll_weather
- end
- #-----------------------------------------------------------------------------
- # Roll Weather
- #-----------------------------------------------------------------------------
- def roll_weather
- weathers = []
- TPS_PHASES::CONDITIONS[weather_phase][:weathers].each do |weather, chance|
- chance.times { weathers.push(weather) }
- end
- @current_abs_weather = weathers.shuffle.last
- @current_weather = TPS_PHASES::WEATHERS[@current_abs_weather].first
- @weather_duration = weather_duration
- @weather_strength = weather_strength
- @current_rolls += 1
- set_weather
- end
- #-----------------------------------------------------------------------------
- # Set Weather
- #-----------------------------------------------------------------------------
- def set_weather(dur = 60)
- if $game_map.indoor?
- clear_weather
- else
- change_weather(dur)
- end
- start_bgs
- end
- #-----------------------------------------------------------------------------
- # Change Weather
- #-----------------------------------------------------------------------------
- def change_weather(dur)
- $game_map.screen.change_weather(@current_weather, @weather_strength, dur)
- end
- #-----------------------------------------------------------------------------
- # Clear Weather
- #-----------------------------------------------------------------------------
- def clear_weather
- $game_map.screen.change_weather(:none, 0, 0)
- end
- #-----------------------------------------------------------------------------
- # Start BGS
- #-----------------------------------------------------------------------------
- def start_bgs
- audio = if !$game_map.indoor?
- TPS_PHASES::WEATHERS[@current_abs_weather][4]
- else
- TPS_PHASES::WEATHERS[@current_abs_weather][5]
- end
- return Audio.bgs_stop unless audio
- Audio.bgs_play('Audio/BGS/' + audio[0], audio[1], audio[2])
- end
- #-----------------------------------------------------------------------------
- # Maximum Rolls
- #-----------------------------------------------------------------------------
- def max_rolls
- return TPS_PHASES::MAXIMUM_WEATHER_PER_DAY
- end
- #-----------------------------------------------------------------------------
- # Can Roll ?
- #-----------------------------------------------------------------------------
- def can_roll?
- return true unless max_rolls
- return @current_rolls < max_rolls
- end
- #-----------------------------------------------------------------------------
- # Weather Phase
- #-----------------------------------------------------------------------------
- def weather_phase
- @weather_conditions.last
- end
- #-----------------------------------------------------------------------------
- # Current Weather
- #-----------------------------------------------------------------------------
- def current_weather
- return @current_weather
- end
- #-----------------------------------------------------------------------------
- # Current Abstract Weather
- #-----------------------------------------------------------------------------
- def current_abs_weather
- return @current_abs_weather
- end
- #-----------------------------------------------------------------------------
- # Weather Duration
- #-----------------------------------------------------------------------------
- def weather_duration
- min = TPS_PHASES::WEATHERS[@current_abs_weather][2]
- max = TPS_PHASES::WEATHERS[@current_abs_weather][3]
- return (rand(max-min) + min)
- end
- #-----------------------------------------------------------------------------
- # Weather Strength
- #-----------------------------------------------------------------------------
- def weather_strength
- return TPS_PHASES::WEATHERS[@current_abs_weather][1]
- end
- #-----------------------------------------------------------------------------
- # Weather Condition?
- #-----------------------------------------------------------------------------
- def weather_condition?(key, value)
- value[:weathers] && phase_active?(key)
- end
- #-----------------------------------------------------------------------------
- # Set Time
- #-----------------------------------------------------------------------------
- alias :tps_weather_set_time :set_time
- #-----------------------------------------------------------------------------
- def set_time(time)
- tps_weather_set_time(time)
- refresh_conditions
- roll_weather
- initialize_period if $imported[:e222_tps_tints]
- end
- #-----------------------------------------------------------------------------
- # Change Time
- #-----------------------------------------------------------------------------
- alias :tps_weather_change_time :change_time
- #-----------------------------------------------------------------------------
- def change_time(amount)
- tps_weather_change_time(amount)
- refresh_conditions
- roll_weather
- initialize_period if $imported[:e222_tps_tints]
- end
- #-----------------------------------------------------------------------------
- # Change Time
- #-----------------------------------------------------------------------------
- alias :tps_weather_change_day :change_day
- #-----------------------------------------------------------------------------
- def change_day(amount)
- tps_weather_change_day(amount)
- refresh_conditions
- roll_weather
- initialize_period if $imported[:e222_tps_tints]
- end
- #-----------------------------------------------------------------------------
- # Change Time
- #-----------------------------------------------------------------------------
- alias :tps_weather_change_month :change_month
- #-----------------------------------------------------------------------------
- def change_month(amount)
- tps_weather_change_month(amount)
- refresh_conditions
- roll_weather
- initialize_period if $imported[:e222_tps_tints]
- end
- #-----------------------------------------------------------------------------
- # Change Year
- #-----------------------------------------------------------------------------
- alias :tps_weather_change_year :change_year
- #-----------------------------------------------------------------------------
- def change_year(amount)
- tps_weather_change_year(amount)
- refresh_conditions
- roll_weather
- initialize_period if $imported[:e222_tps_tints]
- end
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- # Spriteset Battle:
- #===============================================================================
- class Spriteset_Battle
- #-----------------------------------------------------------------------------
- # In create_timer gepackt, da es die letzte methode vor dem Update ist
- #-----------------------------------------------------------------------------
- alias :tps_weather_create_timer_e222 :create_timer
- #-----------------------------------------------------------------------------
- def create_timer
- tps_weather_create_timer_e222
- return unless TPS_PHASES::USE_WEATHER_IN_BATTLE
- create_weather
- end
- #-----------------------------------------------------------------------------
- # Create Weather
- #-----------------------------------------------------------------------------
- def create_weather
- @weather = Spriteset_Weather.new(@viewport3)
- end
- #-----------------------------------------------------------------------------
- # Update
- #-----------------------------------------------------------------------------
- alias :tps_weather_update_e222 :update
- #-----------------------------------------------------------------------------
- def update
- tps_weather_update_e222
- update_weather if @weather
- end
- #-----------------------------------------------------------------------------
- # Update Weather
- #-----------------------------------------------------------------------------
- def update_weather
- @weather.type = $game_map.screen.weather_type
- @weather.power = $game_map.screen.weather_power
- @weather.ox = $game_map.display_x * 32
- @weather.oy = $game_map.display_y * 32
- @weather.update
- end
- #-----------------------------------------------------------------------------
- # Dispose
- #-----------------------------------------------------------------------------
- alias :tps_weather_dispose_e222 :dispose
- def dispose
- @weather.dispose if @weather
- tps_weather_dispose_e222
- end
- end
- #===============================================================================
- # Scene Map:
- #===============================================================================
- class Scene_Map
- #-----------------------------------------------------------------------------
- # Post Transfer
- #-----------------------------------------------------------------------------
- alias :tps_weather_post_transfer_e222 :post_transfer
- #-----------------------------------------------------------------------------
- def post_transfer
- $game_time.set_weather(0)
- tps_weather_post_transfer_e222
- end
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- # SCRIPT END
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement