○檢視:
#==============================================================================
#----------------------------------------------------------------------------
# ○ OSD - 腳本討論社
# Originality RGSS Discuss
# └http://guild.gamer.com.tw/guild.php?sn=4707
#----------------------------------------------------------------------------
#==============================================================================
#--------------------------------------------------------------------------
# ● 腳本名稱:圖片天氣
#--------------------------------------------------------------------------
# ● 腳本效果:
# 以使用者設定的圖片,
# 作天氣的描繪。
#--------------------------------------------------------------------------
# ● 腳本版本:1.01 版
#--------------------------------------------------------------------------
# ● 腳本更新區塊:
# 1.01 版
# └修正進入選單仍顯示天氣 bug
#--------------------------------------------------------------------------
#==============================================================================
#----------------------------------------------------------------------------
# ○ OSD - 腳本討論社
# Originality RGSS Discuss
# └http://guild.gamer.com.tw/guild.php?sn=4707
#----------------------------------------------------------------------------
#==============================================================================
○使用方法:
※※※※※※※※※※※※※※※※※※※※
Rain_Graphic
設定雨的圖像,可以為數組,系統自動隨機顯示
※※※※※※※※※※※※※※※※※※※※
Ice_Graphic
使用方法如 Rain_Graphic 一樣,設定冰雹的圖像
※※※※※※※※※※※※※※※※※※※※
Snow_Graphic
使用方法如 Rain_Graphic 一樣,設定雪的圖像
※※※※※※※※※※※※※※※※※※※※
Wind_Graphic
使用方法如 Rain_Graphic 一樣,設定風的圖像
※※※※※※※※※※※※※※※※※※※※
Thunder_Graphic
使用方法如 Rain_Graphic 一樣,設雷的圖像
※※※※※※※※※※※※※※※※※※※※
$game_temp.weather_type
設定氣候類型,
超出此範圍無效果。
※※※※※※※※※※※※※※※※※※※※
$game_temp.weather_max
設定氣候顯示各數
最多為 40 ,超出 40 無效果,強行退回 40。
※※※※※※※※※※※※※※※※※※※※
$game_temp.weather_path
設定氣候方向,打雷並無此設定。
超出 1 到 2 的強制設定為直線墜落
※※※※※※※※※※※※※※※※※※※※
效果範例
以事件腳本就可以。
設定下雨,強度中等,方向向右。
※※※※※※※※※※※※※※※※※※※※
○腳本檢視:
○畫面:
#==============================================================================
#----------------------------------------------------------------------------
# ○ OSD - 腳本討論社
# Originality RGSS Discuss
# └http://guild.gamer.com.tw/guild.php?sn=4707
#----------------------------------------------------------------------------
#==============================================================================
#--------------------------------------------------------------------------
# ● 腳本名稱:圖片天氣
#--------------------------------------------------------------------------
# ● 腳本效果:
# 以使用者設定的圖片,
# 作天氣的描繪。
#--------------------------------------------------------------------------
# ● 腳本版本:1.01 版
#--------------------------------------------------------------------------
# ● 腳本更新區塊:
# 1.01 版
# └修正進入選單仍顯示天氣 bug
#--------------------------------------------------------------------------
#==============================================================================
#----------------------------------------------------------------------------
# ○ OSD - 腳本討論社
# Originality RGSS Discuss
# └http://guild.gamer.com.tw/guild.php?sn=4707
#----------------------------------------------------------------------------
#==============================================================================
○使用方法:
※※※※※※※※※※※※※※※※※※※※
Rain_Graphic
設定雨的圖像,可以為數組,系統自動隨機顯示
Rain_Graphic = [RPG::Cache.picture("rain"), RPG::Cache.picture("rain1"), RPG::Cache.picture("rain2")] |
Ice_Graphic
使用方法如 Rain_Graphic 一樣,設定冰雹的圖像
※※※※※※※※※※※※※※※※※※※※
Snow_Graphic
使用方法如 Rain_Graphic 一樣,設定雪的圖像
※※※※※※※※※※※※※※※※※※※※
Wind_Graphic
使用方法如 Rain_Graphic 一樣,設定風的圖像
※※※※※※※※※※※※※※※※※※※※
Thunder_Graphic
使用方法如 Rain_Graphic 一樣,設雷的圖像
※※※※※※※※※※※※※※※※※※※※
$game_temp.weather_type
設定氣候類型,
1 => 下雨 2 => 下冰雹 3 => 下雪 4 => 起風 5 => 打雷 |
※※※※※※※※※※※※※※※※※※※※
$game_temp.weather_max
設定氣候顯示各數
# 設定氣候為下雪 $game_temp.weather_type = 3 # 設定雪的各數為 40 $game_temp.weather_max = 40 |
※※※※※※※※※※※※※※※※※※※※
$game_temp.weather_path
設定氣候方向,打雷並無此設定。
1 => 向右 2 => 向左 |
※※※※※※※※※※※※※※※※※※※※
效果範例
以事件腳本就可以。
設定下雨,強度中等,方向向右。
$game_temp.weather_type = 1 $game_temp.weather_max = 20 $game_temp.weather_path = 1 |
○腳本檢視:
#============================================================================== #---------------------------------------------------------------------------- # ○ OSD - 腳本討論社 # Originality RGSS Discuss # └http://guild.gamer.com.tw/guild.php?sn=4707 #---------------------------------------------------------------------------- #============================================================================== #-------------------------------------------------------------------------- # ● 腳本名稱:圖片天氣 #-------------------------------------------------------------------------- # ● 腳本效果: # 以使用者設定的圖片, # 作天氣的描繪。 #-------------------------------------------------------------------------- # ● 腳本版本:1.01 版 #-------------------------------------------------------------------------- # ● 腳本更新區塊: # 1.01 版 # └修正進入選單仍顯示天氣 bug #-------------------------------------------------------------------------- #============================================================================== #---------------------------------------------------------------------------- # ○ OSD - 腳本討論社 # Originality RGSS Discuss # └http://guild.gamer.com.tw/guild.php?sn=4707 #---------------------------------------------------------------------------- #============================================================================== #-------------------------------------------------------------------------- # ● 自定義區 #-------------------------------------------------------------------------- module Weather_Function # 定義雨的圖像 Rain_Graphic = [RPG::Cache.picture("rain"), RPG::Cache.picture("rain1"), RPG::Cache.picture("rain2")] # 定義冰雹的圖像 Ice_Graphic = [RPG::Cache.picture("ice")] # 定義雪的圖像 Snow_Graphic = [RPG::Cache.picture("snow")] # 定義風的圖像 Wind_Graphic = [RPG::Cache.picture("wind")] # 定義雷的圖像 Thunder_Graphic = [RPG::Cache.picture("thunder"), RPG::Cache.picture("thunder1")] end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ # 在沒有存檔的情況下,處理臨時資料的類別。這個類別的實例請參考 $game_temp。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 定義實例變量 #-------------------------------------------------------------------------- attr_accessor :weather_type # 地圖天氣種類 attr_accessor :weather_max # 地圖天氣多少 attr_accessor :weather_path # 地圖天氣方向 #-------------------------------------------------------------------------- # ● 初始化目標 #-------------------------------------------------------------------------- alias initialize_osd initialize def initialize initialize_osd @weather_type = 0 @weather_max = 40 @weather_path = 2 end end #============================================================================== # ■ RPG::Graphic_Weather #------------------------------------------------------------------------------ # 管理圖片天氣相關設定 #============================================================================== module RPG class Graphic_Weather #-------------------------------------------------------------------------- # ● 實際定義變量 #-------------------------------------------------------------------------- attr_reader :type attr_reader :max attr_reader :ox attr_reader :oy attr_reader :path #-------------------------------------------------------------------------- # ● 初始化目標 #-------------------------------------------------------------------------- def initialize(viewport = nil) @path = 1 @type = 0 @max = 0 @ox = 0 @oy = 0 @sprites = [] (1..40).each {|i| sprite = Sprite.new(viewport) sprite.z = 1000 sprite.visible = false sprite.opacity = 0 @sprites.push(sprite) } end #-------------------------------------------------------------------------- # ● 釋放空間 #-------------------------------------------------------------------------- def dispose for sprite in @sprites sprite.dispose end end #-------------------------------------------------------------------------- # ● 種類變量定義 #-------------------------------------------------------------------------- def type=(type) return if @type == type @type = type (1..40).each {|i| sprite = @sprites[i] if sprite != nil sprite.visible = (i <= @max) case @type when 1 bitmap = Weather_Function::Rain_Graphic[rand(Weather_Function::Rain_Graphic.size)] when 2 bitmap = Weather_Function::Ice_Graphic[rand(Weather_Function::Ice_Graphic.size)] when 3 bitmap = Weather_Function::Snow_Graphic[rand(Weather_Function::Snow_Graphic.size)] when 4 bitmap = Weather_Function::Wind_Graphic[rand(Weather_Function::Wind_Graphic.size)] when 5 bitmap = Weather_Function::Thunder_Graphic[rand(Weather_Function::Thunder_Graphic.size)] else bitmap = nil end sprite.bitmap = bitmap end } end #-------------------------------------------------------------------------- # ● 方向變量定義 #-------------------------------------------------------------------------- def path=(path) return if @path == path @path = path end #-------------------------------------------------------------------------- # ● ox 變量定義 #-------------------------------------------------------------------------- def ox=(ox) return if @ox == ox; @ox = ox for sprite in @sprites sprite.ox = @ox end end #-------------------------------------------------------------------------- # ● oy 變量定義 #-------------------------------------------------------------------------- def oy=(oy) return if @oy == oy; @oy = oy for sprite in @sprites sprite.oy = @oy end end #-------------------------------------------------------------------------- # ● 強度變量定義 #-------------------------------------------------------------------------- def max=(max) return if @max == max; @max = [[max, 0].max, 40].min (1..40).each {|i| sprite = @sprites[i] if sprite != nil sprite.visible = (i <= @max) end } end #-------------------------------------------------------------------------- # ● 更新畫面 #-------------------------------------------------------------------------- def update return if @type == 0 (1..@max).each {|i| sprite = @sprites[i] # 如果 @sprites[i] 不存在 if sprite == nil # 跳出迴圈 break end # 獲取天氣類型 case @type when 1 if @path == 1 sprite.x += 2 elsif @path == 2 sprite.x -= 2 else sprite.x -= 0 end sprite.y += 8 sprite.opacity -= 8 when 2 if @path == 1 sprite.x += 2 elsif @path == 2 sprite.x -= 2 else sprite.x -= 0 end sprite.y += 10 sprite.opacity -= 8 when 3 if @path == 1 sprite.x += 2 elsif @path == 2 sprite.x -= 2 else sprite.x -= 0 end sprite.y += 8 sprite.opacity -= 8 when 4 if @path == 1 sprite.x += 8 elsif @path == 2 sprite.x -= 8 else sprite.x -= 0 end sprite.y += 8 sprite.opacity -= 12 when 5 sprite.y += 1 sprite.opacity -= 10 end x = sprite.x - @ox y = sprite.y - @oy if sprite.opacity < 32 or x < -150 or x > 750 or y < -300 or y > 600 sprite.x = rand(800) - 50 + @ox sprite.y = rand(800) - 200 + @oy sprite.opacity = 255 # 判斷天氣類型自動切換大小變化 if @type === (1..3) sprite.zoom_x = rand(3) - rand(0.5) sprite.zoom_y = sprite.zoom_x end # 判斷方向自動切換翻轉 if @path == 1 sprite.mirror = true else sprite.mirror = false end end } end end end #============================================================================== # ■ Spriteset_Map #------------------------------------------------------------------------------ # 處理地圖畫面活動區塊和元件的類別。本類別使用在 Scene_Map 類別的內部。 #============================================================================== class Spriteset_Map #-------------------------------------------------------------------------- # ● 初始化目標 #-------------------------------------------------------------------------- alias initialize_osd initialize def initialize @graphic_weather = RPG::Graphic_Weather.new(@viewport1) initialize_osd end #-------------------------------------------------------------------------- # ● 更新畫面 #-------------------------------------------------------------------------- alias update_osd update def update update_osd @graphic_weather.update # 更新天候圖像 @graphic_weather.type = $game_temp.weather_type @graphic_weather.max = $game_temp.weather_max @graphic_weather.path = $game_temp.weather_path end #-------------------------------------------------------------------------- # ● 釋放空間 #-------------------------------------------------------------------------- alias dispose_osd dispose def dispose dispose_osd @graphic_weather.dispose end end |
○畫面: