Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Random Weather with AWS (SDK)

Okay I'm hoping someone can help me with this. I may have just interpretted the comments wrong, but how do I set a map so that it can have random weather? It is included in the script right? Or do i need to make a seperate common event for it myself?
 
The call script for the Advanced Weather System (or any weather for that matter) is.
Code:
$game_screen.weather(type, power, duration)
As Raiju you could use the rand(max) method for completely random weather.
However, if you only want curtain weather types though you could use something like.

Code:
class PTS
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #-------------------------------------------------------------------------- 
  attr_accessor :transition_time          # transition time of weather
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @transition_time = 5
    # Create Seasonal Weather Data [Map ID][Season][Weather Type]
    # Percentage chance for each type of weather (must add to 100%)
    @weather_data = []
    @weather_data[1] = [[50, 5, 0, 45], [25, 50, 25], [25, 20, 20, 0, 10, 25],
                        [25, 15, 10, 10, 0, 0, 10, 15, 10, 5]]
    # Create variables for weather? method
    @perminence_factor = 10
    @weather_same = 0
    @weather_type = weather?
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    if @total_min != $game_system.timer / Graphics.frame_rate
      weather
    end
  $game_system.game_system_update
  end
  #--------------------------------------------------------------------------
  # * Update Weather
  #--------------------------------------------------------------------------
  def weather
    if @total_min % 60 == 0 or @indoors != @inside
      @weather = @inside ? 0 : weather?
      type = @weather
      power = @inside ? 0 : 10 + rand(15) + @weather_same * 5
      if power > 50 then power = 50 end
      duration = @inside ? 0 : @transition_time * @speed * Graphics.frame_rate
      $game_screen.weather(type, power, duration)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine Weather Type
  #--------------------------------------------------------------------------
  def weather?
    weather = 0
    unless @weather_data[$game_map.map_id] == nil
      # Create short forms for variables
      percent = @weather_data[$game_map.map_id][season?][@weather]
      pf = @perminence_factor
      w = @weather
      # Randomize Weather
      n = rand(100)
      total = 0
      while w > 0
        total += @weather_data[$game_map.map_id][season?][w]
        w -= 1
      end
      add_sub = total < n ? true : false
      if add_sub
        n -= rand(percent / pf + percent % pf * 2 / pf)
      else
        n += rand(percent / pf + percent % pf * 2 / pf)
      end
      for i in @weather_data[$game_map.map_id][season?]
        unless i == nil
          n -= i
          if n > 0 then weather += 1 else break end
        else
          break
        end
      end
    end
    if weather == 0
      @weather_same = 0
    else
      if weather == @weather and @weather != nil
        @weather_same += 1
      else
        @weather_same = 0
      end
    end
    return weather
  end
  #--------------------------------------------------------------------------
  # * Determine the season
  #--------------------------------------------------------------------------
  def season?
    case @month
    when 0 .. 1
      season = 0
    when 2
      season = @days < 20 ? 0 : 1
    when 3 .. 4
      season = 1
    when 5
      season = @days < 21 ? 1 : 2
    when 6 .. 7
      season = 2
    when 8
      season = @days < 23 ? 2 : 3
    when 9 .. 10
      season = 3
    when 11
      season = @days < 21 ? 3 : 0
    when 12 .. 13
      season = 0
    end
    if season != @season and @season != nil
      change_tilesets (season)
    end
    return season
  end
end

class Game_System
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias game_system_update update
  def update
    $pts.update
  end
end

class Scene_Title
  #--------------------------------------------------------------------------
  # * Command: New Game
  #--------------------------------------------------------------------------
  alias scene_title_command_new_game command_new_game
  def command_new_game
    scene_title_command_new_game
    # Create Progressive Time System Object
    $pts = PTS.new
  end
end

class Scene_Save
  #--------------------------------------------------------------------------
  # * Write Save Data
  #     file : write file object (opened)
  #--------------------------------------------------------------------------
  alias scene_save_write_save_data write_save_data
  def write_save_data(file)
    scene_save_write_save_data(file)
    Marshal.dump($pts, file)
  end
end

class Scene_Load
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  alias scene_load_read_save_data read_save_data
  def read_save_data(file)
    scene_load_read_save_data(file)
    $pts = Marshal.load(file)
    # Change Screen Tone
    $game_screen.start_tone_change($pts.tone?, 0)
    # Immediately redraw Sprite_Timer and Sprite_PTS
  end
end
Hopefully I removed all references to the rest of my PTS. I haven't tested this code seperately.
This allows you to specify percentage chances for each type of weather and have different weather on each map.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top