Skip to content

Instantly share code, notes, and snippets.

@rutan
Created June 1, 2012 15:02
Show Gist options
  • Save rutan/2852767 to your computer and use it in GitHub Desktop.
Save rutan/2852767 to your computer and use it in GitHub Desktop.
各行動ごとに行動順を設定さん for RGSS3
# coding: utf-8
#===============================================================================
# ■ 各行動ごとに行動順を設定さん for RGSS3
#-------------------------------------------------------------------------------
# 2012/06/01 Ru/むっくRu
#-------------------------------------------------------------------------------
# 戦闘中の行動順序をバトラー順ではなく,各行動順の順番に行うようにします.
#-------------------------------------------------------------------------------
# 【わかりやすい?解説】
# デフォルトのシステムだと,例えば2回行動のキャラクターが
# 「通常攻撃(速度補正:0)」,「防御(速度補正:2000)」の
# 2つを選択した場合に,速度補正が低い側(通常攻撃)のほうに統一されてしまい,
# 防御がターンの最初に発動しません.
#
# このスクリプトでは,ターンの順番をキャラクターごとではなく,
# そのキャラクターの行動ごとに順番を設定することによって,
# 各行動ごとの速度補正を適用できるようにします.
#
# 例)
# エリック
# 素早さ: 30 行動:通常攻撃(速度補正:0),防御(速度補正:2000)
# スライム
# 素早さ:100 行動:通常攻撃(速度補正:0)
#
# ・デフォルトのシステムの場合
# スライム通常攻撃→エリック通常攻撃→エリック防御
#
# ・このスクリプト導入後
# エリック防御→スライム通常攻撃→エリック通常攻撃
#-------------------------------------------------------------------------------
# 【更新履歴】
# 2012/06/01 ぶっぱ
#-------------------------------------------------------------------------------
#==============================================================================
# ↓ 以下、スクリプト部 ↓
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# ● 行動順序の作成(再定義)
#--------------------------------------------------------------------------
def self.make_action_orders
all_actions = []
@action_battlers = []
unless @surprise
$game_party.members.each do |member|
member.make_speed
member.actions.each {|action| all_actions.push action }
end
end
unless @preemptive
$game_troop.members.each do |member|
member.make_speed
member.actions.each {|action| all_actions.push action }
end
end
all_actions.sort!{|a,b| b.speed - a.speed }
all_actions.each {|action| @action_battlers.push action.subject}
end
end
class Game_Battler < Game_BattlerBase
#-----------------------------------------------------------------------------
# ● 行動速度の決定(エイリアス)
#-----------------------------------------------------------------------------
alias hzm_vxa_makeActionOrdersEx_make_speed make_speed
def make_speed
hzm_vxa_makeActionOrdersEx_make_speed
@actions.sort! {|a,b| b.speed - a.speed } # アクションを順番にソート
end
end
class Scene_Battle < Scene_Base
#-----------------------------------------------------------------------------
# ● 戦闘行動の処理(エイリアス)
#-----------------------------------------------------------------------------
alias hzm_vxa_makeActionOrdersEx_process_action process_action
def process_action
hzm_vxa_makeActionOrdersEx_process_action
@subject = BattleManager.next_subject
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment