Side-view with walking sprite & Active Time Battle from para.j-mx.com

These scripts are ATB and its add-on scripts from ParaSite2D6 RPG Manor.


1. Side-view with walking sprite
It uses your-typical-actor-sprite as actor battler, instead of animated ones. Basically, it's for side-view, but you can make it like front, or rear-view. It's not a CBS itself, so you can try it with other CBS scripts. I can tell you it works with RMXP default battle and its author's ATB, but may not work with some CBS.
Content Hidden Spoiler
#==============================================================================
# ++ サイドビューバトル(歩行グラフィック版) ver. 1.14 ++
#  Script by パラ犬
#  http://para.j-mx.com/
#------------------------------------------------------------------------------
# バトルフィールドに歩行グラフィックを表示します。
#==============================================================================

module SDVA
 
  X_LINE = 500        # 横位置のバトラー表示座標
  Y_LINE = 200        # 縦位置のバトラー表示座標
  X_SPACE = 15        # 横位置のバトラー同士の間隔
  Y_SPACE = 40        # 縦位置のバトラー同士の間隔
  X_POSITION = 25     # 隊列[前衛・中衛・後衛]の横間隔
  Y_POSITION = 0      # 隊列[前衛・中衛・後衛]の縦間隔
 
  ATTACK_MOVE = true  # 攻撃時に前へ踏み出すか( true / false )
  SKILL_MOVE = true   # スキル使用時に前へ踏み出すか( true / false )
  ITEM_MOVE = false   # アイテム使用時に前へ踏み出すか( true / false )
  MOVE_STEP = 1       # 移動歩数
  MOVE_PIXEL = 10     # 一歩あたりのピクセル数
 
  PARTY_POS = 1       # キャラクターの向き( 0:下 / 1:å·¦ / 2:右 / 3:上 )

  WINDOWPOS_CHANGE = true   # コマンドウインドウをバトラーの横に表示するか( true / false )

  end
 
#==============================================================================
# â–  Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● バトル画面 X 座標の取得
  #--------------------------------------------------------------------------
  def screen_x
    if self.index != nil
      # 隊列を取得
      pos = $data_classes[self.class_id].position
      x_pos = pos * SDVA::X_POSITION
      scr_x = self.index * SDVA::X_SPACE + SDVA::X_LINE + x_pos
      # 移動アクションのとき
      if self.current_action.move_action == true
        # 横に移動
        scr_x += @shift_x
      end
      return scr_x
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 Y 座標の取得
  #--------------------------------------------------------------------------
  def screen_y
    if self.index != nil
      # 隊列を取得
      pos = $data_classes[self.class_id].position
      y_pos = pos * SDVA::Y_POSITION
      scr_y = self.index * SDVA::Y_SPACE + SDVA::Y_LINE + y_pos
      # 移動アクションのとき
      if self.current_action.move_action == true
        # 縦に移動
        scr_y += @shift_y
      end
      return scr_y
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ● バトル画面 Z 座標の取得
  #--------------------------------------------------------------------------
  def screen_z
    if self.index != nil
      return self.index
    else
      return 0
    end
  end
end

#==============================================================================
# ■ Game_Battler (分割定義 1)
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :pattern        # 歩行パターン
  attr_reader   :trans_x        # X方向の移動距離
  attr_reader   :moving         # 移動中フラグ
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_sdva initialize
  def initialize
    initialize_sdva
    move_reset
  end
  #--------------------------------------------------------------------------
  # â—‹ 移動カウント
  #--------------------------------------------------------------------------
  def move
    @moving = 1
      if @step < SDVA::MOVE_STEP
        # 歩数を満たすまで移動
        @pattern = (@pattern + 1) % 4
        @step += 1
        move_step
      else
        # 移動終了
        @pattern = 1
        @moving = 2
      end
  end
  #--------------------------------------------------------------------------
  # â—‹ 移動処理
  #--------------------------------------------------------------------------
  def move_step
  # パーティの向きによって移動座標を変える
  case SDVA::PARTY_POS
    when 0
      @shift_y = @step * SDVA::MOVE_PIXEL
    when 1
      @shift_x = -(@step * SDVA::MOVE_PIXEL)
    when 2
      @shift_x = @step * SDVA::MOVE_PIXEL
    when 3
      @shift_y = -(@step * SDVA::MOVE_PIXEL)
    end       
  end
  #--------------------------------------------------------------------------
  # â—‹ 移動のリセット
  #--------------------------------------------------------------------------
  def move_reset
    @moving = 0
    @pattern = 0
    @step = 0
    @shift_x = 0
    @shift_y = 0
  end
end

#==============================================================================
# â–  Game_BattleAction
#==============================================================================

class Game_BattleAction
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :move_action             # 移動するアクションか
  #--------------------------------------------------------------------------
  # ● クリア
  #--------------------------------------------------------------------------
  alias clear_sdva clear
  def clear
    clear_sdva
    @move_action = false
  end
end

#==============================================================================
# â–  Sprite_Battler
#==============================================================================

class Sprite_Battler < RPG::Sprite
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_sdva update
  def update
    # バトラーがアクターに含まれるとき
    if @battler.is_a?(Game_Actor)
      # ファイル名か色相が現在のものと異なる場合
      # 行動中の場合
      if @battler.battler_name != @battler_name or
         @battler.battler_hue != @battler_hue or
         @battler.current_action.basic == 0 or
         @battler.current_action.kind != 3
        # ビットマップを取得、設定
        @character_name = @battler.character_name
        @character_hue = @battler.character_hue
        # 歩行グラフィックを描画
        self.bitmap = RPG::Cache.character(@character_name, @character_hue)
        cw = self.bitmap.width / 4
        ch = self.bitmap.height / 4
        @width = cw
        @height = ch
        if @battler.current_action.move_action == true
          # 歩かせる
          @battler.move
        else
          @battler.move_reset
        end
        # 転送元の矩形を設定
        sx = @battler.pattern * cw
        sy = SDVA::PARTY_POS * ch
        self.src_rect.set(sx, sy, cw, ch)
        self.ox = @width / 2
        self.oy = @height
        # 隠れ状態なら不透明度を 0 にする
        if @battler.hidden
          self.opacity = 0
        end
      end
    end
    update_sdva
  end
end
 
#==============================================================================
# â–  Scene_Battle
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● アクターコマンドウィンドウのセットアップ
  #--------------------------------------------------------------------------
  alias phase3_setup_command_window_sdva phase3_setup_command_window
  def phase3_setup_command_window
    phase3_setup_command_window_sdva
    if SDVA::WINDOWPOS_CHANGE
      # アクターコマンドウィンドウの位置を設定
      case SDVA::PARTY_POS
        when 0
          x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
          y_pos = @active_battler.screen_y
        when 1
          x_pos = @active_battler.screen_x - @actor_command_window.width - 16
          y_pos = @active_battler.screen_y - @actor_command_window.height
        when 2
          x_pos = @active_battler.screen_x + 16
          y_pos = @active_battler.screen_y - @actor_command_window.height
        when 3
          x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
          y_pos = @active_battler.screen_y - @actor_command_window.height - 48
      end
      @actor_command_window.x = x_pos >= 0 ? x_pos : 0
      @actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width
      @actor_command_window.y = y_pos >= 0 ? y_pos : 0
      @actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height
      # ステータスウインドウに隠れないように
      @actor_command_window.z = 9999
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  #--------------------------------------------------------------------------
  alias update_phase4_step3_sdva update_phase4_step3
  def update_phase4_step3
    if SDVA::ATTACK_MOVE
      if @active_battler.current_action.basic == 0
        @active_battler.current_action.move_action = true
      end
    end
    if SDVA::SKILL_MOVE
      if @active_battler.current_action.kind == 1
        @active_battler.current_action.move_action = true
      end
    end
    if SDVA::ITEM_MOVE
      if @active_battler.current_action.kind == 2
        @active_battler.current_action.move_action = true
      end
    end
    # バトラーがアクターに含まれ、移動アクション中
    if @active_battler.is_a?(Game_Actor) and
     @active_battler.current_action.move_action
      # 移動終了時
      if @active_battler.moving == 2
        update_phase4_step3_sdva
      end
    elsif @active_battler.moving == 0
      update_phase4_step3_sdva
    end
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  #--------------------------------------------------------------------------
  alias update_phase4_step6_sdva update_phase4_step6
  def update_phase4_step6
    @active_battler.current_action.move_action = false
    @active_battler.move_reset
    update_phase4_step6_sdva
  end
end

#==============================================================================
# â–  Spriteset_Battle
#==============================================================================

class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_sdva initialize
  def initialize
    initialize_sdva
    @viewport2.z = 1
  end
end

#==============================================================================
# â–  Arrow_Actor
#==============================================================================

class Arrow_Actor < Arrow_Base
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_sdva update
  def update
    update_sdva
    # カーソル下
    if Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      @index += 1
      @index %= $game_party.actors.size
    end
    # カーソル上
    if Input.repeat?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      @index += $game_party.actors.size - 1
      @index %= $game_party.actors.size
    end
  end
end

#==============================================================================
# â–  Arrow_Enemy
#==============================================================================

class Arrow_Enemy < Arrow_Base
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias update_sdva update
  def update
    update_sdva
    # カーソル下
    if Input.repeat?(Input::DOWN)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
        @index += 1
        @index %= $game_troop.enemies.size
        break if self.enemy.exist?
      end
    end
    # カーソル上
    if Input.repeat?(Input::UP)
      $game_system.se_play($data_system.cursor_se)
      $game_troop.enemies.size.times do
        @index += $game_troop.enemies.size - 1
        @index %= $game_troop.enemies.size
        break if self.enemy.exist?
      end
    end
  end
end
Expand to see the code.



2. Active Time Battle
http://para.j-mx.com/rgss/script/ctb.html
It's a typical ATB, like SNES FF series. It works with Side-view script above, Side-view battle from RGSS Wiki, and RM2k3 style Side-view by RaiseField.
[spoiler]
[code]
#==============================================================================
# ++ アクティブタイムバトル ver. 2.56 ++
#  Script by パラ犬
#  http://para.j-mx.com/
#------------------------------------------------------------------------------
# CTゲージが溜まったバトラーから順にコマンド入力する戦闘形式。
# バトルステータス画面をサイドビューらしくする機能もあります。
# バトラーをサイドビュータイプに表示するスクリプトは、お好きなものを
# 用意してください。
#------------------------------------------------------------------------------
#[設置上の注意]
# できるだけリストの上のほうに置いてください。(Scene_Debugよりは下)
#------------------------------------------------------------------------------
#[操作]
#・逃走
# 味方バトラーの一人以上がコマンド入力待ちのときにキャンセルボタンを押すことで
# 「逃げる」コマンドが選択できます。
# 敵の数が多かったり、コマンド入力待ちのバトラーが少ないと、
# 逃走成功率が低くなります。
#
#・行動順の入れ替え
# 複数のバトラーが行動可能のとき、
# Rボタン(PageDownキー)で次のバトラーと順番を入れ替え、
# Lボタン(PageUpキー)で行動順をいちばん最後に回します。
#==============================================================================

module PARA_CTB

# コマンド入力時にCTのカウントを止めるか(true:止める / false:止めない)
COMMAND_WAIT = false
# アイテム、スキル、ターゲット選択時にCTのカウントを止めるか(true:止める / false:止めない)
SELECT_WAIT = true
# アニメーション表示時にCTのカウントを止めるか(true:止める / false:止めない)
ANIMATION_WAIT = false

# バトルスピード(数値が大きいほどCTの溜まりが速くなる)
BATTLE_SPEED = 3

# バトルメンバーの最大数(多人数PTスクリプトを導入している時に設定)
PARTY_SIZE = 4

# 行動終了時のCT減少パーセンテージ
ACT_ATTACK_CT = 100 # 通常攻撃
ACT_GUARD_CT = 100 # 防御
ACT_ESCAPE_CT = 100 # 逃走失敗
ACT_SKILL_CT = 100 # スキル
ACT_ITEM_CT = 100 # アイテム

# 逃走失敗時のメッセージ
UNESCAPE_MES = "逃走失敗"

# CT満タン時の効果音(""で音を鳴らさない)
# 効果音は「Audio/SE」フォルダ内
FULL_CT_SE = "015-Jump01"
# 効果音のボリューム
FULL_CT_SE_VOL = 80

# CT満タン時のバトラーの色調((0,0,0)で変化なし)
FULL_CT_COLOR = Tone.new(32,0,0)

# HPゲージの色(グラデーション左端)
HP_COLOR_LEFT = Color.new(128, 0, 0, 255)
# HPゲージの色(グラデーション右端)
HP_COLOR_RIGHT= Color.new(255, 0, 0, 255)
# SPゲージの色(グラデーション左端)
SP_COLOR_LEFT = Color.new(0, 0, 128, 255)
# SPゲージの色(グラデーション右端)
SP_COLOR_RIGHT= Color.new(0, 0, 255, 255)
# CTゲージの色(グラデーション左端)
COLOR_LEFT = Color.new(128, 128, 64, 255)
# CTゲージの色(グラデーション右端)
COLOR_RIGHT= Color.new(255, 255, 128, 255)
# CTが満タンになったときのゲージの色
COLOR_FULL = Color.new(255, 225, 128, 255)

# ゲージ枠の色
FRAME_COLOR = Color.new(192, 192, 192, 255)
# ゲージ枠の太さ
FRAME_BORDER = 1
# ゲージの背景色
BACK_COLOR = Color.new(128, 128, 128, 128)

# 名前のフォントサイズ
NAME_FONT_SIZE = 16
# HP/SPのフォントサイズ
HPSP_FONT_SIZE = 18
# エネミー名のフォントサイズ
ENEMY_FONT_SIZE = 16
# 最大HP/SPを描画するか( true / false )
MAX_DRAW = false

# エネミー名をグループ化( true / false )
# (trueにすると「ゴースト 2」のようにまとめて表示します)
ENEMY_GROUPING = false

# エネミー名の下にゲージを表示( 0:なし / 1:HP / 2:CT )
# (エネミー名をグループ化している場合は無効)
ENEMY_DRAWING_MATER = 0

# アクターのヘルプウインドウにHP/SPゲージを表示( true / false )
HELP_DRAWING_MATER_ACTOR = false
# エネミーのヘルプウインドウにHP/SPゲージを表示( true / false )
HELP_DRAWING_MATER_ENEMY = false

# コマンドウインドウの位置を強制指定( true / false )
#(他の方のサイドビュースクリプトを併用していて
# コマンドウインドウの位置がどうしても不自然になるならtrueに)
# ※trueにしても適用されない場合、このスクリプトを
#  サイドビューよりも下に置いてみてください
WINDOWPOS_CHANGE = false
WINDOWPOS_X = 100 # X座標
WINDOWPOS_Y = 320 # Y座標

# コマンドウインドウの不透明度
WINDOW_OPACITY = 160

# CTのカウント間隔。少ないほどゲージ描画がなめらかに。(最小値は0)
# 処理が重い場合は、この数値を上げてください。
CT_SKIP = 2

end

# ↑ 設定項目ここまで
#------------------------------------------------------------------------------

#==============================================================================
# â–  Scene_Battle
#==============================================================================

class Scene_Battle

#--------------------------------------------------------------------------
# ○ CTのカウント
#--------------------------------------------------------------------------
def update_ct
# カウントアップが許可されているとき
if @countup
for actor in $game_party.actors
# 行動できるか
if actor.movable? == false and actor.ct_visible and @phase4_step != 5
# 不可視状態でカウントアップ
actor.ct_visible = false
actor.countup = true
actor.full_ct = false
elsif actor.movable? and actor.ct_visible == false
# 不可視カウントアップを解除
clear_ct(actor)
actor.ct_visible = true
end
# アクターの入れ替えに対応
if actor.max_ct == 0
actor.max_ct = @max_ct
end
# アクターのカウントアップ
if actor.countup
# CTがmaxになっており、コマンド入力待ちアクターに含まれない
if actor.now_ct >= @max_ct and !(@pre_action_battlers.include?(actor))
# コマンド入力待ちアクターに追加
@pre_action_battlers.push(actor)
@action_count += 1
# 効果音を鳴らす
if PARA_CTB::FULL_CT_SE != "" and actor.ct_visible
Audio.se_play("Audio/SE/" + PARA_CTB::FULL_CT_SE,PARA_CTB::FULL_CT_SE_VOL)
end
# それ以上カウントアップしない
actor.countup = false
actor.full_ct = true
else
# カウントアップ
actor.make_action_speed
ct_skip = PARA_CTB::CT_SKIP != 0 ? PARA_CTB::CT_SKIP : 1
actor.now_ct += actor.current_action.speed * PARA_CTB::BATTLE_SPEED * ct_skip
end
end
end
for enemy in $game_troop.enemies
# 行動できるか
if enemy.movable? == false and enemy.ct_visible and @phase4_step == 5
# 不可視状態でカウントアップ
enemy.ct_visible = false
enemy.countup = true
enemy.full_ct = false
elsif enemy.movable? and enemy.ct_visible == false
# 不可視カウントアップを解除
clear_ct(enemy)
enemy.ct_visible = true
end
# エネミーのカウントアップ
if enemy.countup
# CTがmaxになっており、行動待ちエネミーに含まれない
if enemy.now_ct >= @max_ct and ! @pre_action_battlers.include?(enemy)
# 行動待ちエネミーに追加
@pre_action_battlers.push(enemy)
@action_count += 1
# それ以上カウントアップしない
enemy.countup = false
enemy.full_ct = true
else
# カウントアップ
enemy.make_action_speed
enemy.now_ct += enemy.current_action.speed * PARA_CTB::BATTLE_SPEED
end
end
end
# CTゲージを再描画
@status_window.refresh_ct
@status_window2.refresh_ct
end
end
#--------------------------------------------------------------------------
# ○ バトラーのCTを0に
#--------------------------------------------------------------------------
def clear_ct(battler)
battler.countup = true
battler.now_ct = 0
battler.full_ct = false
end
#--------------------------------------------------------------------------
# ○ バトラーのCTを任意のパーセンテージに
#--------------------------------------------------------------------------
def declease_ct(battler,percent)
battler.countup = true
battler.now_ct = battler.now_ct * percent / 100
battler.full_ct = false
end
#--------------------------------------------------------------------------
# ○ CTの初期化
#--------------------------------------------------------------------------
def initialize_ct
# CTの基準値を決定
max_ct
for battler in $game_party.actors + $game_troop.enemies
if battler.movable?
n = $game_party.actors.size + $game_troop.enemies.size
# 戦闘開始時にある程度のCTを溜めておく
battler.now_ct = battler.agi * 60 * n
battler.ct_visible = true
else
clear_ct(battler)
battler.ct_visible = false
end
battler.countup = true
battler.full_ct = false
battler.max_ct = @max_ct
end
end
#--------------------------------------------------------------------------
# ○ バトラー全員の素早さからCTの基準値を決定
#--------------------------------------------------------------------------
def max_ct
for battler in $game_party.actors + $game_troop.enemies
@max_ct += battler.agi
end
@max_ct *= 100
end
#--------------------------------------------------------------------------
# ○ バトラーの行動順を変更
#--------------------------------------------------------------------------
def shift_activer(shift)
# 一つシフトする時で後ろのアクターが2人以上
if @pre_action_battlers != nil
if shift == 1 and @pre_action_battlers.size >= @actor_array_index + 3
# 現在のアクターを取得
act = @pre_action_battlers[@actor_array_index]
# 現在のアクターを二つ後ろに挿入
@pre_action_battlers.insert(@actor_array_index+2, act)
# 現在位置を消去
@pre_action_battlers.delete_at(@actor_array_index)
@actor_array_index -= 1
phase3_next_actor
else
act = @pre_action_battlers[@actor_array_index]
# 現在のアクターを一番後ろに追加
@pre_action_battlers.push(act)
# 現在位置を消去
@pre_action_battlers.delete_at(@actor_array_index)
@actor_array_index -= 1
phase3_next_actor
end
end
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias main_ctb main
def main
# エネミー名ウインドウを作成
@status_window2 = Window_BattleStatus_enemy.new
@action_battlers = []
@pre_action_battlers = []
@max_ct = 0
@countup = false
@ct_wait = 0
@action_count = 0
main_ctb
# エネミー名ウインドウを破棄
@status_window2.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias ctb_update update
def update
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
# インタプリタを更新
$game_system.battle_interpreter.update
# アクションを強制されているバトラーが存在しない場合
if $game_temp.forcing_battler == nil
# バトルイベントの実行が終わった場合
unless $game_system.battle_interpreter.running?
# 戦闘継続の場合、バトルイベントのセットアップを再実行
unless judge
setup_battle_event
end
end
# アフターバトルフェーズでなければ
if @phase != 5
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# エネミー名リストを更新
@status_window2.refresh
end
end
else
if PARA_CTB::CT_SKIP == 0
update_ct
else
if @ct_wait > 0
@ct_wait -= 1
else
update_ct
@ct_wait = PARA_CTB::CT_SKIP
end
end
end
ctb_update
end
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias ctb_start_phase1 start_phase1
def start_phase1
# CTを初期化
initialize_ct
# カウントアップ開始
@countup = true

