#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ #_/ ◆ Restored Event Commands - KGC_OldEventCommands ◆ VX ◆ #_/ ◇ Last Update: 2008/02/15 #_/ ◆ Written by TOMY #_/ ◆ Translation by Mr. Anonymous #_/ ◆ KGC Site: #_/ ◆ http://ytomy.sakura.ne.jp/ #_/ ◆ Translator's Blog: #_/ ◆ http://mraprojects.wordpress.com #_/---------------------------------------------------------------------------- #_/ This script restores some event command functions that were lost in the #_/ release of RPG Maker VX. These commands are from RPG Maker 200x/XP. #_/---------------------------------------------------------------------------- #_/ ◆ Restored Event Commands ◆ #_/ These commands are used in "Script" function in the third page of event #_/ commands under "Advanced". #_/ #_/ ◆ remember_bgm ◆ #_/ Currently playing Background Music(BGM) is stored into memory. #_/ #_/ ◆ play_remembered_bgm ◆ #_/ Play BGM stored in memory. #_/ #_/ ◆ get_event_id (x, y, variable_id) ◆ #_/ Obtains an Event's ID # at a specified location (x, y) and stores it in #_/ the indicated variable. #_/ #_/ ◆ prepare_transition ◆ #_/ Prepares for a transition to be run. #_/ #_/ ◆ set_transition ( duration, filename, vague ) ◆ #_/ Executes a specified transition. #_/ Duration: The amount of frames the transition takes to complete. Default: 30 #_/ Filename: The image file (without extension) to use for the transition #_/ located in the "Graphics\System" folder. #_/ If no filename is indictated, the default transition is used. #_/ Vague: The ambiguity boundary of the transition. Default: 40 #_/ Translation note: I'm not sure what this does. I think it may have #_/ something to do with fading or transparency of the effect. #_/ More playtesting is in order. If anyone figures this out, let me know. #_/ #_/ ◆ unset_transition ◆ #_/ Cancels a transition from executing. #_/ #_/ ◆ change_balloon_icon (filename) ◆ #_/ Changes the emoticon balloon set. When no filename is set, the default is #_/ used. Located in the "Graphics\System" folder. #_/ #_/ ◆ change_message_back (filename) ◆ #_/ Changes the "Dim Background" messagebox image. #_/ Located in the "Graphics\System" folder. #_/ #_/ ◆ change_battle_transition (filename) ◆ #_/ Changes the transition image that normally executes before a battle. #_/ Located in the "Graphics\System" folder. #_/ #_/ ◆ change_battlefloor (filename) ◆ #_/ Change the floor image that is present in battle. #_/ Located in the "Graphics\System" folder. #_/ #_/ ◆ change_vehicle_shadow (filename) ◆ #_/ Change the shadow graphic for vehicles. #_/ Located in the "Graphics\System" folder. #_/ #_/ ◆ change_windowskin (filename) ◆ #_/ Change the WindowSkin cgraphic. #_/ Located in the "Graphics\System" folder. #_/ #_/ ◆ change_gameover_graphic (filename) ◆ #_/ Change the gameover screen. #_/ (You guessed it.) Located in the "Graphics\System" folder. #_/ #_/ Example: (In the Script Box) change_battle_transition ("VerticalScroll") #_/ #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ $imported = {} if $imported == nil $imported["OldEventCommands"] = true #============================================================================== # □ KGC::Commands #============================================================================== module KGC module Commands module_function #-------------------------------------------------------------------------- # ○ Remember_bgm #-------------------------------------------------------------------------- def remember_bgm $game_system.remembered_bgm = RPG::BGM.last end #-------------------------------------------------------------------------- # ○ Play_remembered_bgm #-------------------------------------------------------------------------- def play_remembered_bgm if $game_system.remembered_bgm != nil $game_system.remembered_bgm.play end end #-------------------------------------------------------------------------- # ○ Get_event_id (x, y [, variable_id ]) # x : マップの X 座標 # y : マップの Y 座標 # variable_id : 取得したイベント ID を代入する変数の ID #-------------------------------------------------------------------------- def get_event_id(x, y, variable_id = 0) event_id = 0 # Find event events = $game_map.events.values.find_all { |e| e.x == x && e.y == y } event_id = (events.max { |a, b| a.id <=> b.id }).id unless events.empty? # Assign variable if variable_id > 0 $game_variables[variable_id] = event_id $game_map.need_refresh = true end return event_id end #-------------------------------------------------------------------------- # ○ Prepare_transition #-------------------------------------------------------------------------- def prepare_transition $game_temp.transition_preparing = true end #-------------------------------------------------------------------------- # ○ Set_transition ([ duration [, filename [, vague ] ] ]) # duration : トランジションにかけるフレーム数 # filename : トランジション画像のファイル名 # vague : 境界のあいまいさ #-------------------------------------------------------------------------- def set_transition(duration = 30, filename = "", vague = 40) return if $game_temp.transition_processing # トランジション処理中 $game_temp.transition_set = true $game_temp.transition_name = filename $game_temp.transition_duration = duration $game_temp.transition_vague = vague end #-------------------------------------------------------------------------- # ○ unset_transition #-------------------------------------------------------------------------- def unset_transition $game_temp.transition_preparing = false $game_temp.transition_set = false $game_temp.transition_processing = false $game_temp.transition_name = "" $game_temp.transition_duration = 0 $game_temp.transition_vague = 0 end #-------------------------------------------------------------------------- # ○ change_balloon_icon(filename) # filename : トランジション画像のファイル名 #-------------------------------------------------------------------------- def change_balloon_icon(filename = nil) $game_system.balloon_icon = filename end #-------------------------------------------------------------------------- # ○ change_message_back(filename) # filename : トランジション画像のファイル名 #-------------------------------------------------------------------------- def change_message_back(filename = nil) $game_system.message_back = filename end #-------------------------------------------------------------------------- # ○ change_battle_transition(filename) # filename : トランジション画像のファイル名 #-------------------------------------------------------------------------- def change_battle_transition(filename = nil) $game_system.battle_transition = filename end #-------------------------------------------------------------------------- # ○ change_battlefloor(filename) # filename : トランジション画像のファイル名 #-------------------------------------------------------------------------- def change_battlefloor(filename = nil) $game_system.battlefloor = filename end #-------------------------------------------------------------------------- # ○ change_vehicle_shadow(filename) # filename : トランジション画像のファイル名 #-------------------------------------------------------------------------- def change_vehicle_shadow(filename = nil) $game_system.vehicle_shadow = filename end #-------------------------------------------------------------------------- # ○ change_windowskin(filename) # filename : トランジション画像のファイル名 #-------------------------------------------------------------------------- def change_windowskin(filename = nil) $game_system.windowskin = filename end #-------------------------------------------------------------------------- # ○ change_gameover_graphic(filename) # filename : トランジション画像のファイル名 #-------------------------------------------------------------------------- def change_gameover_graphic(filename = nil) $game_system.gameover_graphic = filename end end end class Game_Interpreter include KGC::Commands end #============================================================================== # ■ Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● Transition Processing #-------------------------------------------------------------------------- attr_accessor :transition_preparing # トランジション準備中フラグ attr_accessor :transition_set # トランジション設定済みフラグ attr_accessor :transition_processing # トランジション処理中フラグ attr_accessor :transition_name # トランジションファイル名 attr_accessor :transition_duration # トランジションのフレーム数 attr_accessor :transition_vague # トランジションのあいまいさ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_KGC_OldEventCommands initialize def initialize initialize_KGC_OldEventCommands @transition_preparing = false @transition_set = false @transition_processing = false @transition_name = "" @transition_duration = 0 @transition_vague = 0 end end #============================================================================== # ■ Game_System #============================================================================== class Game_System #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :remembered_bgm # 記憶した BGM attr_accessor :balloon_icon # フキダシアイコン attr_accessor :message_back # メッセージ背景 attr_accessor :battle_transition # 戦闘用トランジション attr_accessor :battlefloor # 戦闘画面床 attr_accessor :vehicle_shadow # 飛行船の影 attr_accessor :windowskin # ウィンドウスキン attr_accessor :gameover_graphic # ゲームオーバー画面 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_KGC_OldEventCommands initialize def initialize initialize_KGC_OldEventCommands @remembered_bgm = nil @balloon_icon = nil @message_back = nil @battle_transition = nil @battlefloor = nil @vehicle_shadow = nil @windowskin = nil @gameover_graphic = nil end end #============================================================================== # ■ Game_Interpreter #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● 画面のフェードアウト #-------------------------------------------------------------------------- alias command_221_KGC_OldEventCommands command_221 def command_221 if $game_temp.transition_preparing # トランジション準備中の場合 return false if $game_message.visible # メッセージ表示中 $game_temp.transition_preparing = false # 準備中フラグをクリア Graphics.freeze # 画面停止 return true else return command_221_KGC_OldEventCommands end end #-------------------------------------------------------------------------- # ● 画面のフェードイン #-------------------------------------------------------------------------- alias command_222_KGC_OldEventCommands command_222 def command_222 if $game_temp.transition_set # トランジション設定済みの場合 return false if $game_message.visible # メッセージ表示中 $game_temp.transition_set = false # 設定済みフラグをクリア $game_temp.transition_processing = true # 実行中フラグをセット @wait_count = $game_temp.transition_duration return true else return command_222_KGC_OldEventCommands end end end #============================================================================== # ■ Sprite_Character #============================================================================== class Sprite_Character < Sprite_Base #-------------------------------------------------------------------------- # ● フキダシアイコン表示の開始 #-------------------------------------------------------------------------- alias start_balloon_KGC_OldEventCommands start_balloon def start_balloon start_balloon_KGC_OldEventCommands if $game_system.balloon_icon != nil @balloon_sprite.bitmap = Cache.system($game_system.balloon_icon) end end end #============================================================================== # ■ Spriteset_Map #============================================================================== class Spriteset_Map #-------------------------------------------------------------------------- # ● 飛行船の影スプライトの作成 #-------------------------------------------------------------------------- alias create_shadow_KGC_OldEventCommands create_shadow def create_shadow create_shadow_KGC_OldEventCommands @vehicle_shadow_name = nil apply_vehicle_shadow end #-------------------------------------------------------------------------- # ○ 飛行船の影の変更を適用 #-------------------------------------------------------------------------- def apply_vehicle_shadow if @vehicle_shadow_name != $game_system.vehicle_shadow @vehicle_shadow_name = $game_system.vehicle_shadow filename = (@vehicle_shadow_name != nil ? @vehicle_shadow_name : "Shadow") @shadow_sprite.bitmap = Cache.system(file) end end #-------------------------------------------------------------------------- # ● 飛行船の影スプライトの更新 #-------------------------------------------------------------------------- alias update_shadow_KGC_OldEventCommands update_shadow def update_shadow apply_vehicle_shadow update_shadow_KGC_OldEventCommands end end #============================================================================== # ■ Spriteset_Battle #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● バトルフロアスプライトの作成 #-------------------------------------------------------------------------- alias create_battlefloor_KGC_OldEventCommands create_battlefloor def create_battlefloor create_battlefloor_KGC_OldEventCommands @battlefloor_name = nil apply_battlefloor end #-------------------------------------------------------------------------- # ○ バトルフロアの変更を適用 #-------------------------------------------------------------------------- def apply_battlefloor if @battlefloor_name != $game_system.battlefloor @battlefloor_name = $game_system.battlefloor filename = (@battlefloor_name != nil ? @battlefloor_name : "BattleFloor") @battlefloor_sprite.bitmap = Cache.system(filename) end end #-------------------------------------------------------------------------- # ● バトルフロアの更新 #-------------------------------------------------------------------------- alias update_battlefloor_KGC_OldEventCommands update_battlefloor def update_battlefloor apply_battlefloor update_battlefloor_KGC_OldEventCommands end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_KGC_OldEventCommands initialize def initialize(x, y, width, height) initialize_KGC_OldEventCommands(x, y, width, height) @windowskin_name = nil apply_windowskin end #-------------------------------------------------------------------------- # ○ ウィンドウスキンの変更を適用 #-------------------------------------------------------------------------- def apply_windowskin if $game_system != nil && @windowskin_name != $game_system.windowskin @windowskin_name = $game_system.windowskin filename = (@windowskin_name != nil ? @windowskin_name : "Window") self.windowskin = Cache.system(filename) end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias update_KGC_OldEventCommands update def update apply_windowskin update_KGC_OldEventCommands end end #============================================================================== # ■ Window_Message #============================================================================== class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ● 背景スプライトの更新 #-------------------------------------------------------------------------- alias update_back_sprite_KGC_OldEventCommands update_back_sprite def update_back_sprite apply_message_back update_back_sprite_KGC_OldEventCommands end #-------------------------------------------------------------------------- # ● 背景スプライトの作成 #-------------------------------------------------------------------------- alias create_back_sprite_KGC_OldEventCommands create_back_sprite def create_back_sprite create_back_sprite_KGC_OldEventCommands @message_back_name = nil apply_message_back end #-------------------------------------------------------------------------- # ○ 背景の変更を適用 #-------------------------------------------------------------------------- def apply_message_back if @message_back_name != $game_system.message_back @message_back_name = $game_system.message_back filename = (@message_back_name != nil ? @message_back_name : "MessageBack") @back_sprite.bitmap = Cache.system(filename) end end end #============================================================================== # ■ Scene_Map #============================================================================== class Scene_Map < Scene_Base #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias update_KGC_OldEventCommands update def update update_KGC_OldEventCommands # トランジション処理中の場合 if $game_temp.transition_processing process_transition end end #-------------------------------------------------------------------------- # ○ トランジション処理 #-------------------------------------------------------------------------- def process_transition $game_temp.transition_processing = false # トランジション実行 if $game_temp.transition_name == "" || $game_temp.transition_name == nil Graphics.transition(15) else Graphics.transition( $game_temp.transition_duration, "Graphics/System/#{$game_temp.transition_name}", $game_temp.transition_vague) end end #-------------------------------------------------------------------------- # ● 戦闘前トランジション実行 #-------------------------------------------------------------------------- def perform_battle_transition if $game_system.battle_transition != nil filename = $game_system.battle_transition else # Allows you to change the default transition. filename = "BattleStart" end Graphics.transition(80, "Graphics/System/#{filename}", 80) Graphics.freeze end end #============================================================================== # ■ Scene_Gameover #============================================================================== class Scene_Gameover < Scene_Base #-------------------------------------------------------------------------- # ● Create Gameover #-------------------------------------------------------------------------- alias create_gameover_graphic_KGC_OldEventCommands create_gameover_graphic def create_gameover_graphic create_gameover_graphic_KGC_OldEventCommands if $game_system.gameover_graphic != nil @sprite.bitmap = Cache.system($game_system.gameover_graphic) end end end