#============================================================================== # # ■ エネミー行動パターン改良 # 機能追加:アクター行動パターン化 □Ver2.10 □製作者:月紳士 # # ・RPGツクールVX用 RGSS2スクリプト # # ●…書き換えメソッド(競合注意) ◎…メソッドのエイリアス ○…新規メソッド # # ※二次配布禁止!配布元には利用規約があります。必ずそちらを見てください。 #------------------------------------------------------------------------------ # 更新履歴 # Ver2.10 ○「機能追加:二重行動」スクリプトの為の変更と仕様の見直し。 # Ver2.00 ○仕様の見直し。 #------------------------------------------------------------------------------ =begin ※このスクリプトは月紳士の「エネミー行動パターン改良」に  新たな機能を追加する拡張スクリプトです。   「エネミー行動パターン改良」(Ver8.00以降)が必要となります。  このスクリプトは「エネミー行動パターン改良」より下に挿入してください。 #------------------------------------------------------------------------------ このスクリプトを導入すると、エネミーの行動パターン処理を応用して、 アクターを行動パターンで動かすことが出来るようになります。 工夫次第で、擬似AIアクターを作ることが出来たり、 エネミーへの変身を表現したり出来ます。 行動指定はステートによって行います。 <エネミー行動参照:1>  もしくは <エネミー行動変化:1>  とメモ欄に書いたステートをアクターに付加してください。  1 の部分は任意のエネミーのIDを入れます。(半角数字)  これらステートにかかったアクターは、ステートにかかっている間  自動戦闘となり、ID指定したエネミーの行動パターンで行動します。  行動参照はアクターが習得しているスキルのみが行動に反映されます。  行動変化はアクターのスキル習得有無に関係なくスキルを使います。   ※ このタイプのステートが付加した時点、もしくは解除された時点で    未行動だった場合は、そのターンの行動はキャンセルされる仕様です。 ※ エネミーの行動をそのまま流用している関係で、   アクターには反映されない行動も出てきます。    行動種類によっては不具合もあるかもしれません。    不具合を起こす設定を避ける等の工夫もお願いします。 =end #============================================================================== # ■ RPG::State #============================================================================== class RPG::State #-------------------------------------------------------------------------- # ◎ 行動パターンステート判定 #-------------------------------------------------------------------------- alias tig_eac_aac_action_condition_state action_condition_state def action_condition_state return reference_enemy_action if reference_enemy_action return tig_eac_aac_action_condition_state end #-------------------------------------------------------------------------- # ○ ステート [エネミー行動参照] 判定 #-------------------------------------------------------------------------- def reference_enemy_action if (/[<<]エネミー行動参照[::](\d+)[>>]/) =~ @note return $1.to_i end return false end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ○ エネミー行動中のターゲット消失時の再行動タイプの取得 #-------------------------------------------------------------------------- def re_action_type for state in states.sort{|a, b| a.id <=> b.id} if state.action_condition_state note = $data_enemies[state.action_condition_state].note return 0 if note.include?("<無鉄砲>") return 1 if note.include?("<好戦的>") return 2 if note.include?("<慎重派>") return Extension_Action_Condition::RE_ACTION_TYPE_DEFAULT end end return Extension_Action_Condition::RE_ACTION_TYPE_DEFAULT end #-------------------------------------------------------------------------- # ● スキルの使用可能判定 # skill : スキル #-------------------------------------------------------------------------- def skill_can_use?(skill) return false if not skill_learn?(skill) and not not_learn_skill_can_use ## 変更部分 return super end #-------------------------------------------------------------------------- # ◎ 未収得スキルの使用許可 #-------------------------------------------------------------------------- alias tig_eac_aac_not_learn_skill_can_use not_learn_skill_can_use def not_learn_skill_can_use return true if action_condition_state_a_changing_type? return tig_eac_aac_not_learn_skill_can_use end #-------------------------------------------------------------------------- # ○ ステート [行動パターン] 判定 #-------------------------------------------------------------------------- def action_condition_state? for state in states return true if state.action_condition_state end return false end #-------------------------------------------------------------------------- # ○ ステート [行動パターン] が変身タイプか? #-------------------------------------------------------------------------- def action_condition_state_a_changing_type? for state in states if state.action_condition_state return state.changing_enemy_action end end return false end #-------------------------------------------------------------------------- # ○ 行動候補エネミー #-------------------------------------------------------------------------- def candidate_actions_enemy for state in states.sort{|a, b| a.id <=> b.id} if state.action_condition_state return $data_enemies[state.action_condition_state] end end return nil end #-------------------------------------------------------------------------- # ◎ オプション [自動戦闘] の取得 #-------------------------------------------------------------------------- alias tig_eac_aac_auto_battle auto_battle def auto_battle return true if action_condition_state? return tig_eac_aac_auto_battle end #-------------------------------------------------------------------------- # ◎ 戦闘行動の作成 (自動戦闘用) #-------------------------------------------------------------------------- alias tig_eac_aac_make_action make_action def make_action if action_condition_state? eac_make_action else tig_eac_aac_make_action end end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ◎ 戦闘行動の実行 : 逃走 # ※ アクター用の逃走動作を作成。 #-------------------------------------------------------------------------- alias tig_eac_aac_execute_action_escape execute_action_escape def execute_action_escape return tig_eac_aac_execute_action_escape unless @active_battler.actor? text = sprintf(Vocab::EscapeStart, @active_battler.name) if $game_party.existing_members.size == 1 Sound.play_escape @info_viewport.visible = false @message_window.visible = true $game_message.texts.push(text) wait_for_message return battle_end(1) # パーティーが逃走したアクターひとりならば戦闘終了 else # そうでなければ行動失敗 @message_window.add_instant_text(text) Sound.play_escape wait(20) @message_window.add_instant_text(Vocab::EscapeFailure) wait(45) end end end