Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Kendorei's Environmental Weather System, The KEWS version 1.2 - Independance!
Kendorei
post Apr 29 2010, 01:31 PM
Post #1


Level 2
Group Icon

Group: Member
Posts: 25
Type: Event Designer
RM Skill: Intermediate




KEWS

Version 1.2
Author Kendorei
Release Date
v1.0 - 04.29.2010
v1.1 - 05.07.2010
v1.2 - 06.05.2010 <- Independancy of script!


Exclusive Script at RPG RPG Revolution


Introduction
This script WAS meant to be used in conjunction with Blizzard's ATES. It is now independant of the ATES. It allows you to define environments through use of terrain tags and decide what weather each environment should have. I'll leave version 1.1 up for those that want it as well.

Features
- Automatically controls weather and related processes without need of specific events
- Allows full control of the KEWS
- Easy to set up and control
- Now fully independant of Blizzard's ATES
- Version 1.2 has even shorter script now.

Script
[Show/Hide] Script: KEWSv1.1
CODE
#=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#Kendorei's Environmental Weather System  (KEWS)
#Version: 1.1
#Created: v1.0 - 04.29.2010
#         v1.1 - 05.07.2010
#Type:  Autonomous Weather System
#=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#Compatability:
#
#  Unknown compatability with the SDK. (Likely as compatable as the ATES)
#  May cause problems with other Weather Systems.
#
#Features:
#
# - Controls weather and related processes without need of specific events
#   automatically.
# - Allows full control of the KEWS.
# - Easy to set up and control.
# - Made to complement Blizzard's ATES.
#
#Instructions:
#
# - Explaination:
#
#   This is a Weather System designed to take care of general weather
#   effects in game. You can set up several config settings later
#   defined in the appropriate section. The system makes use of terrain
#   tags to determine what effects would be appropriate. This system also
#   uses in-game switches to allow for special effects with other events.
#
# - Manipulation:
#
#   The KEWS can be fully controled through "Call Script" events. Just use
#   the following commands:
#
#   KEWS.on
#     Turns the KEWS on.
#
#   KEWS.off
#     Turns the KEWS off.
#
#   KEWS.active?
#     Returns true if the KEWS is running.
#
#   KEWS.sunny?
#     Returns true if no weather effects are running. Also, you could check
#     the switch.
#
#   KEWS.raining?
#     Returns true if rain effects are running. Also, you could check the
#     switch.
#
#   KEWS.storming?
#     Returns true if storm effects are running. Also, you could check the
#     switch.
#
#   KEWS.snowing?
#     Returns true if snow effects are running. Also, you could check the
#     switch.
#
#   KEWS.make_it_sunny
#     Changes the weather to sunny weather.
#
#   KEWS.make_it_rain(power)
#     Changes the weather to raining weather.
#     power = strength of effect (1 to 9)
#
#   KEWS.make_it_storm(power)
#     Changes the weather to stormy weather.
#     power = strength of effect (1 to 9)
#
#   KEWS.make_it_snow(power)
#     Changes the weather to snowy weather.
#     power = strength of effect (1 to 9)
#
#   KEWS.field?
#     Returns true if in a field environment defined by terrain tags.
#
#   KEWS.forest?
#     Returns true if in a forest environment defined by terrain tags.
#
#   KEWS.marsh?
#     Returns true if in a marsh environment defined by terrain tags.
#
#   KEWS.snow?
#     Returns true if in a snow environment defined by terrain tags.
#
#   KEWS.desert?
#     Returns true if in a desert environment defined by terrain tags.
#
#   KEWS.mountain?
#     Returns true if in a mountain environment defined by terrain tags.
#
#   KEWS.weatherless?
#     Returns true if in a weatherless environment defined by terrain tags.
#
#Additional:
#
#  The KEWS is initially turned off, you need to turn it on with "Call Script".
#  There are seven standard environments provided with the KEWS.
#  To use a weather effect not normally used in a certain area,
#  use a command above.
#
#=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:==:=:=:=:=:=:=:=

module KEWS
  
