# # 特殊選択ウインドウ表示(RGSS2) #  (C)2008 TYPE74RX-T&サポート専用スレ>>7さん # # ★ カスタマイズポイント:15~17行目 # # 改造箇所 #・メッセージウインドウの全文字列の描画が終了するまで操作を無効に。 #・選択肢ウインドウ消去のタイミングをメッセージ消去のタイミングと擬似的に同一に。 #・項目決定時に強制的に文章送りをするように。 #============================================================================== # ★ RX_T_SelectWindow #------------------------------------------------------------------------------ #  特殊な選択ウインドウを表示するためのモジュールです。 #============================================================================== module RX_T_SelectWindow RX2c7_Width = 160 # 特殊選択ウインドウの幅 RX2c7_X = 384 # 特殊選択ウインドウの表示座標(X軸) RX2c7_Y = 0 # 特殊選択ウインドウの表示座標(Y軸) #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super @rx_select_window = Window_Command.new(RX2c7_Width, $game_temp.rx_sel_commands) @rx_select_window.x = RX2c7_X @rx_select_window.y = RX2c7_Y @rx_select_window.active = false @rx_select_window.visible = false @rx2c7_copy_commands = $game_temp.rx_sel_commands.dup end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super @rx_select_window.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # 特殊選択ウインドウ表示フラグが立っていたら if $game_message.visible and $game_temp.rx_sel_command # コマンド内容が変化していればリメイク unless @rx2c7_copy_commands == $game_temp.rx_sel_commands @rx2c7_copy_commands = $game_temp.rx_sel_commands.dup @rx_select_window.dispose @rx_select_window = Window_Command.new(RX2c7_Width, $game_temp.rx_sel_commands) @rx_select_window.x = RX2c7_X @rx_select_window.y = RX2c7_Y end # コマンドを出現させる @rx_select_window.active = true @rx_select_window.visible = true # メッセージの全ての文字列が表示終了後に選択を開始する unless $game_temp.rx_select_window_open @rx_select_window.update update_rx_select_window end end # 終了フラグが立っていればウインドウを消去 if $game_temp.rx_select_window_close @rx_select_window.active = false @rx_select_window.visible = false $game_temp.rx_select_window_close = false end end #-------------------------------------------------------------------------- # ★ 特殊選択ウインドウ表示 #-------------------------------------------------------------------------- def update_rx_select_window if Input.trigger?(Input::B) $game_temp.rx_sel_command = false Sound.play_cancel # キャンセル時は選択結果を 0 に $game_variables[$game_temp.rx_sel_variables] = 0 # メッセージウインドウ送りフラグをオン $game_temp.rx_select_window_skip = true elsif Input.trigger?(Input::C) $game_temp.rx_sel_command = false Sound.play_decision # 指定の変数に選択結果を代入 $game_variables[$game_temp.rx_sel_variables] = @rx_select_window.index + 1 # メッセージウインドウ送りフラグをオン $game_temp.rx_select_window_skip = true end end end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :rx_select_window_open # 選択ウインドウ表示開始中フラグ attr_accessor :rx_select_window_close # 選択ウインドウ消去フラグ attr_accessor :rx_select_window_skip # 特殊選択後のメッセージ送りフラグ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias rx_rgss2c7_initialize initialize def initialize # メソッドを呼び戻す rx_rgss2c7_initialize # ★ 特殊選択ウインドウ表示フラグ @rx_sel_command = false # ★ 特殊選択肢 @rx_sel_commands = [] # ★ 特殊選択ウインドウの選択結果を格納する変数番号 @rx_sel_variables = 1 # ★ 特殊選択ウインドウの選択結果を格納する変数番号 @rx_sel_variables = 1 # ★ 特殊選択ウインドウの表示開始中フラグ @rx_select_window_open = false # ★ 特殊選択ウインドウの消去フラグ @rx_select_window_close = false # ★ 特殊選択後のメッセージ送りフラグ @rx_select_window_skip = false end #-------------------------------------------------------------------------- # ★ 特殊選択ウインドウ表示フラグ #-------------------------------------------------------------------------- def rx_sel_command return @rx_sel_command end #-------------------------------------------------------------------------- # ★ 特殊選択ウインドウ表示フラグの設定 #-------------------------------------------------------------------------- def rx_sel_command=(judge) @rx_sel_command = judge end #-------------------------------------------------------------------------- # ★ 特殊選択肢 #-------------------------------------------------------------------------- def rx_sel_commands return @rx_sel_commands end #-------------------------------------------------------------------------- # ★ 特殊選択肢の設定 #-------------------------------------------------------------------------- def rx_sel_commands=(commands) @rx_sel_commands = commands end #-------------------------------------------------------------------------- # ★ 特殊選択ウインドウの選択結果を格納する変数番号 #-------------------------------------------------------------------------- def rx_sel_variables return @rx_sel_variables end #-------------------------------------------------------------------------- # ★ 特殊選択ウインドウの選択結果を格納する変数番号の設定 #-------------------------------------------------------------------------- def rx_sel_variables=(variables) @rx_sel_variables = variables end end #============================================================================== # ■ Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_System クラ # スや Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ★ 注釈 #-------------------------------------------------------------------------- alias rx_rgss2c7_command_108 command_108 def command_108 # 特殊選択肢表示 if @parameters[0].include?("特殊選択肢:") # 選択結果を格納する変数番号の取得と決定 rx_int = rx_get_str_arrays(@parameters[0]) $game_temp.rx_sel_variables = rx_int[0] # 特殊選択ウインドウ表示フラグをオン $game_temp.rx_sel_command = true # 特殊選択ウインドウ表示表示開始中フラグオン $game_temp.rx_select_window_open = true # コマンドを含めた注釈の内容を全取得 str1 = rx_get_all_parameter(@parameters[0]) # コマンドから先の文字列を全取得 str2 = rx_get_all_str(str1, "特殊選択肢:") # アクター名を表示する場合の処理 strray = rx_get_str_strrays(str2) # 変数指定部分の要素を削除 strray.delete_at(0) for i in 0...strray.size if strray[i].include?("actorID") # 注釈から数字の文字列のみ取得し、数字の配列として返す name_id = rx_get_str_arrays(strray[i]) # 指定ミスを指摘する(0) if name_id[0] == 0 print "指定のアクターIDが 0 です。" exit end # 指定ミスを指摘する(設定数を超えた場合) if name_id[0] >= $data_actors.size print "設定されていないアクターID " + name_id[0].to_s + " を指定しています。" exit end # アクター名を発言者名に代入(IDは直接指定値に依存) strray[i] = $game_actors[name_id[0]].name end if strray[i].include?("Vactor") # 注釈から数字の文字列のみ取得し、数字の配列として返す var_id = rx_get_str_arrays(strray[i]) # 指定ミスを指摘する(0) if $game_variables[var_id[0]] == 0 print "指定のアクターIDが 0 です。" exit end # 指定ミスを指摘する(設定数を超えた場合) if $game_variables[var_id[0]] >= $data_actors.size print "設定されていないアクターID " + $game_variables[var_id[0]].to_s + " を指定しています。" exit end # アクター名を発言者名に代入(IDは変数の内容に依存) strray[i] = $game_actors[$game_variables[var_id[0]]].name end end # コマンドを含めた注釈の内容から文字列のみ抜き出したものを配列化 $game_temp.rx_sel_commands = strray # 継続(競合対策) return true end # メソッドを呼び戻す rx_rgss2c7_command_108 end end #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ #  ゲーム中のすべてのウィンドウのスーパークラスです。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● ウィンドウを閉じる #-------------------------------------------------------------------------- alias rx_select_window_close close def close # ウインドウを閉じる際に選択肢ウインドウ消去フラグを立てる $game_temp.rx_select_window_close = true # メソッドを呼び戻す rx_select_window_close end end #============================================================================== # ■ Window_Message #------------------------------------------------------------------------------ #  文章表示に使うメッセージウィンドウです。 #============================================================================== class Window_Message < Window_Selectable #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias rx_select_window_update update def update # メソッドを呼び戻す rx_select_window_update # 全ての文字が表示完了していて選択肢表示中なら開始中フラグをオフにする if $game_temp.rx_select_window_open && @text == nil $game_temp.rx_select_window_open = false end # 選択ウインドウメッセージ送りフラグがオンならメッセージを送りをする if $game_temp.rx_select_window_skip self.pause = false if @text != nil and not @text.empty? new_page if @line_count >= MAX_LINE else terminate_message end # フラグを初期化 $game_temp.rx_select_window_skip = false end end #-------------------------------------------------------------------------- # ● 改ページ処理 #-------------------------------------------------------------------------- alias rx_select_window_new_page new_page def new_page # 改ページ時に選択肢ウインドウ消去フラグを立てる $game_temp.rx_select_window_close = true # メソッドを呼び戻す rx_select_window_new_page end end #============================================================================== # ■ Scene_Map #------------------------------------------------------------------------------ #  マップ画面の処理を行うクラスです。 #============================================================================== class Scene_Map < Scene_Base include RX_T_SelectWindow end