#◆◇◆◇◆ ☆ ダブルコモンイベント ver 1.00 ◇◆◇◆◇ # ☆ マスタースクリプト ver 2.00 以降専用 # サポート掲示板 http://www2.ezbbs.net/21/minto-aaa/ # by みんと =begin 説明 XPのデフォルトでは、 スキルとアイテムのコモンイベントは使用した後で固定されています。 そこを、使用前と使用後の両方にコモンイベントを設定できるようにします。 使用後はデフォルトの機能を使用します。 出来るだけ、Main に近い位置に導入してください。 なお、フロントコモンイベントは戦闘専用です。 =end #============================================================================== # ☆ MINTO #------------------------------------------------------------------------------ # 様々なフラグを扱うメインモジュールです。 #============================================================================== module MINTO # ダブルコモンイベントを有効化 ( true で有効 / false で無効 ) RGSS["Double_Commonevent"] = true end #============================================================================== # ☆ カスタマイズ #------------------------------------------------------------------------------ # 機能のカスタマイズを行うモジュールです。 #============================================================================== module MINTO # スキルのフロントコモンイベント # Front_Common_Event_Skill[スキルID] = 発動させたいイベントID Front_Common_Event_Skill = [] Front_Common_Event_Skill[1] = 1 # アイテムのフロントコモンイベント # Front_Common_Event_Item[アイテムID] = 発動させたいイベントID Front_Common_Event_Item = [] Front_Common_Event_Item[1] = 3 end if MINTO::RGSS["Double_Commonevent"] #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :new_common_event # コモンイベント制御用 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_Double_Commonevent initialize def initialize # 元の処理を実行 initialize_Double_Commonevent new_common_event = false end end #============================================================================== # ■ Scene_Battle (分割定義 2) #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● アフターバトルフェーズ開始 #-------------------------------------------------------------------------- alias start_phase5_Double_Commonevent start_phase5 def start_phase5 # コモンイベントフラグがオンの場合は終了 return if $game_temp.new_common_event # 元の処理を実行 start_phase5_Double_Commonevent end end #============================================================================== # ■ Scene_Battle (分割定義 4) #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備) #-------------------------------------------------------------------------- alias update_phase4_step1_Double_Commonevent update_phase4_step1 def update_phase4_step1 # 元の処理を実行 update_phase4_step1_Double_Commonevent # コモンイベントフラグをクリア $game_temp.new_common_event = false end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始) #-------------------------------------------------------------------------- alias update_phase4_step2_Double_Commonevent update_phase4_step2 def update_phase4_step2 # 元の処理を実行 update_phase4_step2_Double_Commonevent # コモンイベントIDを初期化 new_common_event_id = 0 # フロントコモンイベントが未設定の場合 if !$game_temp.new_common_event # 行動がスキルの場合 if @active_battler.current_action.skill_id != 0 # スキルが存在する場合 if @skill != nil # 現在のスキルIDと行動者のスキルIDが一致した場合 if @skill.id == @active_battler.current_action.skill_id # コモンイベントIDを設定 id = MINTO::Front_Common_Event_Skill[@skill.id].to_i new_common_event_id = id end end # それ以外で行動がアイテムの場合 elsif @active_battler.current_action.kind == 2 # コモンイベントIDを設定 id = MINTO::Front_Common_Event_Item[@item.id].to_i new_common_event_id = id end # コモンイベントIDが有効の場合 if new_common_event_id > 0 # コモンイベントフラグをオン $game_temp.new_common_event = true # コモンイベントをセットアップ front_common_event = Data_Common_Events.data[new_common_event_id] $game_system.battle_interpreter.setup(front_common_event.list, 0) end end end #-------------------------------------------------------------------------- # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ) #-------------------------------------------------------------------------- alias update_phase4_step6_Double_Commonevent update_phase4_step6 def update_phase4_step6 # 元の処理を実行 update_phase4_step6_Double_Commonevent # スキルをクリア @skill = nil @active_battler.current_action.skill_id = 0 # アイテムをクリア @item = nil # 存在しない敵の数 exist = 0 for enemy in $game_troop.enemies if !enemy.exist? exist += 1 end end # 敵を全て倒していればコモンイベントフラグをクリア if exist == $game_troop.enemies.size $game_temp.new_common_event = false end end end end