#--------------------------------------
#  * Configuration START *
#--------------------------------------
  #Sunny switch
  SUSWITCH = 53
  #Raining switch
  RSWITCH = 54
  #Storming switch
  STSWITCH = 55
  #Snowing switch
  SNSWITCH = 56
  #Terrain tag used to define the field environment
  FIELD_TAG = 1
  #Terrain tag used to define the forest environment
  FOREST_TAG = 2
  #Terrain tag used to define the marsh environment
  MARSH_TAG = 3
  #Terrain tag used to define the snow environment
  SNOW_TAG = 4
  #Terrain tag used to define the desert environment
  DESERT_TAG = 5
  #Terrain tag used to define the mountain environment
  MOUNTAIN_TAG = 6
  #Terrain tag used to define the weatherless environment
  WEATHERLESS_TAG = 7
  #These limits are just base numbers used in the Multiplier section later.
  #Maximum length of sunny weather in in-game days (Can't be 0)
  SUN_LIMIT = 3
  #Maximum length of rainy weather in in-game days
  RAIN_LIMIT = 1
  #Maximum length of stormy weather in in-game days
  STORM_LIMIT = 2
  #Maximum length of snowy weather in in-game days
  SNOW_LIMIT = 1
  #Multipliers for environmental weather limits are next.
  #  1 is no change, and 0 is none of that weather at all.
  #Field Multipliers
  FIELD_SUN_MULTI = 1
  FIELD_RAIN_MULTI = 1
  FIELD_STORM_MULTI = 1
  FIELD_SNOW_MULTI = 0
  #Forest Multipliers
  FOREST_SUN_MULTI = (2/3)
  FOREST_RAIN_MULTI = 1
  FOREST_STORM_MULTI = 1
  FOREST_SNOW_MULTI = 0
  #Marsh Multipliers
  MARSH_SUN_MULTI = (2/3)
  MARSH_RAIN_MULTI = 0
  MARSH_STORM_MULTI = (4/3)
  MARSH_SNOW_MULTI = 0
  #Snow Multipliers
  SNOW_SUN_MULTI = 1
  SNOW_RAIN_MULTI = 0
  SNOW_STORM_MULTI = 0
  SNOW_SNOW_MULTI = 3
  #Desert Multipliers
  DESERT_SUN_MULTI = 3
  DESERT_RAIN_MULTI = (1/2)
  DESERT_STORM_MULTI = 0
  DESERT_SNOW_MULTI = 0
  #Mountain Multipliers
  MOUNTAIN_SUN_MULTI = (3/2)
  MOUNTAIN_RAIN_MULTI = (3/2)
  MOUNTAIN_STORM_MULTI = (3/2)
  MOUNTAIN_SNOW_MULTI = (3/2)
  #Weatherless Multipliers arn't required. (Always "Sunny")
#--------------------------------------
#  * Configuration END *
#--------------------------------------

  def self.on
    $game_system.kews.active = true
    return true
  end
  
  def self.off
    $game_system.kews.active = false
    return true
  end
  
  def self.active?
    return $game_system.kews.active
  end
  
  def self.sunny?
    if $game_system.kews.weather == 0
      return true
    else
      return false
    end
  end
  
  def self.raining?
    if $game_system.kews.weather == 1
      return true
    else
      return false
    end
  end
  
  def self.storming?
    if $game_system.kews.weather == 2
      return true
    else
      return false
    end
  end
  
  def self.snowing?
    if $game_system.kews.weather == 3
      return true
    else
      return false
    end
  end
  
  def self.make_it_sunny
    $game_system.kews.weather = 0
    return true
  end
  
  def self.make_it_rain(power)
    $game_system.kews.weather_power = power
    $game_system.kews.weather = 1
    return true
  end
  
  def self.make_it_storm(power)
    $game_system.kews.weather_power = power
    $game_system.kews.weather = 2
    return true
  end
  
  def self.make_it_snow(power)
    $game_system.kews.weather_power = power
    $game_system.kews.weather = 3
    return true
  end
  
  def self.field?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == FIELD_TAG
      return true
    else
      return false
    end
  end
  
  def self.forest?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == FOREST_TAG
      return true
    else
      return false
    end
  end
  
  def self.marsh?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == MARSH_TAG
      return true
    else
      return false
    end
  end
  
  def self.snow?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == SNOW_TAG
      return true
    else
      return false
    end
  end
  
  def self.desert?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == DESERT_TAG
      return true
    else
      return false
    end
  end
  
  def self.mountain?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == MOUNTAIN_TAG
      return true
    else
      return false
    end
  end
  
  def self.weatherless?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == WEATHERLESS_TAG
      return true
    else
      return false
    end
  end