ctb_start_phase1
end
#--------------------------------------------------------------------------
# ● フレーム更新 (プレバトルフェーズ)
#--------------------------------------------------------------------------
def update_phase1
# エネミー名リストを更新
@status_window2.refresh
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# パーティーコマンドフェーズを飛ばしてアクターコマンドフェーズ開始
start_phase3
end
#--------------------------------------------------------------------------
# ● パーティコマンドフェーズ開始
#--------------------------------------------------------------------------
def start_phase2
# フェーズ 2 に移行
@phase = 2
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# パーティコマンドウィンドウを有効化
@party_command_window.active = true
@party_command_window.visible = true
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
# メインフェーズフラグをクリア
$game_temp.battle_main_phase = false
# コマンド入力不可能な場合
unless $game_party.inputable?
# メインフェーズ開始
start_phase4
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
#--------------------------------------------------------------------------
def update_phase2_escape
# エネミーの素早さ合計を計算
enemies_agi = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
end
end
# 行動可能アクターの素早さ合計を計算
actors_agi = 0
for actor in @pre_action_battlers
if actor.is_a?(Game_Actor) and actor.exist?
actors_agi += actor.agi
end
end
# 逃走成功判定
success = rand(100) < 50 * actors_agi / enemies_agi
# 逃走成功の場合
if success
# 逃走 SE を演奏
$game_system.se_play($data_system.escape_se)
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# CTをクリア
for battler in $game_party.actors
clear_ct(battler)
end
# バトル終了
battle_end(1)
# 逃走失敗の場合
else
# ヘルプウィンドウに "逃走失敗" をセット
@help_window.set_text(PARA_CTB::UNESCAPE_MES, 1)
# アクターのアクションとCTをクリア
pre_action_battlers = @pre_action_battlers.clone
for act in pre_action_battlers
if act.is_a?(Game_Actor)
declease_ct(act, 100-PARA_CTB::ACT_ESCAPE_CT)
act.current_action.clear
@pre_action_battlers.delete(act)
end
end
@party_command_window.visible = false
# ヘルプウィンドウを表示
@help_window.visible = true
@wait_count = 20
# メインフェーズ開始
start_phase4
end
end
#--------------------------------------------------------------------------
# ● アクターコマンドフェーズ開始
#--------------------------------------------------------------------------
def start_phase3
# フェーズ 3 に移行
@phase = 3
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
@actor_array_index = -1
# 次のアクターのコマンド入力へ
if @pre_action_battlers != []
phase3_next_actor
else
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 次のアクターのコマンド入力へ
#--------------------------------------------------------------------------
def phase3_next_actor
# ループ
begin
# アクターの明滅エフェクト OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最後のアクターの場合
if @actor_array_index + 1 == @pre_action_battlers.size
# メインフェーズ開始
start_phase4
return
#次がエネミーの場合
elsif $game_troop.enemies.include?(@pre_action_battlers[@actor_array_index + 1])
# メインフェーズ開始
start_phase4
return
end
# アクターのインデックスを進める
@actor_array_index += 1
@actor_index = @pre_action_battlers[@actor_array_index].index
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
@active_battler.current_action.clear
# アクターがコマンド入力を受け付けない状態ならもう一度
end until @active_battler.inputable?
# アクターコマンドウィンドウをセットアップ
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 前のアクターのコマンド入力へ
#--------------------------------------------------------------------------
def phase3_prior_actor
# ループ
begin
# アクターの明滅エフェクト OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最初のアクターの場合
if @actor_array_index <= 0
# アクターコマンドフェーズ開始
start_phase2
return
end
# アクターのインデックスを戻す
@actor_array_index -= 1
@actor_index = @pre_action_battlers[@actor_array_index].index
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
@active_battler.current_action.clear
# アクターがコマンド入力を受け付けない状態ならもう一度
end until @active_battler.inputable?
# アクターコマンドウィンドウをセットアップ
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias phase3_setup_command_window_ctb phase3_setup_command_window
def phase3_setup_command_window
@actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY
phase3_setup_command_window_ctb
if PARA_CTB::WINDOWPOS_CHANGE
# アクターコマンドウィンドウの位置を設定
@actor_command_window.x = PARA_CTB::WINDOWPOS_X
@actor_command_window.y = PARA_CTB::WINDOWPOS_Y
# ステータスウインドウに隠れないように
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ)
#--------------------------------------------------------------------------
def update_phase3
# エネミーアローが有効の場合
if @enemy_arrow != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_enemy_select
# アクターアローが有効の場合
elsif @actor_arrow != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_actor_select
# スキルウィンドウが有効の場合
elsif @skill_window != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_skill_select
# アイテムウィンドウが有効の場合
elsif @item_window != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_item_select
# アクターコマンドウィンドウが有効の場合
elsif @actor_command_window.active
@countup = PARA_CTB::COMMAND_WAIT ? false : true
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
#--------------------------------------------------------------------------
alias ctb_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
ctb_update_phase3_basic_command
# LRボタンで行動順を変更
if Input.trigger?(Input::R)
shift_activer(1)
end
if Input.trigger?(Input::L)
shift_activer(-1)
end
end
#--------------------------------------------------------------------------
# ● メインフェーズ開始
#--------------------------------------------------------------------------
def start_phase4
# フェーズ 4 に移行
@phase = 4
battler_count = $game_party.actors.size + $game_troop.enemies.size
if @action_count >= battler_count or $game_temp.battle_turn == 0
# バトルイベントの全ページを検索
for index in 0...$data_troops[@troop_id].pages.size
# イベントページを取得
page = $data_troops[@troop_id].pages[index]
# このページのスパンが [ターン] の場合
if page.span == 1
# 実行済みフラグをクリア
$game_temp.battle_event_flags[index] = false
end
end
# ターン数カウント
$game_temp.battle_turn += 1
@action_count = 0
end
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# パーティコマンドウィンドウを有効化
@party_command_window.active = false
@party_command_window.visible = false
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
# メインフェーズフラグをセット
$game_temp.battle_main_phase = true
# エネミーアクション作成
for enemy in $game_troop.enemies
enemy.make_action
end
# 行動順序作成
make_action_orders
# ステップ 1 に移行
@phase4_step = 1
end
#--------------------------------------------------------------------------
# ● 行動順序作成
#--------------------------------------------------------------------------
def make_action_orders
# 配列 @action_battlers を初期化
@action_battlers = []
if @pre_action_battlers != []
for i in 0..@actor_array_index
# アクターを配列 @action_battlers に追加
@action_battlers.push(@pre_action_battlers[0])
@pre_action_battlers.shift
end
if @pre_action_battlers.size != 0
loop do
if $game_troop.enemies.include?(@pre_action_battlers[0])
# エネミーを配列 @action_battlers に追加
@action_battlers.push(@pre_action_battlers[0])
@pre_action_battlers.shift
else
break
end
end
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
#--------------------------------------------------------------------------
alias ctb_update_phase4_step1 update_phase4_step1
def update_phase4_step1
@countup = true
# ヘルプウィンドウを隠す
@help_window.visible = false
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# 未行動バトラーが存在しない場合 (全員行動した)
if @action_battlers.size == 0
# アクターコマンドフェーズ開始
start_phase3
return
end
ctb_update_phase4_step1
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
alias ctb_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# 制約が [行動できない] の場合
if @active_battler.restriction == 4
# CTをクリア
clear_ct(@active_battler)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# アニメーション再生中にCTをカウントするか
@countup = PARA_CTB::ANIMATION_WAIT ? false : true
ctb_update_phase4_step2
end
#--------------------------------------------------------------------------
# ● 基本アクション 結果作成
#--------------------------------------------------------------------------
alias make_basic_action_result_ctb make_basic_action_result
def make_basic_action_result
# 何もしないの場合
if @active_battler.current_action.basic == 3
# CTをクリア
clear_ct(@active_battler)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
make_basic_action_result_ctb
end
#--------------------------------------------------------------------------
# ● スキルアクション 結果作成
#--------------------------------------------------------------------------
def make_skill_action_result
# スキルを取得
@skill = $data_skills[@active_battler.current_action.skill_id]
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# SP 切れなどで使用できなくなった場合
unless @active_battler.skill_can_use?(@skill.id)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# CTをクリア
declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# SP 消費
@active_battler.sp -= @skill.sp_cost
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# ヘルプウィンドウにスキル名を表示
@help_window.set_text(@skill.name, 1)
# アニメーション ID を設定
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# コモンイベント ID を設定
@common_event_id = @skill.common_event_id
# 対象側バトラーを設定
set_target_battlers(@skill.scope)
# スキルの効果を適用
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
# ● アイテムアクション 結果作成
#--------------------------------------------------------------------------
alias ctb_make_item_action_result make_item_action_result
def make_item_action_result
# アイテムを取得
@item = $data_items[@active_battler.current_action.item_id]
# アイテム切れなどで使用できなくなった場合
unless $game_party.item_can_use?(@item.id)
# CTをクリア
declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
# ステップ 1 に移行
@phase4_step = 1
return
end
ctb_make_item_action_result
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
#--------------------------------------------------------------------------
alias update_phase4_step5_ctb update_phase4_step5
def update_phase4_step5
# ダメージを記録
for target in @target_battlers
if target.damage != nil
target.damage_backup = target.damage
end
end
update_phase4_step5_ctb
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias update_phase4_step6_ctb update_phase4_step6
def update_phase4_step6
@active_battler.countup = true
if @active_battler.current_action.basic == 1
# 防御
declease_ct(@active_battler,100-PARA_CTB::ACT_GUARD_CT)
else
case @active_battler.current_action.kind
# 攻撃
when 0
declease_ct(@active_battler,100-PARA_CTB::ACT_ATTACK_CT)
# スキル
when 1
declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
# アイテム
when 2
declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
else
clear_ct(@active_battler)
end
end
# ターゲットが行動不能になӖ
Why did you all flame my topic. Screw your fucking forums.
Why did you all flame my topic. Screw your fucking forums.
Why did you all flame my topic. Screw your fucking forums.
Reposted them. Gosh.......
Thanks for reposting, but I am a bit confused on the magic casting time. Because all translaters suck and I can't read japanese so I don't know how it works. Please help :x
And yea, hackers suck.
[QUOTE=DrWeazel]Thanks for reposting, but I am a bit confused on the magic casting time. Because all translaters suck and I can't read japanese so I don't know how it works. Please help :x
And yea, hackers suck.[/QUOTE]


I was at first to, but all you gotta do is find this line at the very beggining SPELL_STATE_NAME and put the name of the Status in the brakets exaple "Casting" then make a Status Effect of the exact same name...
Coolio script.
Thanks Bitemydustin, but i wanted to use this w/ Minkoff's battle script.
When i try to even attack, this error pops up....

