#============================================================================ # # ■アクターアイテムを Menu に □Ver1.04b □製作者:月紳士 # ・RPGツクールVX用 RGSS2スクリプト # # ●…書き換えメソッド(競合注意) ◎…メソッドのエイリアス ○…新規メソッド # #============================================================================ =begin  このスクリプトは月紳士のスクリプト【アクター毎のアイテム所持】を  メニュー画面に反映させる為の別スクリプトです。  このスクリプト単体では機能しません。  【アクター毎のアイテム所持】をこのスクリプト無しで使う為には  Scene_Item と Scene_Equip の替わりに、  【アクター毎のアイテム所持】が新設した Scene_Actor_Item を  別途、メニューに組み込む改変が必要になります。 合わせて、 ・アイテムやスキル画面からメニューに戻った際の挙動の修正   通常だとメニュー選択に戻ってしまうのを   アクター選択に戻るような設定を選択可に ・パーティーがひとりの際の挙動を修正   アクター選択をせず、ダイレクトに各シーンへ飛ぶように修正  なども行っています。  このスクリプトでは、メニューコマンドを Window_Transforms_Command という  編集に強い自作ウインドウを元に作り直しています。  (Window_Transforms_Command は【アクター毎のアイテム所持】に掲載) =end #============================================================================== # □ カスタマイズ項目 #============================================================================== module Actor_Item_Menu VALUABLES_NAME = "貴重品" # メニューへ表示するウインドウ名。 USE_VALUABLES = true # 貴重品ウインドウをメニューに表示するか? RETRUN_ACTOR_SERECT = false # 各項目からメニューに戻った際にアクター選択に戻す end #============================================================================== # □ Window_Menu_Command #------------------------------------------------------------------------------ #  メニュー画面のコマンドウインドウです。 #============================================================================== class Window_Menu_Command < Window_Transforms_Command #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y) super(x, y, 128) end #-------------------------------------------------------------------------- # ○ コマンド作成(テキストカスタマイズ可能部分) #-------------------------------------------------------------------------- def create_command_original super @commands[0] = Vocab::item @commands[1] = Vocab::skill @commands[2] = Actor_Item_Menu::VALUABLES_NAME @commands[3] = Vocab::status @commands[4] = Vocab::save @commands[5] = Vocab::game_end end #-------------------------------------------------------------------------- # ○ コマンド表示条件 #-------------------------------------------------------------------------- def command_display?(command_number) case command_number when 2 return Actor_Item_Menu::USE_VALUABLES end return true end #-------------------------------------------------------------------------- # ○ コマンド選択の条件 #-------------------------------------------------------------------------- def command_enabled?(command_number) if $game_party.members.size == 0 # パーティ人数が 0 人の場合 return false if command_number == 0 # アイテムを無効化 return false if command_number == 1 # スキルを無効化 return false if command_number == 3 # ステータスを無効化 end if $game_system.save_disabled # セーブ禁止の場合 return false if command_number == 4 # セーブを無効化 end return true end end #============================================================================== # ■ Scene_Actor_Item #------------------------------------------------------------------------------ #  装備画面の処理を行うクラスです。 #============================================================================== class Scene_Actor_Item < Scene_Base #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(0, true) end end #============================================================================== # ■ Scene_Skill #------------------------------------------------------------------------------ #  スキル画面の処理を行うクラスです。 #============================================================================== class Scene_Skill < Scene_Base #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(1, true) end end #============================================================================== # ■ Scene_Item #------------------------------------------------------------------------------ #  アイテム画面の処理を行うクラスです。 #============================================================================== class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(2) end end #============================================================================== # ■ Scene_Status #------------------------------------------------------------------------------ #  ステータス画面の処理を行うクラスです。 #============================================================================== class Scene_Status < Scene_Base #-------------------------------------------------------------------------- # ● 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Menu.new(3, true) end end #============================================================================== # ■ Scene_Menu #------------------------------------------------------------------------------ #  メニュー画面の処理を行うクラスです。 #============================================================================== class Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 # menu_index : コマンドのカーソル初期位置 #-------------------------------------------------------------------------- def initialize(menu_index = 0, back = false) @menu_index = menu_index @back = back # 追加 他シーンから戻ってきたかを判別する $game_party.last_actor_index = 0 unless back end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- alias tig_ais_start start def start tig_ais_start if @back and $game_party.members.size != 1 and Actor_Item_Menu::RETRUN_ACTOR_SERECT start_actor_selection # アクター選択に戻す end end #-------------------------------------------------------------------------- # ● コマンドウィンドウの作成 #-------------------------------------------------------------------------- def create_command_window @command_window = Window_Menu_Command.new(0, 0) @menu_index = @command_window.order.index(@menu_index) @command_window.index = @menu_index end #-------------------------------------------------------------------------- # ● コマンド選択の更新 #-------------------------------------------------------------------------- def update_command_selection if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) case @command_window.select # indexでなくselectに変更 when 0,1,3 # アイテム、スキル、ステータス if $game_party.members.size == 0 Sound.play_buzzer return elsif $game_party.members.size == 1 # ひとりの時、ダイレクト処理 Sound.play_decision case @command_window.select # indexでなくselectに変更 when 0 # アイテム $scene = Scene_Actor_Item.new when 1 # スキル $scene = Scene_Skill.new when 3 # ステータス $scene = Scene_Status.new end else # 複数人の場合はアクター選択へ Sound.play_decision start_actor_selection end when 2 # 貴重品 Sound.play_decision $scene = Scene_Item.new when 4 # セーブ Sound.play_decision $scene = Scene_File.new(true, false, false) when 5 # ゲーム終了 Sound.play_decision $scene = Scene_End.new end end end #-------------------------------------------------------------------------- # ● アクター選択の更新 #-------------------------------------------------------------------------- def update_actor_selection if Input.trigger?(Input::C) $game_party.last_actor_index = @status_window.index Sound.play_decision if Input.trigger?(Input::C) case @command_window.select # indexでなくselectに変更 when 0 # アイテム $scene = Scene_Actor_Item.new(@status_window.index) when 1 # スキル $scene = Scene_Skill.new(@status_window.index) when 3 # ステータス $scene = Scene_Status.new(@status_window.index) end elsif Input.trigger?(Input::B) Sound.play_cancel $game_party.last_actor_index = @status_window.index end_actor_selection end end end