#============================================================================== # ★ ExEscape ver1.0 by USK #------------------------------------------------------------------------------ # ・逃げるコマンドの文言をゲーム中任意に変更可能にし、コモンイベント化します # ・逃げるの成功確率を変数に代入可能にします #============================================================================== =begin 33行目のEscapeNameIdで設定した番号の変数に、イベントコマンド変数の操作のスクリプ ト等で、"追い払う" のように文字列を代入するとその文字列が逃げるコマンドの文言 になります。変数が文字列ではなく数値のときはデフォルトの文言が適応されます。 32行目のEscapeCommonIdで設定した番号のコモンイベントが逃げるコマンドを選択したと きに実行されます。独自の逃走可能判定や、変更した逃げるコマンドの文言に適した結果 を実行するためにあります。「バトルの中断」のイベントコマンドで戦闘終了です。 イベントコマンドや変数の操作等のスクリプト内で、escape_ratioと記述すると現在の 逃走確率を取得できます。 イベントコマンドのスクリプト内で、set_escape_ratio(数値)と記述すると逃走確率を ()内の数値に設定できます。 例 set_escape_ratio(20) イベントコマンドのスクリプト内で、add_escape_ratio(数値)と記述すると逃走確率を 現在の値から()内の数値だけ変化させることができます。 例 add_escape_ratio(-20) =end #============================================================================== # ■ USK #============================================================================== module USK EscapeCommonId = 5 #逃げるコマンド選択時に実行されるコモンイベントの番号 EscapeNameId = 1 #逃げるコマンドの名前を格納する変数の番号 end #============================================================================== # ■ BattleManager #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def self.escape_ratio @escape_ratio end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def self.escape_ratio=(val) @escape_ratio = val end end #============================================================================== # ■ Vocab #============================================================================== module Vocab class << self; alias :usk_ex_escape :escape; end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def self.escape if $game_variables[USK::EscapeNameId].is_a?(String) $game_variables[USK::EscapeNameId] else usk_ex_escape end end end #============================================================================== # ■ Game_Interpreter #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def escape_ratio (BattleManager.escape_ratio * 100).to_i end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def add_escape_ratio(val) BattleManager.escape_ratio += val * 0.01 end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def set_escape_ratio(val) BattleManager.escape_ratio = val * 0.01 end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● コマンド[逃げる] #-------------------------------------------------------------------------- alias :usk_ex_command_escape :command_escape def command_escape USK::EscapeCommonId > 0 ? process_ex_escape : usk_ex_command_escape end #-------------------------------------------------------------------------- # ● #-------------------------------------------------------------------------- def process_ex_escape $game_temp.reserve_common_event(USK::EscapeCommonId) $game_party.clear_actions while !scene_changing? $game_troop.interpreter.update $game_troop.setup_battle_event wait_for_message wait_for_effect if $game_troop.all_dead? process_forced_action BattleManager.judge_win_loss break unless $game_troop.interpreter.running? end turn_start end end