Quote:
Script 'Spell Casting Time Gauge' Line 62: NoMethodError occurred.
undefined method `+' for nil:NilClass


Can anyone help me w/ this. :|
Er, Minkoff's battle system is based on RTAB, right? Well, here's Casting time gauge for RTAB:
http://members.jcom.home.ne.jp/cogwheel/script/spell.html
;_;
It didn't do anything. I put the script directly under the RTAB stuff.
Do I need to edit anything. >_<; I'm sorry for kinda annoying yall.
# スキル詠唱 Ver 1.00
# 配布元・サポートURL
# http://members.jcom.home.ne.jp/cogwheel/

class Scene_Battle
  #--------------------------------------------------------------------------
  # ● スキル詠唱タイム作成
  #--------------------------------------------------------------------------
  def recite_time(battler)
    # 詠唱に要する時間。『battler.rtp = 100』でタイムゲージが溜まる時間と同等。
    # 合成スキル使用時は、全員で詠唱タイムを稼ぐため人数×100で通常時と同等。
    case $data_skills[battler.current_action.skill_id].name
    when "ヒール"
      battler.rtp = 30
    when "ファイア"
      battler.rtp = 60
    when "アイス"
      battler.rtp = 60
    when "サンダー"
      battler.rtp = 60
    when "ウィンド"
      battler.rtp = 60
    when "ウォーター"
      battler.rtp = 60
    when "ウォーター+"
      battler.rtp = 100
    when "クロスカット"
      battler.rtp = 20
    when "レッグスイープ"
      battler.rtp = 20
    when "ハリケーン"
      battler.rtp = 80
    when "サンダーピアス"
      battler.rtp = 80
    when "スパイラルブレード"
      battler.rtp = 120
    when "スクリュースラスト"
      battler.rtp = 120
    when "デッドリーダンス"
      battler.rtp = 120
    else
      battler.rtp = 0
    end
    battler.rtp *= @max  / 100
  end
end
Expand to see the code.

You have to edit skill names(after 'when') and casting times(battler.rtp = blah) to what you want.
Are there translated versions of these scripts? I combined the side-view and the time system, and all I see on my window is the gradients bars.
Wait, when you say after "when" I set the status change to casting?
There are a lot of "whens". Does that mean I go and set different casting times to different spells? PM me or email me if you want.
yes. like this:
  def recite_time(battler)
    # 詠唱に要する時間。『battler.rtp = 100』でタイムゲージが溜まる時間と同等。
    # 合成スキル使用時は、全員で詠唱タイムを稼ぐため人数×100で通常時と同等。
    case $data_skills[battler.current_action.skill_id].name
    when "Heal" #Skill Name
      battler.rtp = 30 #Casting time for skill
    when "Fire"
      battler.rtp = 60
    when "Ice"
      battler.rtp = 60
#......
#And go on
Expand to see the code.

You have to set skill name and casting time for each skills you want.
o.O maple story?
Sorry to interrupt with your casting time scipt, but... I can't see the monster names or any other text on the bottom window. Also, I would like my command window to appear in the bottom-left corner, much like the FF series. Can someone post the proper script(s)?

http://i10.photobucket.com/albums/a135/ ... leshot.jpg[/IMG]
At main put
$defaultfonttype = $fontface = $fontname = "Tahoma"
$defaultfontsize = $fontsize = 22

Buy legal version~~
Yes, I plan on buying it soon. Today is my payday, and it's pretty much my first paycheck I can actually do anything I want with. So I'm planning on purchasing the legal version today, provided my sister doesn't decide that she needs money for bills. :P
[QUOTE=Amaras]Sorry to interrupt with your casting time scipt, but... I can't see the monster names or any other text on the bottom window. Also, I would like my command window to appear in the bottom-left corner, much like the FF series. Can someone post the proper script(s)?

http://i10.photobucket.com/albums/a135/ ... leshot.jpg[/IMG][/QUOTE]

To answer your question about the battle menu, look for this line in both codes:

WINDOWPOS_CHANGE = true # コマンドウインドウをバトラーの横に表示するか( true / false )

the first one should be false and in the second code it should be true, if that doesn't work switch it around.
Holy Crap! It works! Thank you SO much!
Who do I credit?
Note: Do not credit me.
Updated to 2.57. Homepage said:
Quote:
2006/7/16 ver.2.57
 状態異常中に攻撃を受けるとCTゲージがクリアされてしまう問題を修正。


[spoiler=ATB 2.57 Script]
[code]
#==============================================================================
# ++ アクティブタイムバトル ver. 2.57 ++
#  Script by パラ犬
#  http://para.j-mx.com/
#------------------------------------------------------------------------------
# CTゲージが溜まったバトラーから順にコマンド入力する戦闘形式。
# バトルステータス画面をサイドビューらしくする機能もあります。
# バトラーをサイドビュータイプに表示するスクリプトは、お好きなものを
# 用意してください。
#------------------------------------------------------------------------------
#[設置上の注意]
# できるだけリストの上のほうに置いてください。(Scene_Debugよりは下)
#------------------------------------------------------------------------------
#[操作]
#・逃走
# 味方バトラーの一人以上がコマンド入力待ちのときにキャンセルボタンを押すことで
# 「逃げる」コマンドが選択できます。
# 敵の数が多かったり、コマンド入力待ちのバトラーが少ないと、
# 逃走成功率が低くなります。
#
#・行動順の入れ替え
# 複数のバトラーが行動可能のとき、
# Rボタン(PageDownキー)で次のバトラーと順番を入れ替え、
# Lボタン(PageUpキー)で行動順をいちばん最後に回します。
#==============================================================================

module PARA_CTB

# コマンド入力時にCTのカウントを止めるか(true:止める / false:止めない)
COMMAND_WAIT = false
# アイテム、スキル、ターゲット選択時にCTのカウントを止めるか(true:止める / false:止めない)
SELECT_WAIT = true
# アニメーション表示時にCTのカウントを止めるか(true:止める / false:止めない)
ANIMATION_WAIT = false

# バトルスピード(数値が大きいほどCTの溜まりが速くなる)
BATTLE_SPEED = 3

# バトルメンバーの最大数(多人数PTスクリプトを導入している時に設定)
PARTY_SIZE = 4

# 行動終了時のCT減少パーセンテージ
ACT_ATTACK_CT = 100 # 通常攻撃
ACT_GUARD_CT = 100 # 防御
ACT_ESCAPE_CT = 100 # 逃走失敗
ACT_SKILL_CT = 100 # スキル
ACT_ITEM_CT = 100 # アイテム

# 逃走失敗時のメッセージ
UNESCAPE_MES = "逃走失敗"

# CT満タン時の効果音(""で音を鳴らさない)
# 効果音は「Audio/SE」フォルダ内
FULL_CT_SE = "015-Jump01"
# 効果音のボリューム
FULL_CT_SE_VOL = 80

# CT満タン時のバトラーの色調((0,0,0)で変化なし)
FULL_CT_COLOR = Tone.new(32,0,0)

# HPゲージの色(グラデーション左端)
HP_COLOR_LEFT = Color.new(128, 0, 0, 255)
# HPゲージの色(グラデーション右端)
HP_COLOR_RIGHT= Color.new(255, 0, 0, 255)
# SPゲージの色(グラデーション左端)
SP_COLOR_LEFT = Color.new(0, 0, 128, 255)
# SPゲージの色(グラデーション右端)
SP_COLOR_RIGHT= Color.new(0, 0, 255, 255)
# CTゲージの色(グラデーション左端)
COLOR_LEFT = Color.new(128, 128, 64, 255)
# CTゲージの色(グラデーション右端)
COLOR_RIGHT= Color.new(255, 255, 128, 255)
# CTが満タンになったときのゲージの色
COLOR_FULL = Color.new(255, 225, 128, 255)

# ゲージ枠の色
FRAME_COLOR = Color.new(192, 192, 192, 255)
# ゲージ枠の太さ
FRAME_BORDER = 1
# ゲージの背景色
BACK_COLOR = Color.new(128, 128, 128, 128)

# 名前のフォントサイズ
NAME_FONT_SIZE = 16
# HP/SPのフォントサイズ
HPSP_FONT_SIZE = 18
# エネミー名のフォントサイズ
ENEMY_FONT_SIZE = 16
# 最大HP/SPを描画するか( true / false )
MAX_DRAW = false

# エネミー名をグループ化( true / false )
# (trueにすると「ゴースト 2」のようにまとめて表示します)
ENEMY_GROUPING = false

# エネミー名の下にゲージを表示( 0:なし / 1:HP / 2:CT )
# (エネミー名をグループ化している場合は無効)
ENEMY_DRAWING_MATER = 0

# アクターのヘルプウインドウにHP/SPゲージを表示( true / false )
HELP_DRAWING_MATER_ACTOR = false
# エネミーのヘルプウインドウにHP/SPゲージを表示( true / false )
HELP_DRAWING_MATER_ENEMY = false

# コマンドウインドウの位置を強制指定( true / false )
#(他の方のサイドビュースクリプトを併用していて
# コマンドウインドウの位置がどうしても不自然になるならtrueに)
# ※trueにしても適用されない場合、このスクリプトを
#  サイドビューよりも下に置いてみてください
WINDOWPOS_CHANGE = false
WINDOWPOS_X = 100 # X座標
WINDOWPOS_Y = 320 # Y座標

# コマンドウインドウの不透明度
WINDOW_OPACITY = 160

# CTのカウント間隔。少ないほどゲージ描画がなめらかに。(最小値は0)
# 処理が重い場合は、この数値を上げてください。
CT_SKIP = 2

end

# ↑ 設定項目ここまで
#------------------------------------------------------------------------------

#==============================================================================
# â–  Scene_Battle
#==============================================================================

class Scene_Battle

#--------------------------------------------------------------------------
# ○ CTのカウント
#--------------------------------------------------------------------------
def update_ct
# カウントアップが許可されているとき
if @countup
for actor in $game_party.actors
# 行動できるか
if actor.movable? == false and actor.ct_visible and @phase4_step != 5
# 不可視状態でカウントアップ
actor.ct_visible = false
actor.countup = true
actor.full_ct = false
elsif actor.movable? and actor.ct_visible == false
# 不可視カウントアップを解除
clear_ct(actor)
actor.ct_visible = true
end
# アクターの入れ替えに対応
if actor.max_ct == 0
actor.max_ct = @max_ct
end
# アクターのカウントアップ
if actor.countup
# CTがmaxになっており、コマンド入力待ちアクターに含まれない
if actor.now_ct >= @max_ct and !(@pre_action_battlers.include?(actor))
# コマンド入力待ちアクターに追加
@pre_action_battlers.push(actor)
@action_count += 1
# 効果音を鳴らす
if PARA_CTB::FULL_CT_SE != "" and actor.ct_visible
Audio.se_play("Audio/SE/" + PARA_CTB::FULL_CT_SE,PARA_CTB::FULL_CT_SE_VOL)
end
# それ以上カウントアップしない
actor.countup = false
actor.full_ct = true
else
# カウントアップ
actor.make_action_speed
ct_skip = PARA_CTB::CT_SKIP != 0 ? PARA_CTB::CT_SKIP : 1
actor.now_ct += actor.current_action.speed * PARA_CTB::BATTLE_SPEED * ct_skip
end
end
end
for enemy in $game_troop.enemies
# 行動できるか
if enemy.movable? == false and enemy.ct_visible and @phase4_step == 5
# 不可視状態でカウントアップ
enemy.ct_visible = false
enemy.countup = true
enemy.full_ct = false
elsif enemy.movable? and enemy.ct_visible == false
# 不可視カウントアップを解除
clear_ct(enemy)
enemy.ct_visible = true
end
# エネミーのカウントアップ
if enemy.countup
# CTがmaxになっており、行動待ちエネミーに含まれない
if enemy.now_ct >= @max_ct and ! @pre_action_battlers.include?(enemy)
# 行動待ちエネミーに追加
@pre_action_battlers.push(enemy)
@action_count += 1
# それ以上カウントアップしない
enemy.countup = false
enemy.full_ct = true
else
# カウントアップ
enemy.make_action_speed
enemy.now_ct += enemy.current_action.speed * PARA_CTB::BATTLE_SPEED
end
end
end
# CTゲージを再描画
@status_window.refresh_ct
@status_window2.refresh_ct
end
end
#--------------------------------------------------------------------------
# ○ バトラーのCTを0に
#--------------------------------------------------------------------------
def clear_ct(battler)
battler.countup = true
battler.now_ct = 0
battler.full_ct = false
end
#--------------------------------------------------------------------------
# ○ バトラーのCTを任意のパーセンテージに
#--------------------------------------------------------------------------
def declease_ct(battler,percent)
battler.countup = true
battler.now_ct = battler.now_ct * percent / 100
battler.full_ct = false
end
#--------------------------------------------------------------------------
# ○ CTの初期化
#--------------------------------------------------------------------------
def initialize_ct
# CTの基準値を決定
max_ct
for battler in $game_party.actors + $game_troop.enemies
if battler.movable?
n = $game_party.actors.size + $game_troop.enemies.size
# 戦闘開始時にある程度のCTを溜めておく
battler.now_ct = battler.agi * 60 * n
battler.ct_visible = true
else
clear_ct(battler)
battler.ct_visible = false
end
battler.countup = true
battler.full_ct = false
battler.max_ct = @max_ct
end
end
#--------------------------------------------------------------------------
# ○ バトラー全員の素早さからCTの基準値を決定
#--------------------------------------------------------------------------
def max_ct
for battler in $game_party.actors + $game_troop.enemies
@max_ct += battler.agi
end
@max_ct *= 100
end
#--------------------------------------------------------------------------
# ○ バトラーの行動順を変更
#--------------------------------------------------------------------------
def shift_activer(shift)
# 一つシフトする時で後ろのアクターが2人以上
if @pre_action_battlers != nil
if shift == 1 and @pre_action_battlers.size >= @actor_array_index + 3
# 現在のアクターを取得
act = @pre_action_battlers[@actor_array_index]
# 現在のアクターを二つ後ろに挿入
@pre_action_battlers.insert(@actor_array_index+2, act)
# 現在位置を消去
@pre_action_battlers.delete_at(@actor_array_index)
@actor_array_index -= 1
phase3_next_actor
else
act = @pre_action_battlers[@actor_array_index]
# 現在のアクターを一番後ろに追加
@pre_action_battlers.push(act)
# 現在位置を消去
@pre_action_battlers.delete_at(@actor_array_index)
@actor_array_index -= 1
phase3_next_actor
end
end
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias main_ctb main
def main
# エネミー名ウインドウを作成
@status_window2 = Window_BattleStatus_enemy.new
@action_battlers = []
@pre_action_battlers = []
@max_ct = 0
@countup = false
@ct_wait = 0
@action_count = 0
main_ctb
# エネミー名ウインドウを破棄
@status_window2.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias ctb_update update
def update
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
# インタプリタを更新
$game_system.battle_interpreter.update
# アクションを強制されているバトラーが存在しない場合
if $game_temp.forcing_battler == nil
# バトルイベントの実行が終わった場合
unless $game_system.battle_interpreter.running?
# 戦闘継続の場合、バトルイベントのセットアップを再実行
unless judge
setup_battle_event
end
end
# アフターバトルフェーズでなければ
if @phase != 5
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# エネミー名リストを更新
@status_window2.refresh
end
end
else
if PARA_CTB::CT_SKIP == 0
update_ct
else
if @ct_wait > 0
@ct_wait -= 1
else
update_ct
@ct_wait = PARA_CTB::CT_SKIP
end
end
end
ctb_update
end
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias ctb_start_phase1 start_phase1
def start_phase1
# CTを初期化
initialize_ct
# カウントアップ開始
@countup = true

ctb_start_phase1
end
#--------------------------------------------------------------------------
# ● フレーム更新 (プレバトルフェーズ)
#--------------------------------------------------------------------------
def update_phase1
# エネミー名リストを更新
@status_window2.refresh
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# パーティーコマンドフェーズを飛ばしてアクターコマンドフェーズ開始
start_phase3
end
#--------------------------------------------------------------------------
# ● パーティコマンドフェーズ開始
#--------------------------------------------------------------------------
def start_phase2
# フェーズ 2 に移行
@phase = 2
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# パーティコマンドウィンドウを有効化
@party_command_window.active = true
@party_command_window.visible = true
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
# メインフェーズフラグをクリア
$game_temp.battle_main_phase = false
# コマンド入力不可能な場合
unless $game_party.inputable?
# メインフェーズ開始
start_phase4
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
#--------------------------------------------------------------------------
def update_phase2_escape
# エネミーの素早さ合計を計算
enemies_agi = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
end
end
# 行動可能アクターの素早さ合計を計算
actors_agi = 0
for actor in @pre_action_battlers
if actor.is_a?(Game_Actor) and actor.exist?
actors_agi += actor.agi
end
end
# 逃走成功判定
success = rand(100) < 50 * actors_agi / enemies_agi
# 逃走成功の場合
if success
# 逃走 SE を演奏
$game_system.se_play($data_system.escape_se)
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# CTをクリア
for battler in $game_party.actors
clear_ct(battler)
end
# バトル終了
battle_end(1)
# 逃走失敗の場合
else
# ヘルプウィンドウに "逃走失敗" をセット
@help_window.set_text(PARA_CTB::UNESCAPE_MES, 1)
# アクターのアクションとCTをクリア
pre_action_battlers = @pre_action_battlers.clone
for act in pre_action_battlers
if act.is_a?(Game_Actor)
declease_ct(act, 100-PARA_CTB::ACT_ESCAPE_CT)
act.current_action.clear
@pre_action_battlers.delete(act)
end
end
@party_command_window.visible = false
# ヘルプウィンドウを表示
@help_window.visible = true
@wait_count = 20
# メインフェーズ開始
start_phase4
end
end
#--------------------------------------------------------------------------
# ● アクターコマンドフェーズ開始
#--------------------------------------------------------------------------
def start_phase3
# フェーズ 3 に移行
@phase = 3
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
@actor_array_index = -1
# 次のアクターのコマンド入力へ
if @pre_action_battlers != []
phase3_next_actor
else
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 次のアクターのコマンド入力へ
#--------------------------------------------------------------------------
def phase3_next_actor
# ループ
begin
# アクターの明滅エフェクト OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最後のアクターの場合
if @actor_array_index + 1 == @pre_action_battlers.size
# メインフェーズ開始
start_phase4
return
#次がエネミーの場合
elsif $game_troop.enemies.include?(@pre_action_battlers[@actor_array_index + 1])
# メインフェーズ開始
start_phase4
return
end
# アクターのインデックスを進める
@actor_array_index += 1
@actor_index = @pre_action_battlers[@actor_array_index].index
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
@active_battler.current_action.clear
# アクターがコマンド入力を受け付けない状態ならもう一度
end until @active_battler.inputable?
# アクターコマンドウィンドウをセットアップ
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 前のアクターのコマンド入力へ
#--------------------------------------------------------------------------
def phase3_prior_actor
# ループ
begin
# アクターの明滅エフェクト OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最初のアクターの場合
if @actor_array_index <= 0
# アクターコマンドフェーズ開始
start_phase2
return
end
# アクターのインデックスを戻す
@actor_array_index -= 1
@actor_index = @pre_action_battlers[@actor_array_index].index
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
@active_battler.current_action.clear
# アクターがコマンド入力を受け付けない状態ならもう一度
end until @active_battler.inputable?
# アクターコマンドウィンドウをセットアップ
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias phase3_setup_command_window_ctb phase3_setup_command_window
def phase3_setup_command_window
@actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY
phase3_setup_command_window_ctb
if PARA_CTB::WINDOWPOS_CHANGE
# アクターコマンドウィンドウの位置を設定
@actor_command_window.x = PARA_CTB::WINDOWPOS_X
@actor_command_window.y = PARA_CTB::WINDOWPOS_Y
# ステータスウインドウに隠れないように
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ)
#--------------------------------------------------------------------------
def update_phase3
# エネミーアローが有効の場合
if @enemy_arrow != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_enemy_select
# アクターアローが有効の場合
elsif @actor_arrow != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_actor_select
# スキルウィンドウが有効の場合
elsif @skill_window != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_skill_select
# アイテムウィンドウが有効の場合
elsif @item_window != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_item_select
# アクターコマンドウィンドウが有効の場合
elsif @actor_command_window.active
@countup = PARA_CTB::COMMAND_WAIT ? false : true
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
#--------------------------------------------------------------------------
alias ctb_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
ctb_update_phase3_basic_command
# LRボタンで行動順を変更
if Input.trigger?(Input::R)
shift_activer(1)
end
if Input.trigger?(Input::L)
shift_activer(-1)
end
end
#--------------------------------------------------------------------------
# ● メインフェーズ開始
#--------------------------------------------------------------------------
def start_phase4
# フェーズ 4 に移行
@phase = 4
battler_count = $game_party.actors.size + $game_troop.enemies.size
if @action_count >= battler_count or $game_temp.battle_turn == 0
# バトルイベントの全ページを検索
for index in 0...$data_troops[@troop_id].pages.size
# イベントページを取得
page = $data_troops[@troop_id].pages[index]
# このページのスパンが [ターン] の場合
if page.span == 1
# 実行済みフラグをクリア
$game_temp.battle_event_flags[index] = false
end
end
# ターン数カウント
$game_temp.battle_turn += 1
@action_count = 0
end
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# パーティコマンドウィンドウを有効化
@party_command_window.active = false
@party_command_window.visible = false
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
# メインフェーズフラグをセット
$game_temp.battle_main_phase = true
# エネミーアクション作成
for enemy in $game_troop.enemies
enemy.make_action
end
# 行動順序作成
make_action_orders
# ステップ 1 に移行
@phase4_step = 1
end
#--------------------------------------------------------------------------
# ● 行動順序作成
#--------------------------------------------------------------------------
def make_action_orders
# 配列 @action_battlers を初期化
@action_battlers = []
if @pre_action_battlers != []
for i in 0..@actor_array_index
# アクターを配列 @action_battlers に追加
@action_battlers.push(@pre_action_battlers[0])
@pre_action_battlers.shift
end
if @pre_action_battlers.size != 0
loop do
if $game_troop.enemies.include?(@pre_action_battlers[0])
# エネミーを配列 @action_battlers に追加
@action_battlers.push(@pre_action_battlers[0])
@pre_action_battlers.shift
else
break
end
end
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
#--------------------------------------------------------------------------
alias ctb_update_phase4_step1 update_phase4_step1
def update_phase4_step1
@countup = true
# ヘルプウィンドウを隠す
@help_window.visible = false
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# 未行動バトラーが存在しない場合 (全員行動した)
if @action_battlers.size == 0
# アクターコマンドフェーズ開始
start_phase3
return
end
ctb_update_phase4_step1
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
alias ctb_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# 制約が [行動できない] の場合
if @active_battler.restriction == 4
# CTをクリア
clear_ct(@active_battler)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# アニメーション再生中にCTをカウントするか
if PARA_CTB::ANIMATION_WAIT == false
@countup = true
end
ctb_update_phase4_step2
end
#--------------------------------------------------------------------------
# ● 基本アクション 結果作成
#--------------------------------------------------------------------------
alias make_basic_action_result_ctb make_basic_action_result
def make_basic_action_result
# 何もしないの場合
if @active_battler.current_action.basic == 3
# CTをクリア
clear_ct(@active_battler)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
make_basic_action_result_ctb
end
#--------------------------------------------------------------------------
# ● スキルアクション 結果作成
#--------------------------------------------------------------------------
def make_skill_action_result
# スキルを取得
@skill = $data_skills[@active_battler.current_action.skill_id]
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# SP 切れなどで使用できなくなった場合
unless @active_battler.skill_can_use?(@skill.id)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# CTをクリア
declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# SP 消費
@active_battler.sp -= @skill.sp_cost
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# ヘルプウィンドウにスキル名を表示
@help_window.set_text(@skill.name, 1)
# アニメーション ID を設定
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# コモンイベント ID を設定
@common_event_id = @skill.common_event_id
# 対象側バトラーを設定
set_target_battlers(@skill.scope)
# スキルの効果を適用
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
# ● アイテムアクション 結果作成
#--------------------------------------------------------------------------
alias ctb_make_item_action_result make_item_action_result
def make_item_action_result
# アイテムを取得
@item = $data_items[@active_battler.current_action.item_id]
# アイテム切れなどで使用できなくなった場合
unless $game_party.item_can_use?(@item.id)
# CTをクリア
declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
# ステップ 1 に移行
@phase4_step = 1
return
end
ctb_make_item_action_result
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
#--------------------------------------------------------------------------
alias update_phase4_step5_ctb update_phase4_step5
def update_phase4_step5
# ダメージを記録
for target in @target_battlers
if target.damage != nil
target.movable_backup = target.movable?
end
end
update_phase4_step5_ctb
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias update_phase4_step6_ctb update_phase4_step6
def update_phase4_step6
@active_battler.countup = true
if @active_battler.current_action.basic == 1
# 防御
declease_ct(@active_battler,100-PARA_CTB::ACT_GUARD_CT)
else
case @active_battler.current_action.kind
# 攻撃
when 0
declease_ct(@active_battler,100-PARA_CTB::ACT_ATTACK_CT)
# スキル
when 1
declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
# アイテム
when 2
declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
else
clear_ct(@active_battler)
end
end
# ターゲットが行動不能になったらCTを0に
for target in @target_battlers
if target.movable? == false and target.movable_backup == true
clear_ct(target)
@status_window.refresh_ct
end
end
# エネミー名リストを更新
@status_window2.refresh
update_phase4_step6_ctb
end
#--------------------------------------------------------------------------
# ● アフターバトルフェーズ開始
#--------------------------------------------------------------------------
alias ctb_start_phase5 start_phase5
def start_phase5
@countup = false
ctb_start_phase5
end
end

#==============================================================================
# â–  Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(160, 320, 480, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
@before_hp = []
@before_sp = []
@before_states = []
@now_hp = []
@now_sp = []
@now_states = []
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i * line_height + 4
# 現在のステータスを配列に
@now_hp[i] = actor.hp
@now_sp[i] = actor.sp
@now_states[i] = actor.states
# レベルアップ
if @level_up_flags[i]
self.contents.fill_rect(344, actor_y+14, 100, 8, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
end
end
# バトルステータスの軽量化処理
# ステータスの配列が変化したときのみ描画処理
if @before_hp == nil or @before_sp == nil or @before_states == nil or
@before_hp != @now_hp or @before_sp != @now_sp or @before_states != @now_states
self.contents.clear
for i2 in 0...$game_party.actors.size
actor = $game_party.actors[i2]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i2 * line_height + 4
self.contents.font.size = PARA_CTB::NAME_FONT_SIZE
# 名前を描画
draw_actor_name(actor, 4, actor_y+16-PARA_CTB::NAME_FONT_SIZE)
# HPを描画
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(actor.hp, actor.maxhp, 125, actor_y+14, 80, 8, hp_color1, hp_color2)
draw_actor_hp(actor, 102, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
# SPを描画
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(actor.sp, actor.maxsp, 245, actor_y+14, 80, 8, sp_color1, sp_color2)
draw_actor_sp(actor, 222, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
# 変化後のステータスを配列に
@before_hp[i2] = actor.hp
@before_sp[i2] = actor.sp
@before_states[i2] = actor.states
# レベルアップ
if @level_up_flags[i2]
self.contents.fill_rect(344, actor_y, 100, 8, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
end
end
end
refresh_ct
end
#--------------------------------------------------------------------------
# ● CTゲージのリフレッシュ
#--------------------------------------------------------------------------
def refresh_ct
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i * line_height + 4
# CTが満タンになったときのゲージの色
ct_color_full = PARA_CTB::COLOR_FULL
# CTゲージの色(左端)
ct_color_start = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
# CTゲージの色(右端)
ct_color_end = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
if @level_up_flags[i] != true and actor.ct_visible
draw_meter(actor.now_ct, actor.max_ct, 344, actor_y+14, 100, 8, ct_color_start, ct_color_end)
elsif @level_up_flags[i] != true
draw_meter(0, actor.max_ct, 344, actor_y+14, 100, 8, ct_color_start, ct_color_end)
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
end
#--------------------------------------------------------------------------
# ● HP の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# 文字列 "HP" を描画
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(x, y+2, 32, 32, $data_system.words.hp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
if PARA_CTB::MAX_DRAW
# MaxHP を描画
self.contents.draw_text(x, y, width, 32, actor.maxhp.to_s, 2)
text_size = self.contents.text_size(actor.maxhp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x, y, 12, 32, "/", 1)
# HP を描画
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x, y, text_size.width, 32, actor.hp.to_s, 2)
else
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(x, y, width, 32, actor.hp.to_s, 2)
end
end
#--------------------------------------------------------------------------
# ● SP の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# 文字列 "SP" を描画
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(x, y+2, 32, 32, $data_system.words.sp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
if PARA_CTB::MAX_DRAW
# MaxSP を描画
self.contents.draw_text(x, y, width, 32, actor.maxsp.to_s, 2)
text_size = self.contents.text_size(actor.maxsp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x, y, 12, 32, "/", 1)
# SP を描画
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x, y, text_size.width, 32, actor.sp.to_s, 2)
else
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(x, y, width, 32, actor.sp.to_s, 2)
end
end
end

#==============================================================================
# □ 敵の名前を表示するウインドウ
#==============================================================================

class Window_BattleStatus_enemy < Window_Base
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 320, 160, 160)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ○ リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::ENEMY_FONT_SIZE
@exist_enemies = []
if $game_troop.enemies != nil
if PARA_CTB::ENEMY_GROUPING
ememy_list = []
ememy_list_index = []
# エネミーをグループ化
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.exist?
if ememy_list.include?(enemy.name)
ememy_list_index[ememy_list.index(enemy.name)] += 1
else
# エネミー名を記録
ememy_list.push(enemy.name)
ememy_list_index[ememy_list.index(enemy.name)] = 1
end
end
end
# エネミーの名前と数を描画
enemy_index = 0
for enemy_name in ememy_list
enemy_y = enemy_index * (PARA_CTB::ENEMY_FONT_SIZE+6) + 4
if ememy_list_index[enemy_index] > 1
enemy_name = enemy_name + " " + ememy_list_index[enemy_index].to_s
end
self.contents.draw_text(4, enemy_y, 160, 20, enemy_name)
enemy_index += 1
end
else
# エネミーの名前を描画
enemy_index = 0
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.exist?
@exist_enemies.push(enemy)
line_height = PARA_CTB::ENEMY_FONT_SIZE + 6
if PARA_CTB::ENEMY_DRAWING_MATER != 0
line_height += 10
end
enemy_y = enemy_index * line_height + 4
self.contents.draw_text(4, enemy_y, 160, 20, enemy.name)
enemy_index += 1
if PARA_CTB::ENEMY_DRAWING_MATER == 1
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
draw_meter(enemy.hp, enemy.maxhp, 4, y, 80, 8, hp_color1, hp_color2)
end
end
end
end
end
refresh_ct
end
#--------------------------------------------------------------------------
# ● CTゲージのリフレッシュ
#--------------------------------------------------------------------------
def refresh_ct
if PARA_CTB::ENEMY_DRAWING_MATER == 2 and @exist_enemies != nil
enemy_index = 0
for enemy in @exist_enemies
line_height = PARA_CTB::ENEMY_FONT_SIZE + 16
enemy_y = enemy_index * line_height + 4
y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
# CTが満タンになったときのゲージの色
ct_color_full = PARA_CTB::COLOR_FULL
# CTゲージの色(左端)
ct_color_start = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
# CTゲージの色(右端)
ct_color_end = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
if enemy.ct_visible
draw_meter(enemy.now_ct, enemy.max_ct, 4, y, 100, 8, ct_color_start, ct_color_end)
else
draw_meter(0, enemy.max_ct, 4, y, 100, 8, ct_color_start, ct_color_end)
end
enemy_index += 1
end
end
end
end

#==============================================================================
# â–  Window_Base
#==============================================================================

class Window_Base < Window

#--------------------------------------------------------------------------
# ○ ゲージを描画
#--------------------------------------------------------------------------
def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
self.contents.fill_rect(x, y, width, height, PARA_CTB::FRAME_COLOR)
self.contents.fill_rect(x+PARA_CTB::FRAME_BORDER, y+PARA_CTB::FRAME_BORDER, width-

PARA_CTB::FRAME_BORDER*2, height-PARA_CTB::FRAME_BORDER*2, PARA_CTB::BACK_COLOR)
now = now > max ? max : now
percentage = max != 0 ? (width-2) * now / max.to_f : 0
if start_color == end_color
self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color)
else
for i in 1..percentage
r = start_color.red + (end_color.red - start_color.red) / percentage * i
g = start_color.green + (end_color.green - start_color.green) / percentage * i
b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))
end
end
end
end

#==============================================================================
# â–  Game_Battler
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :max_ct
attr_accessor :now_ct
attr_accessor :full_ct
attr_accessor :countup
attr_accessor :ct_visible
attr_accessor :movable_backup
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias ctb_initialize initialize
def initialize
ctb_initialize
@max_ct = 0
@now_ct = 0
@full_ct = false
@countup = true
@ct_visible = true
end
end

#==============================================================================
# â–  Sprite_Battler
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias ctb_update update
def update
ctb_update
if @battler != nil
if @battler.full_ct and @battler.ct_visible
# CTが溜まったバトラーの色調を変化させる
fullct_color = PARA_CTB::FULL_CT_COLOR
self.tone = fullct_color
else
fullct_color = Tone.new(0,0,0)
self.tone = fullct_col
Can u make it so it shows the enemy characterset instead?
Great script, thanks for posting it.
Updated to 2.58, and web address is changed: http://2d6.parasite.jp/
Quote:
2006/9/16 ver.2.58
 設定項目「アニメーション表示時にCTのカウントを止める」をtrueにしたとき CTゲージが止まらなかった問題(ver.2.57で発生)を修正。


[spoiler=Active Time Battle 2.58]
[code]
#==============================================================================
# ++ アクティブタイムバトル ver. 2.58 ++
#  Script by パラ犬
#  http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# CTゲージが溜まったバトラーから順にコマンド入力する戦闘形式。
# バトルステータス画面をサイドビューらしくする機能もあります。
# バトラーをサイドビュータイプに表示するスクリプトは、お好きなものを
# 用意してください。
#------------------------------------------------------------------------------
#[設置上の注意]
# 戦闘系スクリプトを併用するときはできるだけ上のほうに置いてください。
# (Scene_Debugよりは下)
#------------------------------------------------------------------------------
#[操作]
#・逃走
# 味方バトラーの一人以上がコマンド入力待ちのときにキャンセルボタンを押すことで
# 「逃げる」コマンドが選択できます。
# 敵の数が多かったり、コマンド入力待ちのバトラーが少ないと、
# 逃走成功率が低くなります。
#
#・行動順の入れ替え
# 複数のバトラーが行動可能のとき、
# Rボタン(PageDownキー)で次のバトラーと順番を入れ替え、
# Lボタン(PageUpキー)で行動順をいちばん最後に回します。
#==============================================================================

module PARA_CTB

# コマンド入力時にCTのカウントを止めるか(true:止める / false:止めない)
COMMAND_WAIT = false
# アイテム、スキル、ターゲット選択時にCTのカウントを止めるか(true:止める / false:止めない)
SELECT_WAIT = true
# アニメーション表示時にCTのカウントを止めるか(true:止める / false:止めない)
ANIMATION_WAIT = false

# バトルスピード(数値が大きいほどCTの溜まりが速くなる)
BATTLE_SPEED = 3

# バトルメンバーの最大数(多人数PTスクリプトを導入している時に設定)
PARTY_SIZE = 4

# 行動終了時のCT減少パーセンテージ
ACT_ATTACK_CT = 100 # 通常攻撃
ACT_GUARD_CT = 100 # 防御
ACT_ESCAPE_CT = 100 # 逃走失敗
ACT_SKILL_CT = 100 # スキル
ACT_ITEM_CT = 100 # アイテム

# 逃走失敗時のメッセージ
UNESCAPE_MES = "逃走失敗"

# CT満タン時の効果音(""で音を鳴らさない)
# 効果音は「Audio/SE」フォルダ内
FULL_CT_SE = "015-Jump01"
# 効果音のボリューム
FULL_CT_SE_VOL = 80

# CT満タン時のバトラーの色調((0,0,0)で変化なし)
FULL_CT_COLOR = Tone.new(32,0,0)

# HPゲージの色(グラデーション左端)
HP_COLOR_LEFT = Color.new(128, 0, 0, 255)
# HPゲージの色(グラデーション右端)
HP_COLOR_RIGHT= Color.new(255, 0, 0, 255)
# SPゲージの色(グラデーション左端)
SP_COLOR_LEFT = Color.new(0, 0, 128, 255)
# SPゲージの色(グラデーション右端)
SP_COLOR_RIGHT= Color.new(0, 0, 255, 255)
# CTゲージの色(グラデーション左端)
COLOR_LEFT = Color.new(128, 128, 64, 255)
# CTゲージの色(グラデーション右端)
COLOR_RIGHT= Color.new(255, 255, 128, 255)
# CTが満タンになったときのゲージの色
COLOR_FULL = Color.new(255, 225, 128, 255)

# ゲージ枠の色
FRAME_COLOR = Color.new(192, 192, 192, 255)
# ゲージ枠の太さ
FRAME_BORDER = 1
# ゲージの背景色
BACK_COLOR = Color.new(128, 128, 128, 128)

# 名前のフォントサイズ
NAME_FONT_SIZE = 16
# HP/SPのフォントサイズ
HPSP_FONT_SIZE = 18
# エネミー名のフォントサイズ
ENEMY_FONT_SIZE = 16
# 最大HP/SPを描画するか( true / false )
MAX_DRAW = false

# エネミー名をグループ化( true / false )
# (trueにすると「ゴースト 2」のようにまとめて表示します)
ENEMY_GROUPING = false

# エネミー名の下にゲージを表示( 0:なし / 1:HP / 2:CT )
# (エネミー名をグループ化している場合は無効)
ENEMY_DRAWING_MATER = 0

# アクターのヘルプウインドウにHP/SPゲージを表示( true / false )
HELP_DRAWING_MATER_ACTOR = false
# エネミーのヘルプウインドウにHP/SPゲージを表示( true / false )
HELP_DRAWING_MATER_ENEMY = false

# コマンドウインドウの位置を強制指定( true / false )
#(他の方のサイドビュースクリプトを併用していて
# コマンドウインドウの位置がどうしても不自然になるならtrueに)
# ※trueにしても適用されない場合、このスクリプトを
#  サイドビューよりも下に置いてみてください
WINDOWPOS_CHANGE = false
WINDOWPOS_X = 100 # X座標
WINDOWPOS_Y = 320 # Y座標

# コマンドウインドウの不透明度
WINDOW_OPACITY = 160

# CTのカウント間隔。少ないほどゲージ描画がなめらかに。(最小値は0)
# 処理が重い場合は、この数値を上げてください。
CT_SKIP = 2

end

# ↑ 設定項目ここまで
#------------------------------------------------------------------------------

#==============================================================================
# â–  Scene_Battle
#==============================================================================

class Scene_Battle

#--------------------------------------------------------------------------
# ○ CTのカウント
#--------------------------------------------------------------------------
def update_ct
# カウントアップが許可されているとき
if @countup
for actor in $game_party.actors
# 行動できるか
if actor.movable? == false and actor.ct_visible and @phase4_step != 5
# 不可視状態でカウントアップ
actor.ct_visible = false
actor.countup = true
actor.full_ct = false
elsif actor.movable? and actor.ct_visible == false
# 不可視カウントアップを解除
clear_ct(actor)
actor.ct_visible = true
end
# アクターの入れ替えに対応
if actor.max_ct == 0
actor.max_ct = @max_ct
end
# アクターのカウントアップ
if actor.countup
# CTがmaxになっており、コマンド入力待ちアクターに含まれない
if actor.now_ct >= @max_ct and !(@pre_action_battlers.include?(actor))
# コマンド入力待ちアクターに追加
@pre_action_battlers.push(actor)
@action_count += 1
# 効果音を鳴らす
if PARA_CTB::FULL_CT_SE != "" and actor.ct_visible
Audio.se_play("Audio/SE/" + PARA_CTB::FULL_CT_SE,PARA_CTB::FULL_CT_SE_VOL)
end
# それ以上カウントアップしない
actor.countup = false
actor.full_ct = true
else
# カウントアップ
actor.make_action_speed
ct_skip = PARA_CTB::CT_SKIP != 0 ? PARA_CTB::CT_SKIP : 1
actor.now_ct += actor.current_action.speed * PARA_CTB::BATTLE_SPEED * ct_skip
end
end
end
for enemy in $game_troop.enemies
# 行動できるか
if enemy.movable? == false and enemy.ct_visible and @phase4_step == 5
# 不可視状態でカウントアップ
enemy.ct_visible = false
enemy.countup = true
enemy.full_ct = false
elsif enemy.movable? and enemy.ct_visible == false
# 不可視カウントアップを解除
clear_ct(enemy)
enemy.ct_visible = true
end
# エネミーのカウントアップ
if enemy.countup
# CTがmaxになっており、行動待ちエネミーに含まれない
if enemy.now_ct >= @max_ct and ! @pre_action_battlers.include?(enemy)
# 行動待ちエネミーに追加
@pre_action_battlers.push(enemy)
@action_count += 1
# それ以上カウントアップしない
enemy.countup = false
enemy.full_ct = true
else
# カウントアップ
enemy.make_action_speed
enemy.now_ct += enemy.current_action.speed * PARA_CTB::BATTLE_SPEED
end
end
end
# CTゲージを再描画
@status_window.refresh_ct
@status_window2.refresh_ct
end
end
#--------------------------------------------------------------------------
# ○ バトラーのCTを0に
#--------------------------------------------------------------------------
def clear_ct(battler)
battler.countup = true
battler.now_ct = 0
battler.full_ct = false
end
#--------------------------------------------------------------------------
# ○ バトラーのCTを任意のパーセンテージに
#--------------------------------------------------------------------------
def declease_ct(battler,percent)
battler.countup = true
battler.now_ct = battler.now_ct * percent / 100
battler.full_ct = false
end
#--------------------------------------------------------------------------
# ○ CTの初期化
#--------------------------------------------------------------------------
def initialize_ct
# CTの基準値を決定
max_ct
for battler in $game_party.actors + $game_troop.enemies
if battler.movable?
n = $game_party.actors.size + $game_troop.enemies.size
# 戦闘開始時にある程度のCTを溜めておく
battler.now_ct = battler.agi * 60 * n
battler.ct_visible = true
else
clear_ct(battler)
battler.ct_visible = false
end
battler.countup = true
battler.full_ct = false
battler.max_ct = @max_ct
end
end
#--------------------------------------------------------------------------
# ○ バトラー全員の素早さからCTの基準値を決定
#--------------------------------------------------------------------------
def max_ct
for battler in $game_party.actors + $game_troop.enemies
@max_ct += battler.agi
end
@max_ct *= 100
end
#--------------------------------------------------------------------------
# ○ バトラーの行動順を変更
#--------------------------------------------------------------------------
def shift_activer(shift)
# 一つシフトする時で後ろのアクターが2人以上
if @pre_action_battlers != nil
if shift == 1 and @pre_action_battlers.size >= @actor_array_index + 3
# 現在のアクターを取得
act = @pre_action_battlers[@actor_array_index]
# 現在のアクターを二つ後ろに挿入
@pre_action_battlers.insert(@actor_array_index+2, act)
# 現在位置を消去
@pre_action_battlers.delete_at(@actor_array_index)
@actor_array_index -= 1
phase3_next_actor
else
act = @pre_action_battlers[@actor_array_index]
# 現在のアクターを一番後ろに追加
@pre_action_battlers.push(act)
# 現在位置を消去
@pre_action_battlers.delete_at(@actor_array_index)
@actor_array_index -= 1
phase3_next_actor
end
end
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias main_ctb main
def main
# エネミー名ウインドウを作成
@status_window2 = Window_BattleStatus_enemy.new
@action_battlers = []
@pre_action_battlers = []
@max_ct = 0
@countup = false
@ct_wait = 0
@action_count = 0
main_ctb
# エネミー名ウインドウを破棄
@status_window2.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias ctb_update update
def update
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
# インタプリタを更新
$game_system.battle_interpreter.update
# アクションを強制されているバトラーが存在しない場合
if $game_temp.forcing_battler == nil
# バトルイベントの実行が終わった場合
unless $game_system.battle_interpreter.running?
# 戦闘継続の場合、バトルイベントのセットアップを再実行
unless judge
setup_battle_event
end
end
# アフターバトルフェーズでなければ
if @phase != 5
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# エネミー名リストを更新
@status_window2.refresh
end
end
else
if PARA_CTB::CT_SKIP == 0
update_ct
else
if @ct_wait > 0
@ct_wait -= 1
else
update_ct
@ct_wait = PARA_CTB::CT_SKIP
end
end
end
ctb_update
end
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias ctb_start_phase1 start_phase1
def start_phase1
# CTを初期化
initialize_ct
# カウントアップ開始
@countup = true

ctb_start_phase1
end
#--------------------------------------------------------------------------
# ● フレーム更新 (プレバトルフェーズ)
#--------------------------------------------------------------------------
def update_phase1
# エネミー名リストを更新
@status_window2.refresh
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# パーティーコマンドフェーズを飛ばしてアクターコマンドフェーズ開始
start_phase3
end
#--------------------------------------------------------------------------
# ● パーティコマンドフェーズ開始
#--------------------------------------------------------------------------
def start_phase2
# フェーズ 2 に移行
@phase = 2
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# パーティコマンドウィンドウを有効化
@party_command_window.active = true
@party_command_window.visible = true
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
# メインフェーズフラグをクリア
$game_temp.battle_main_phase = false
# コマンド入力不可能な場合
unless $game_party.inputable?
# メインフェーズ開始
start_phase4
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
#--------------------------------------------------------------------------
def update_phase2_escape
# エネミーの素早さ合計を計算
enemies_agi = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
end
end
# 行動可能アクターの素早さ合計を計算
actors_agi = 0
for actor in @pre_action_battlers
if actor.is_a?(Game_Actor) and actor.exist?
actors_agi += actor.agi
end
end
# 逃走成功判定
success = rand(100) < 50 * actors_agi / enemies_agi
# 逃走成功の場合
if success
# 逃走 SE を演奏
$game_system.se_play($data_system.escape_se)
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# CTをクリア
for battler in $game_party.actors
clear_ct(battler)
end
# バトル終了
battle_end(1)
# 逃走失敗の場合
else
# ヘルプウィンドウに "逃走失敗" をセット
@help_window.set_text(PARA_CTB::UNESCAPE_MES, 1)
# アクターのアクションとCTをクリア
pre_action_battlers = @pre_action_battlers.clone
for act in pre_action_battlers
if act.is_a?(Game_Actor)
declease_ct(act, 100-PARA_CTB::ACT_ESCAPE_CT)
act.current_action.clear
@pre_action_battlers.delete(act)
end
end
@party_command_window.visible = false
# ヘルプウィンドウを表示
@help_window.visible = true
@wait_count = 20
# メインフェーズ開始
start_phase4
end
end
#--------------------------------------------------------------------------
# ● アクターコマンドフェーズ開始
#--------------------------------------------------------------------------
def start_phase3
# フェーズ 3 に移行
@phase = 3
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
@actor_array_index = -1
# 次のアクターのコマンド入力へ
if @pre_action_battlers != []
phase3_next_actor
else
start_phase4
end
end
#--------------------------------------------------------------------------
# ● 次のアクターのコマンド入力へ
#--------------------------------------------------------------------------
def phase3_next_actor
# ループ
begin
# アクターの明滅エフェクト OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最後のアクターの場合
if @actor_array_index + 1 == @pre_action_battlers.size
# メインフェーズ開始
start_phase4
return
#次がエネミーの場合
elsif $game_troop.enemies.include?(@pre_action_battlers[@actor_array_index + 1])
# メインフェーズ開始
start_phase4
return
end
# アクターのインデックスを進める
@actor_array_index += 1
@actor_index = @pre_action_battlers[@actor_array_index].index
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
@active_battler.current_action.clear
# アクターがコマンド入力を受け付けない状態ならもう一度
end until @active_battler.inputable?
# アクターコマンドウィンドウをセットアップ
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 前のアクターのコマンド入力へ
#--------------------------------------------------------------------------
def phase3_prior_actor
# ループ
begin
# アクターの明滅エフェクト OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最初のアクターの場合
if @actor_array_index <= 0
# アクターコマンドフェーズ開始
start_phase2
return
end
# アクターのインデックスを戻す
@actor_array_index -= 1
@actor_index = @pre_action_battlers[@actor_array_index].index
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
@active_battler.current_action.clear
# アクターがコマンド入力を受け付けない状態ならもう一度
end until @active_battler.inputable?
# アクターコマンドウィンドウをセットアップ
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias phase3_setup_command_window_ctb phase3_setup_command_window
def phase3_setup_command_window
@actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY
phase3_setup_command_window_ctb
if PARA_CTB::WINDOWPOS_CHANGE
# アクターコマンドウィンドウの位置を設定
@actor_command_window.x = PARA_CTB::WINDOWPOS_X
@actor_command_window.y = PARA_CTB::WINDOWPOS_Y
# ステータスウインドウに隠れないように
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ)
#--------------------------------------------------------------------------
def update_phase3
# エネミーアローが有効の場合
if @enemy_arrow != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_enemy_select
# アクターアローが有効の場合
elsif @actor_arrow != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_actor_select
# スキルウィンドウが有効の場合
elsif @skill_window != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_skill_select
# アイテムウィンドウが有効の場合
elsif @item_window != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_item_select
# アクターコマンドウィンドウが有効の場合
elsif @actor_command_window.active
@countup = PARA_CTB::COMMAND_WAIT ? false : true
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
#--------------------------------------------------------------------------
alias ctb_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
ctb_update_phase3_basic_command
# LRボタンで行動順を変更
if Input.trigger?(Input::R)
shift_activer(1)
end
if Input.trigger?(Input::L)
shift_activer(-1)
end
end
#--------------------------------------------------------------------------
# ● メインフェーズ開始
#--------------------------------------------------------------------------
def start_phase4
# フェーズ 4 に移行
@phase = 4
battler_count = $game_party.actors.size + $game_troop.enemies.size
if @action_count >= battler_count or $game_temp.battle_turn == 0
# バトルイベントの全ページを検索
for index in 0...$data_troops[@troop_id].pages.size
# イベントページを取得
page = $data_troops[@troop_id].pages[index]
# このページのスパンが [ターン] の場合
if page.span == 1
# 実行済みフラグをクリア
$game_temp.battle_event_flags[index] = false
end
end
# ターン数カウント
$game_temp.battle_turn += 1
@action_count = 0
end
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# パーティコマンドウィンドウを有効化
@party_command_window.active = false
@party_command_window.visible = false
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
# メインフェーズフラグをセット
$game_temp.battle_main_phase = true
# エネミーアクション作成
for enemy in $game_troop.enemies
enemy.make_action
end
# 行動順序作成
make_action_orders
# ステップ 1 に移行
@phase4_step = 1
end
#--------------------------------------------------------------------------
# ● 行動順序作成
#--------------------------------------------------------------------------
def make_action_orders
# 配列 @action_battlers を初期化
@action_battlers = []
if @pre_action_battlers != []
for i in 0..@actor_array_index
# アクターを配列 @action_battlers に追加
@action_battlers.push(@pre_action_battlers[0])
@pre_action_battlers.shift
end
if @pre_action_battlers.size != 0
loop do
if $game_troop.enemies.include?(@pre_action_battlers[0])
# エネミーを配列 @action_battlers に追加
@action_battlers.push(@pre_action_battlers[0])
@pre_action_battlers.shift
else
break
end
end
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
#--------------------------------------------------------------------------
alias ctb_update_phase4_step1 update_phase4_step1
def update_phase4_step1
@countup = true
# ヘルプウィンドウを隠す
@help_window.visible = false
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# 未行動バトラーが存在しない場合 (全員行動した)
if @action_battlers.size == 0
# アクターコマンドフェーズ開始
start_phase3
return
end
ctb_update_phase4_step1
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
alias ctb_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# 制約が [行動できない] の場合
if @active_battler.restriction == 4
# CTをクリア
clear_ct(@active_battler)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# アニメーション再生中にCTをカウントするか
@countup = PARA_CTB::ANIMATION_WAIT ? false : true
ctb_update_phase4_step2
end
#--------------------------------------------------------------------------
# ● 基本アクション 結果作成
#--------------------------------------------------------------------------
alias make_basic_action_result_ctb make_basic_action_result
def make_basic_action_result
# 何もしないの場合
if @active_battler.current_action.basic == 3
# CTをクリア
clear_ct(@active_battler)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
make_basic_action_result_ctb
end
#--------------------------------------------------------------------------
# ● スキルアクション 結果作成
#--------------------------------------------------------------------------
def make_skill_action_result
# スキルを取得
@skill = $data_skills[@active_battler.current_action.skill_id]
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# SP 切れなどで使用できなくなった場合
unless @active_battler.skill_can_use?(@skill.id)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# CTをクリア
declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# SP 消費
@active_battler.sp -= @skill.sp_cost
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# ヘルプウィンドウにスキル名を表示
@help_window.set_text(@skill.name, 1)
# アニメーション ID を設定
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# コモンイベント ID を設定
@common_event_id = @skill.common_event_id
# 対象側バトラーを設定
set_target_battlers(@skill.scope)
# スキルの効果を適用
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
# ● アイテムアクション 結果作成
#--------------------------------------------------------------------------
alias ctb_make_item_action_result make_item_action_result
def make_item_action_result
# アイテムを取得
@item = $data_items[@active_battler.current_action.item_id]
# アイテム切れなどで使用できなくなった場合
unless $game_party.item_can_use?(@item.id)
# CTをクリア
declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
# ステップ 1 に移行
@phase4_step = 1
return
end
ctb_make_item_action_result
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
#--------------------------------------------------------------------------
alias update_phase4_step5_ctb update_phase4_step5
def update_phase4_step5
# ダメージを記録
for target in @target_battlers
if target.damage != nil
target.movable_backup = target.movable?
end
end
update_phase4_step5_ctb
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias update_phase4_step6_ctb update_phase4_step6
def update_phase4_step6
@active_battler.countup = true
if @active_battler.current_action.basic == 1
# 防御
declease_ct(@active_battler,100-PARA_CTB::ACT_GUARD_CT)
else
case @active_battler.current_action.kind
# 攻撃
when 0
declease_ct(@active_battler,100-PARA_CTB::ACT_ATTACK_CT)
# スキル
when 1
declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
# アイテム
when 2
declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
else
clear_ct(@active_battler)
end
end
# ターゲットが行動不能になったらCTを0に
for target in @target_battlers
if target.movable? == false and target.movable_backup == true
clear_ct(target)
@status_window.refresh_ct
end
end
# エネミー名リストを更新
@status_window2.refresh
update_phase4_step6_ctb
end
#--------------------------------------------------------------------------
# ● アフターバトルフェーズ開始
#--------------------------------------------------------------------------
alias ctb_start_phase5 start_phase5
def start_phase5
@countup = false
ctb_start_phase5
end
end

#==============================================================================
# â–  Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(160, 320, 480, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
@before_hp = []
@before_sp = []
@before_states = []
@now_hp = []
@now_sp = []
@now_states = []
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i * line_height + 4
# 現在のステータスを配列に
@now_hp[i] = actor.hp
@now_sp[i] = actor.sp
@now_states[i] = actor.states
# レベルアップ
if @level_up_flags[i]
self.contents.fill_rect(344, actor_y+14, 100, 8, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
end
end
# バトルステータスの軽量化処理
# ステータスの配列が変化したときのみ描画処理
if @before_hp == nil or @before_sp == nil or @before_states == nil or
@before_hp != @now_hp or @before_sp != @now_sp or @before_states != @now_states
self.contents.clear
for i2 in 0...$game_party.actors.size
actor = $game_party.actors[i2]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i2 * line_height + 4
self.contents.font.size = PARA_CTB::NAME_FONT_SIZE
# 名前を描画
draw_actor_name(actor, 4, actor_y+16-PARA_CTB::NAME_FONT_SIZE)
# HPを描画
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(actor.hp, actor.maxhp, 125, actor_y+14, 80, 8, hp_color1, hp_color2)
draw_actor_hp(actor, 102, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
# SPを描画
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(actor.sp, actor.maxsp, 245, actor_y+14, 80, 8, sp_color1, sp_color2)
draw_actor_sp(actor, 222, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
# 変化後のステータスを配列に
@before_hp[i2] = actor.hp
@before_sp[i2] = actor.sp
@before_states[i2] = actor.states
# レベルアップ
if @level_up_flags[i2]
self.contents.fill_rect(344, actor_y, 100, 8, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
end
end
end
refresh_ct
end
#--------------------------------------------------------------------------
# ● CTゲージのリフレッシュ
#--------------------------------------------------------------------------
def refresh_ct
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
line_height = 120 / PARA_CTB::PARTY_SIZE
actor_y = i * line_height + 4
# CTが満タンになったときのゲージの色
ct_color_full = PARA_CTB::COLOR_FULL
# CTゲージの色(左端)
ct_color_start = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
# CTゲージの色(右端)
ct_color_end = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
if @level_up_flags[i] != true and actor.ct_visible
draw_meter(actor.now_ct, actor.max_ct, 344, actor_y+14, 100, 8, ct_color_start, ct_color_end)
elsif @level_up_flags[i] != true
draw_meter(0, actor.max_ct, 344, actor_y+14, 100, 8, ct_color_start, ct_color_end)
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
end
#--------------------------------------------------------------------------
# ● HP の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# 文字列 "HP" を描画
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(x, y+2, 32, 32, $data_system.words.hp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
if PARA_CTB::MAX_DRAW
# MaxHP を描画
self.contents.draw_text(x, y, width, 32, actor.maxhp.to_s, 2)
text_size = self.contents.text_size(actor.maxhp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x, y, 12, 32, "/", 1)
# HP を描画
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x, y, text_size.width, 32, actor.hp.to_s, 2)
else
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(x, y, width, 32, actor.hp.to_s, 2)
end
end
#--------------------------------------------------------------------------
# ● SP の描画
# actor : アクター
# x : 描画先 X 座標
# y : 描画先 Y 座標
# width : 描画先の幅
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# 文字列 "SP" を描画
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(x, y+2, 32, 32, $data_system.words.sp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
if PARA_CTB::MAX_DRAW
# MaxSP を描画
self.contents.draw_text(x, y, width, 32, actor.maxsp.to_s, 2)
text_size = self.contents.text_size(actor.maxsp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x, y, 12, 32, "/", 1)
# SP を描画
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x, y, text_size.width, 32, actor.sp.to_s, 2)
else
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(x, y, width, 32, actor.sp.to_s, 2)
end
end
end

#==============================================================================
# □ 敵の名前を表示するウインドウ
#==============================================================================

class Window_BattleStatus_enemy < Window_Base
#--------------------------------------------------------------------------
# ○ オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 320, 160, 160)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ○ リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::ENEMY_FONT_SIZE
@exist_enemies = []
if $game_troop.enemies != nil
if PARA_CTB::ENEMY_GROUPING
ememy_list = []
ememy_list_index = []
# エネミーをグループ化
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.exist?
if ememy_list.include?(enemy.name)
ememy_list_index[ememy_list.index(enemy.name)] += 1
else
# エネミー名を記録
ememy_list.push(enemy.name)
ememy_list_index[ememy_list.index(enemy.name)] = 1
end
end
end
# エネミーの名前と数を描画
enemy_index = 0
for enemy_name in ememy_list
enemy_y = enemy_index * (PARA_CTB::ENEMY_FONT_SIZE+6) + 4
if ememy_list_index[enemy_index] > 1
enemy_name = enemy_name + " " + ememy_list_index[enemy_index].to_s
end
self.contents.draw_text(4, enemy_y, 160, 20, enemy_name)
enemy_index += 1
end
else
# エネミーの名前を描画
enemy_index = 0
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies[i]
if enemy.exist?
@exist_enemies.push(enemy)
line_height = PARA_CTB::ENEMY_FONT_SIZE + 6
if PARA_CTB::ENEMY_DRAWING_MATER != 0
line_height += 10
end
enemy_y = enemy_index * line_height + 4
self.contents.draw_text(4, enemy_y, 160, 20, enemy.name)
enemy_index += 1
if PARA_CTB::ENEMY_DRAWING_MATER == 1
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
draw_meter(enemy.hp, enemy.maxhp, 4, y, 80, 8, hp_color1, hp_color2)
end
end
end
end
end
refresh_ct
end
#--------------------------------------------------------------------------
# ● CTゲージのリフレッシュ
#--------------------------------------------------------------------------
def refresh_ct
if PARA_CTB::ENEMY_DRAWING_MATER == 2 and @exist_enemies != nil
enemy_index = 0
for enemy in @exist_enemies
line_height = PARA_CTB::ENEMY_FONT_SIZE + 16
enemy_y = enemy_index * line_height + 4
y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
# CTが満タンになったときのゲージの色
ct_color_full = PARA_CTB::COLOR_FULL
# CTゲージの色(左端)
ct_color_start = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
# CTゲージの色(右端)
ct_color_end = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
if enemy.ct_visible
draw_meter(enemy.now_ct, enemy.max_ct, 4, y, 100, 8, ct_color_start, ct_color_end)
else
draw_meter(0, enemy.max_ct, 4, y, 100, 8, ct_color_start, ct_color_end)
end
enemy_index += 1
end
end
end
end

#==============================================================================
# â–  Window_Base
#==============================================================================

class Window_Base < Window

#--------------------------------------------------------------------------
# ○ ゲージを描画
#--------------------------------------------------------------------------
def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
self.contents.fill_rect(x, y, width, height, PARA_CTB::FRAME_COLOR)
self.contents.fill_rect(x+PARA_CTB::FRAME_BORDER, y+PARA_CTB::FRAME_BORDER, width-

PARA_CTB::FRAME_BORDER*2, height-PARA_CTB::FRAME_BORDER*2, PARA_CTB::BACK_COLOR)
now = now > max ? max : now
percentage = max != 0 ? (width-2) * now / max.to_f : 0
if start_color == end_color
self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color)
else
for i in 1..percentage
r = start_color.red + (end_color.red - start_color.red) / percentage * i
g = start_color.green + (end_color.green - start_color.green) / percentage * i
b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))
end
end
end
end

#==============================================================================
# â–  Game_Battler
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :max_ct
attr_accessor :now_ct
attr_accessor :full_ct
attr_accessor :countup
attr_accessor :ct_visible
attr_accessor :movable_backup
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias ctb_initialize initialize
def initialize
ctb_initialize
@max_ct = 0
@now_ct = 0
@full_ct = false
@countup = true
@ct_visible = true
end
end

#==============================================================================
# â–  Sprite_Battler
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias ctb_update update
def update
ctb_update
if @battler != nil
if @battler.full_ct and @battler.ct_visible
# CTが
is it possible to make th script use sprites, both enemy and player, at the doubled size? would be really cool, the chars on field won't look so lost ;)
greetz GoI
I know this was posted a while ago, but that's what I want too. (What GoI said).

Oh yeah, and I was also wondering how to set this up to work with RTAB.
You cannot make two battle systems work together, you know. I even could not make ParaDog's side view script with RTAB.(maybe someone can do it by modifying)
The main thing that makes me want to use RTAB is that you can't switch to another character in this battle system, you have to take action with the character that gets their ATB guage up first before you can do anyone else.
In RTAB, you can only use battlers who's AT gauge is full. Likewise, with ParaDog's v 2.58 that Landarma posted just days ago, you can have it set up the same so the gauge fills while the 'command window' is up.

They both have the ability to turn that on and off... just set up in different ways.

The only thing I see is that 'enemies' cannot attack until it is THEIR turn and attack while you're making up your mind.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=3213