=begin スキル前コモン ver 0.1.0.0         by 半生 http://www.tktkgame.com/ http://www11.atpages.jp/namahanka/ スキル・アイテムの使用前にコモンイベントを実行します。 タイミング的にはスキル名等が出るよりも前です。 スキル・アイテムのメモ欄に「@前コモン32」のように @前コモン[コモンイベントID]の形で書くことで設定します。 ■ 他  ・下の方に配置した方が競合しにくいかもしれません。 ■ 更新履歴 ver 0.1.0.0 (2010/04/25)  公開。 =end class RPG::UsableItem REGEXP_BCOMMON = /@前コモン(\d+)/ # 使用前コモンイベントを設定する def setup_before_common if REGEXP_BCOMMON =~ self.note @before_common_id = $1.to_i else @before_common_id = 0 end end # 使用前コモンイベントのIDを取得する def before_common_id setup_before_common if @before_common_id.nil? return @before_common_id end end class Scene_Battle # 特定行動前に設定されたコモンイベントを実行する def execute_ce_before_sp_action(action) return if @active_battler.action.forcing case action when :skill before_common_id = @active_battler.action.skill.before_common_id when :item before_common_id = @active_battler.action.item.before_common_id else before_common_id = 0 end if before_common_id > 0 and !$game_troop.interpreter.running? $game_temp.common_event_id = before_common_id temp_active_battler = @active_battler process_battle_event @active_battler = temp_active_battler end end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 : スキル #-------------------------------------------------------------------------- alias :_hn_bce__execute_action_skill :execute_action_skill unless method_defined?(:_hn_bce__execute_action_skill) def execute_action_skill execute_ce_before_sp_action(:skill) # 行動不能になっていたら中断 return unless @active_battler.action.valid? _hn_bce__execute_action_skill end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 : アイテム #-------------------------------------------------------------------------- alias :_hn_bce__execute_action_item :execute_action_item unless method_defined?(:_hn_bce__execute_action_item) def execute_action_item execute_ce_before_sp_action(:item) # 行動不能になっていたら中断 return unless @active_battler.action.valid? _hn_bce__execute_action_item end end