end

#==============================================================================
# Game_System
#==============================================================================

class Game_System
  
  attr_accessor :kews
  
  alias init_kews_later initialize
  def initialize
    init_kews_later
    @kews = Game_KEWS.new
  end
end

#==============================================================================
# Game_KEWS
#==============================================================================

class Game_KEWS
  
  attr_accessor :active
  attr_accessor :weather
  attr_accessor :weather_power
  
  def initialize
    @active = false
    @weather = 0
    @weather_power = 0
    @bgs = nil
    @fade = 200
    @tone_fade = 200
    @sun_limits = 0
    @rain_limits = 0
    @storm_limits = 0
    @snow_limits = 0
    @sun_base = (ATES::LENGTH * KEWS::SUN_LIMIT)
    @rain_base = (ATES::LENGTH * KEWS::RAIN_LIMIT)
    @storm_base = (ATES::LENGTH * KEWS::STORM_LIMIT)
    @snow_base = (ATES::LENGTH * KEWS::SNOW_LIMIT)
  end
  
  def set_weather
    @player_x = $game_player.x
    @player_y = $game_player.y
    @current_terrain = $game_map.terrain_tag(@player_x, @player_y)
    @weather_power = rand(10)
    if @weather_power == 0
      @weather = 0
    else
      @weather = rand(4)
    end
    if @current_terrain == KEWS::FIELD_TAG
      @sun_limits = (rand(@sun_base) * KEWS::FIELD_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::FIELD_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::FIELD_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::FIELD_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::FOREST_TAG
      @sun_limits = (rand(@sun_base) * KEWS::FOREST_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::FOREST_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::FOREST_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::FOREST_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::MARSH_TAG
      @sun_limits = (rand(@sun_base) * KEWS::MARSH_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::MARSH_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::MARSH_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::MARSH_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::SNOW_TAG
      @sun_limits = (rand(@sun_base) * KEWS::SNOW_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::SNOW_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::SNOW_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::SNOW_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::DESERT_TAG
      @sun_limits = (rand(@sun_base) * KEWS::DESERT_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::DESERT_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::DESERT_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::DESERT_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::MOUNTAIN_TAG
      @sun_limits = (rand(@sun_base) * KEWS::MOUNTAIN_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::MOUNTAIN_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::MOUNTAIN_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::MOUNTAIN_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::WEATHERLESS_TAG
      $game_screen.weather(0, 0, @fade)
      Audio.bgs_fade(10 * 1000)
      unless ATES.tinting? and ATES::OVERDARKENING and ATES.night? == true
        $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), @tone_fade)
      end
    else
      return
    end
  end
  
  def get_weather
    case @weather
    when 0
      if @sun_limits == 0
        return
      else
        $game_screen.weather(@weather, @weather_power, @fade)
        Audio.bgs_fade(10 * 1000)
        unless ATES.tinting? and ATES::OVERDARKENING and ATES.night? == true
          $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), @tone_fade)
        end
      end
    when 1
      if @rain_limits == 0
        return
      else
        $game_screen.weather(@weather, @weather_power, @fade)
        Audio.bgs_play("Audio/BGS/005-Rain01", 100, 100)
        unless ATES.tinting? and ATES::OVERDARKENING and ATES.night? == true
          $game_screen.start_tone_change(Tone.new(-68, -34, 0, 0), @tone_fade)
        end
      end
    when 2
      if @storm_limits == 0
        return
      else
        $game_screen.weather(@weather, @weather_power, @fade)
        Audio.bgs_play("Audio/BGS/006-Rain02", 100, 100)
        unless ATES.tinting? and ATES::OVERDARKENING and ATES.night? == true
          $game_screen.start_tone_change(Tone.new(-136, -102, -34, 0), @tone_fade)
        end
      end
    when 3
      if @snow_limits == 0
        return
      else
        $game_screen.weather(@weather, @weather_power, @fade)
        Audio.bgs_play("Audio/BGS/003-Wind03", 100, 100)
        unless ATES.tinting? and ATES::OVERDARKENING and ATES.night? == true
          $game_screen.start_tone_change(Tone.new(-68, -34, -34, 100), @tone_fade)
        end
      end
    end
  end
  
  def update
    if @active == true
      if @player_x != $game_player.x
        @player_x = $game_player.x
      end
      if @player_y != $game_player.y
        @player_y = $game_player.y
      end
      if @current_terrain != $game_map.terrain_tag(@player_x, @player_y)
        @current_terrain = $game_map.terrain_tag(@player_x, @player_y)
        set_weather
      end
      case @weather
      when 0
        $game_switches[KEWS::SUSWITCH] = true
        $game_switches[KEWS::RSWITCH] = false
        $game_switches[KEWS::STSWITCH] = false
        $game_switches[KEWS::SNSWITCH] = false
        $game_map.need_refresh = true
        if ($game_system.ates.frame_count % (@sun_limits + 1)) == 0
          set_weather
        end
      when 1
        $game_switches[KEWS::SUSWITCH] = false
        $game_switches[KEWS::RSWITCH] = true
        $game_switches[KEWS::STSWITCH] = false
        $game_switches[KEWS::SNSWITCH] = false
        $game_map.need_refresh = true
        if ($game_system.ates.frame_count % (@rain_limits + 1)) == 0
          set_weather
        end
      when 2
        $game_switches[KEWS::SUSWITCH] = false
        $game_switches[KEWS::RSWITCH] = false
        $game_switches[KEWS::STSWITCH] = true
        $game_switches[KEWS::SNSWITCH] = false
        $game_map.need_refresh = true
        if ($game_system.ates.frame_count % (@storm_limits + 1)) == 0
          set_weather
        end
      when 3
        $game_switches[KEWS::SUSWITCH] = false
        $game_switches[KEWS::RSWITCH] = false
        $game_switches[KEWS::STSWITCH] = false
        $game_switches[KEWS::SNSWITCH] = true
        $game_map.need_refresh = true
        if ($game_system.ates.frame_count % (@snow_limits + 1)) == 0
          set_weather
        end
      end
    else
      return
    end
  end
end

#==============================================================================
# Scene_Map
#==============================================================================

class Scene_Map
  
  alias kews_update_later update
  def update
    $game_system.kews.update
    kews_update_later
  end
  
  alias transfer_player_kews_later transfer_player
  def transfer_player
    if KEWS.active?
      $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 0) unless ATES.tinting?
      $game_screen.weather(0, 0, 0)
    end
    transfer_player_kews_later
  end
end

[Show/Hide] Script: KEWSv1.2
CODE
#=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#Kendorei's Environmental Weather System  (KEWS)
#Version: 1.2
#Created: v1.0 - 04.29.2010
#         v1.1 - 05.07.2010
#         v1.2 - 06.05.2010  <-  Independancy Obtained
#Type:  Autonomous Weather System
#=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#Compatability:
#
#  Unknown compatability with the SDK.
#  May cause problems with other Weather Systems.
#
#Features:
#
# - Controls weather and related processes without need of specific events
#   automatically.
# - Allows full control of the KEWS.
# - Easy to set up and control.
# - Now fully independant.
#
#Instructions:
#
# - Explaination:
#
#   This is a Weather System designed to take care of general weather
#   effects in game. You can set up several config settings later
#   defined in the appropriate section. The system makes use of terrain
#   tags to determine what effects would be appropriate. This system also
#   uses in-game switches to allow for special effects with other events.
#
# - Manipulation:
#
#   The KEWS can be fully controled through "Call Script" events. Just use
#   the following commands:
#
#   KEWS.on
#     Turns the KEWS on.
#
#   KEWS.off
#     Turns the KEWS off.
#
#   KEWS.active?
#     Returns true if the KEWS is running.
#
#   KEWS.sunny?
#     Returns true if no weather effects are running. Also, you could check
#     the switch.
#
#   KEWS.raining?
#     Returns true if rain effects are running. Also, you could check the
#     switch.
#
#   KEWS.storming?
#     Returns true if storm effects are running. Also, you could check the
#     switch.
#
#   KEWS.snowing?
#     Returns true if snow effects are running. Also, you could check the
#     switch.
#
#   KEWS.make_it_sunny
#     Changes the weather to sunny weather.
#
#   KEWS.make_it_rain(power)
#     Changes the weather to raining weather.
#     power = strength of effect (1 to 9)
#
#   KEWS.make_it_storm(power)
#     Changes the weather to stormy weather.
#     power = strength of effect (1 to 9)
#
#   KEWS.make_it_snow(power)
#     Changes the weather to snowy weather.
#     power = strength of effect (1 to 9)
#
#   KEWS.field?
#     Returns true if in a field environment defined by terrain tags.
#
#   KEWS.forest?
#     Returns true if in a forest environment defined by terrain tags.
#
#   KEWS.marsh?
#     Returns true if in a marsh environment defined by terrain tags.
#
#   KEWS.snow?
#     Returns true if in a snow environment defined by terrain tags.
#
#   KEWS.desert?
#     Returns true if in a desert environment defined by terrain tags.
#
#   KEWS.mountain?
#     Returns true if in a mountain environment defined by terrain tags.
#
#   KEWS.weatherless?
#     Returns true if in a weatherless environment defined by terrain tags.
#
#Additional:
#
#  The KEWS is initially turned off, you need to turn it on with "Call Script".
#  There are seven standard environments provided with the KEWS.
#  To use a weather effect not normally used in a certain area,
#  use a command above.
#
#Random Fact:
#
#  With all comments and blank lines taken out, this script is exactly 340 lines.
#
#=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:==:=:=:=:=:=:=:=

module KEWS
  
#--------------------------------------
#  * Configuration START *
#--------------------------------------
  #Sunny switch
  SUSWITCH = 53
  #Raining switch
  RSWITCH = 54
  #Storming switch
  STSWITCH = 55
  #Snowing switch
  SNSWITCH = 56
  #Terrain tag used to define the field environment
  FIELD_TAG = 1
  #Terrain tag used to define the forest environment
  FOREST_TAG = 2
  #Terrain tag used to define the marsh environment
  MARSH_TAG = 3
  #Terrain tag used to define the snow environment
  SNOW_TAG = 4
  #Terrain tag used to define the desert environment
  DESERT_TAG = 5
  #Terrain tag used to define the mountain environment
  MOUNTAIN_TAG = 6
  #Terrain tag used to define the weatherless environment
  WEATHERLESS_TAG = 7
  #The length of a "day" of weather, in seconds.
  LENGTH = 720
  #These limits are just base numbers used in the Multiplier section later.
  #Maximum length of sunny weather in "days"
  SUN_LIMIT = 3
  #Maximum length of rainy weather in "days"
  RAIN_LIMIT = 1
  #Maximum length of stormy weather in "days"
  STORM_LIMIT = 2
  #Maximum length of snowy weather in "days"
  SNOW_LIMIT = 1
  #Multipliers for environmental weather limits are next.
  #  1 is no change, and 0 is none of that weather at all.
  #Field Multipliers
  FIELD_SUN_MULTI = 1
  FIELD_RAIN_MULTI = 1
  FIELD_STORM_MULTI = 1
  FIELD_SNOW_MULTI = 0
  #Forest Multipliers
  FOREST_SUN_MULTI = (2/3)
  FOREST_RAIN_MULTI = 1
  FOREST_STORM_MULTI = 1
  FOREST_SNOW_MULTI = 0
  #Marsh Multipliers
  MARSH_SUN_MULTI = (2/3)
  MARSH_RAIN_MULTI = 0
  MARSH_STORM_MULTI = (4/3)
  MARSH_SNOW_MULTI = 0
  #Snow Multipliers
  SNOW_SUN_MULTI = 1
  SNOW_RAIN_MULTI = 0
  SNOW_STORM_MULTI = 0
  SNOW_SNOW_MULTI = 3
  #Desert Multipliers
  DESERT_SUN_MULTI = 3
  DESERT_RAIN_MULTI = (1/2)
  DESERT_STORM_MULTI = 0
  DESERT_SNOW_MULTI = 0
  #Mountain Multipliers
  MOUNTAIN_SUN_MULTI = (3/2)
  MOUNTAIN_RAIN_MULTI = (3/2)
  MOUNTAIN_STORM_MULTI = (3/2)
  MOUNTAIN_SNOW_MULTI = (3/2)
  #Weatherless Multipliers arn't required. (Always "Sunny")
#--------------------------------------
#  * Configuration END *
#--------------------------------------

  def self.on
    $game_system.kews.active = true
    return true
  end
  
  def self.off
    $game_system.kews.active = false
    return true
  end
  
  def self.active?
    return $game_system.kews.active
  end
  
  def self.sunny?
    if $game_system.kews.weather == 0
      return true
    else
      return false
    end
  end
  
  def self.raining?
    if $game_system.kews.weather == 1
      return true
    else
      return false
    end
  end
  
  def self.storming?
    if $game_system.kews.weather == 2
      return true
    else
      return false
    end
  end
  
  def self.snowing?
    if $game_system.kews.weather == 3
      return true
    else
      return false
    end
  end
  
  def self.make_it_sunny
    $game_system.kews.weather = 0
    return true
  end
  
  def self.make_it_rain(power)
    $game_system.kews.weather_power = power
    $game_system.kews.weather = 1
    return true
  end
  
  def self.make_it_storm(power)
    $game_system.kews.weather_power = power
    $game_system.kews.weather = 2
    return true
  end
  
  def self.make_it_snow(power)
    $game_system.kews.weather_power = power
    $game_system.kews.weather = 3
    return true
  end
  
  def self.field?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == FIELD_TAG
      return true
    else
      return false
    end
  end
  
  def self.forest?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == FOREST_TAG
      return true
    else
      return false
    end
  end
  
  def self.marsh?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == MARSH_TAG
      return true
    else
      return false
    end
  end
  
  def self.snow?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == SNOW_TAG
      return true
    else
      return false
    end
  end
  
  def self.desert?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == DESERT_TAG
      return true
    else
      return false
    end
  end
  
  def self.mountain?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == MOUNTAIN_TAG
      return true
    else
      return false
    end
  end
  
  def self.weatherless?
    if $game_map.terrain_tag($game_player.x, $game_player.y) == WEATHERLESS_TAG
      return true
    else
      return false
    end
  end
end

#==============================================================================
# Game_System
#==============================================================================

class Game_System
  
  attr_accessor :kews
  
  alias init_kews_later initialize
  def initialize
    init_kews_later
    @kews = Game_KEWS.new
  end
end

#==============================================================================
# Game_KEWS
#==============================================================================

class Game_KEWS
  
  attr_accessor :active
  attr_accessor :weather
  attr_accessor :weather_power
  attr_accessor :frame_count
  
  def initialize
    @active = false
    @weather = 0
    @weather_power = 0
    @bgs = nil
    @fade = 200
    @tone_fade = 200
    @sun_limits = 0
    @rain_limits = 0
    @storm_limits = 0
    @snow_limits = 0
    @frame_count = 0
    @sun_base = (KEWS::LENGTH * KEWS::SUN_LIMIT)
    @rain_base = (KEWS::LENGTH * KEWS::RAIN_LIMIT)
    @storm_base = (KEWS::LENGTH * KEWS::STORM_LIMIT)
    @snow_base = (KEWS::LENGTH * KEWS::SNOW_LIMIT)
  end
  
  def set_weather
    @player_x = $game_player.x
    @player_y = $game_player.y
    @current_terrain = $game_map.terrain_tag(@player_x, @player_y)
    @weather_power = rand(10)
    if @weather_power == 0
      @weather = 0
    else
      @weather = rand(4)
    end
    if @current_terrain == KEWS::FIELD_TAG
      @sun_limits = (rand(@sun_base) * KEWS::FIELD_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::FIELD_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::FIELD_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::FIELD_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::FOREST_TAG
      @sun_limits = (rand(@sun_base) * KEWS::FOREST_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::FOREST_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::FOREST_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::FOREST_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::MARSH_TAG
      @sun_limits = (rand(@sun_base) * KEWS::MARSH_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::MARSH_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::MARSH_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::MARSH_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::SNOW_TAG
      @sun_limits = (rand(@sun_base) * KEWS::SNOW_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::SNOW_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::SNOW_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::SNOW_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::DESERT_TAG
      @sun_limits = (rand(@sun_base) * KEWS::DESERT_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::DESERT_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::DESERT_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::DESERT_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::MOUNTAIN_TAG
      @sun_limits = (rand(@sun_base) * KEWS::MOUNTAIN_SUN_MULTI)
      @rain_limits = (rand(@rain_base) * KEWS::MOUNTAIN_RAIN_MULTI)
      @storm_limits = (rand(@storm_base) * KEWS::MOUNTAIN_STORM_MULTI)
      @snow_limits = (rand(@snow_base) * KEWS::MOUNTAIN_SNOW_MULTI)
      get_weather
    elsif @current_terrain == KEWS::WEATHERLESS_TAG
      $game_screen.weather(0, 0, @fade)
      Audio.bgs_fade(10 * 1000)
      $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), @tone_fade)
    else
      return
    end
  end
  
  def get_weather
    case @weather
    when 0
      if @sun_limits == 0
        return
      else
        $game_screen.weather(@weather, @weather_power, @fade)
        Audio.bgs_fade(10 * 1000)
        $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), @tone_fade)
      end
    when 1
      if @rain_limits == 0
        return
      else
        $game_screen.weather(@weather, @weather_power, @fade)
        Audio.bgs_play("Audio/BGS/005-Rain01", 100, 100)
        $game_screen.start_tone_change(Tone.new(-68, -34, 0, 0), @tone_fade)
      end
    when 2
      if @storm_limits == 0
        return
      else
        $game_screen.weather(@weather, @weather_power, @fade)
        Audio.bgs_play("Audio/BGS/006-Rain02", 100, 100)
        $game_screen.start_tone_change(Tone.new(-136, -102, -34, 0), @tone_fade)
      end
    when 3
      if @snow_limits == 0
        return
      else
        $game_screen.weather(@weather, @weather_power, @fade)
        Audio.bgs_play("Audio/BGS/003-Wind03", 100, 100)
        $game_screen.start_tone_change(Tone.new(-68, -34, -34, 100), @tone_fade)
      end
    end
  end
  
  def update
    if @active == true
      @frame_count += 1
      if @player_x != $game_player.x
        @player_x = $game_player.x
      end
      if @player_y != $game_player.y
        @player_y = $game_player.y
      end
      if @current_terrain != $game_map.terrain_tag(@player_x, @player_y)
        @current_terrain = $game_map.terrain_tag(@player_x, @player_y)
        set_weather
      end
      case @weather
      when 0
        $game_switches[KEWS::SUSWITCH] = true
        $game_switches[KEWS::RSWITCH] = false
        $game_switches[KEWS::STSWITCH] = false
        $game_switches[KEWS::SNSWITCH] = false
        $game_map.need_refresh = true
        if (@frame_count % (@sun_limits + 1)) == 0
          set_weather
        end
      when 1
        $game_switches[KEWS::SUSWITCH] = false
        $game_switches[KEWS::RSWITCH] = true
        $game_switches[KEWS::STSWITCH] = false
        $game_switches[KEWS::SNSWITCH] = false
        $game_map.need_refresh = true
        if (@frame_count % (@rain_limits + 1)) == 0
          set_weather
        end
      when 2
        $game_switches[KEWS::SUSWITCH] = false
        $game_switches[KEWS::RSWITCH] = false
        $game_switches[KEWS::STSWITCH] = true
        $game_switches[KEWS::SNSWITCH] = false
        $game_map.need_refresh = true
        if (@frame_count % (@storm_limits + 1)) == 0
          set_weather
        end
      when 3
        $game_switches[KEWS::SUSWITCH] = false
        $game_switches[KEWS::RSWITCH] = false
        $game_switches[KEWS::STSWITCH] = false
        $game_switches[KEWS::SNSWITCH] = true
        $game_map.need_refresh = true
        if (@frame_count % (@snow_limits + 1)) == 0
          set_weather
        end
      end
    else
      return
    end
  end
end

#==============================================================================
# Scene_Map
#==============================================================================

class Scene_Map
  
  alias kews_update_later update
  def update
    $game_system.kews.update
    kews_update_later
  end
  
  alias transfer_player_kews_later transfer_player
  def transfer_player
    if KEWS.active?
      $game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 0)
      $game_screen.weather(0, 0, 0)
    end
    transfer_player_kews_later
  end
end


Customization
All you need to do is set up the configuration at the start of the script.

Compatibility
Unknown compatability with the SDK, but likely as compatable as the ATES.
Will likely cause problems with other weather systems.

Screenshot
No screenshot available

DEMO
KEWSv1.1 Demo
KEWSv1.2 Demo
** The Blizz-ABS is used in the demo, so the controls are the standard controls for that system:
Confirm = H
Cancel = F
Movement = A, S, D, W
Attack = K
ect. (look up the Blizz-ABS controls for more than these)

Installation
Just copy and paste the KEWS (if using version 1.1, below the ATES and) above Main.

FAQ
Not available at this time.

Terms and Conditions
You need to use the ATES in order to use the KEWS if you're using version 1.1.
Version 1.2 is completely independant.

Credits
Myself, and Blizzard for making the ATES which helped me determine how the KEWS oughtta work.

This post has been edited by Kendorei: Jun 6 2010, 10:51 PM


__________________________
Kendorei, Old Soul

Current Project: Elemental War: Blade of Elements

Cna yuo raed tihs? Olny 55% of plepoe can.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!
fi yuo cna raed tihs, palce it in yuor siantugre.

My scripts:
Go to the top of the page
 
+Quote Post
   
Kendorei
post May 7 2010, 03:41 PM
Post #2


Level 2
Group Icon

Group: Member
Posts: 25
Type: Event Designer
RM Skill: Intermediate




Despite the lack of feedback, I updated the script because it looked sloppy to me on review. I made the first version late at night. xD


__________________________
Kendorei, Old Soul

Current Project: Elemental War: Blade of Elements

Cna yuo raed tihs? Olny 55% of plepoe can.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!
fi yuo cna raed tihs, palce it in yuor siantugre.

My scripts:
Go to the top of the page
 
+Quote Post
   
Legacy
post May 7 2010, 04:03 PM
Post #3


B★RS Coding Ninja
Group Icon

Group: Global Mod
Posts: 1,414
Type: Scripter
RM Skill: Advanced
Rev Points: 15




Nice little script, the code is clean, well commented, and easy to use and edit. i thinkyou've done a wonderful job, ill stress test it for you to see if i can make a bug pop up wink.gif and let you know.

EDIT:

Ok just started testing, and man you should really point out that theres new controls for this demo, i ended up button bashing and taking a guess at which keys where to move. So i was you, i would add a list of Controls to your topic for the purpose of the demo users.

Anyway... on to the test XD


__________________________
Freelance Programmer (C#, C++, Ruby)
#onegameamonth


Have you seen the new Unity3D sections?..
Unity 3D Discussion
Unity Script Development
Unity Projects
Go to the top of the page
 
+Quote Post
   
Kendorei
post May 7 2010, 04:32 PM
Post #4


Level 2
Group Icon

Group: Member
Posts: 25
Type: Event Designer
RM Skill: Intermediate




Yeah, sorry, forgot to mention that I used the Blizz-ABS in the demo. I'll note that in the first post. xD


__________________________
Kendorei, Old Soul

Current Project: Elemental War: Blade of Elements

Cna yuo raed tihs? Olny 55% of plepoe can.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!
fi yuo cna raed tihs, palce it in yuor siantugre.

My scripts:
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 12:15 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker