One ATB script i like is KGC script
CODE
#==============================================================================
# KGC Active Count Battle
# By KGC
#==============================================================================
module KGC
# Set wait mode
# 0 = full active
# 1 = semi-active time stop to choose items and skills
# 2 = full wait, time stop to choose any action
ACB_WAIT_MODE = 2
# Can be changed with script calls during games
# call $game_system.wait_mode = 0/1/2
# Set if time bar will stop during actions
ACB_ACTION_WAIT = true
# Can be changed with script calls during games
# call $game_system.action_wait = true/false
# Set the battle speed
ACB_BATTLE_SPEED = 600
# Can be changed with script calls during games
# call $game_system.battle_speed = 100~800
# Set wait time for nornal attacks, value higher than 0
ACB_ATTACK_WAIT = 1
# Set wait time for defend, value higher than 0
ACB_GUARD_WAIT = 0.5
# Set wait time for skill, if you use skill chant, set it 0, othewise
# this should be higher than 0
ACB_SKILL_WAIT = 0
# Set wait time for items, value higher than 0
ACB_ITEM_WAIT = 0.1
# Set chant wait time
ACB_CHANT_WAIT = 0.75
# Set if skills will have chant time, if true skills will have chant time
# based on the following settings
ACB_SKILL_CHANT = true
# All Skill with Int_f X or higher will have chant
ACB_CHANT_SKILL_INT_F = 1
# All Skill with Atk_f X or higher will not have chant
ACB_NOT_CHANT_SKILL_ATK_F = 2
# Set individual chant time for skills.
# { Skill_ID => Chant, Skill_ID => Chant, ...}
ACB_CHANT_TIME = {}
# SE played when the ATB is full
ACB_MAX_SE = RPG::AudioFile.new("105-Heal01", 100, 150)
# Message displayed when trying to escape (to escape, keep Z pressed)
ACB_ESCAPE_MESSAGE = "Escaping..."
# Message displayed when it's not possible to escape
ACB_CANT_ESCAPE_MESSAGE = "Can't escape!!"
# Delay time if hit during input
ACB_INVALID_DELAY_INPUT = false
# Slip damage setting
# 0 = Slip damage will occur before action
# 1 = Slip damage will occur all at the turn end (wich occur after a
# set number of actions)
ACB_SLIP_DAMAGE = 0
# Use slant bars
ACB_GAUGE_SLANT = true
end
$imported["ActiveCountBattle"] = true
$game_special_elements["acb_delay"] = /Delay(\d+)/i
$game_special_elements["acb_delay_resist"] = $data_system.elements.index("Delay Tolerance")
#==============================================================================
# ** RPG::Cache
#------------------------------------------------------------------------------
#
#==============================================================================
module RPG::Cache
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def self.acb(filename, hue = 0)
self.load_bitmap("Graphics/ACB/", filename, hue)
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
attr_accessor :turn_acb_count
attr_accessor :acb_count_speed
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias initialize_KGC_ActiveCountBattle initialize
def initialize
initialize_KGC_ActiveCountBattle
@turn_acb_count, @acb_count_speed = 1000, 10
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def set_turn_acb_count(speed)
@turn_acb_count = speed * $game_system.battle_speed
@acb_count_speed = speed * 4 / $game_party.actors.size
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
attr_accessor :wait_mode
attr_accessor :action_wait
attr_accessor :battle_speed
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias initialize_KGC_ActiveCountBattle initialize
def initialize
initialize_KGC_ActiveCountBattle
@wait_mode = KGC::ACB_WAIT_MODE
@action_wait = KGC::ACB_ACTION_WAIT
@battle_speed = KGC::ACB_BATTLE_SPEED
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def battle_speed=(speed)
@battle_speed = [[speed, 100].max, 800].min
end
end
#==============================================================================
# ** Game_Battler (part 1)
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
attr_reader :acb_gauge
attr_accessor :chant_gauge_max
attr_accessor :turn_count
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias initialize_KGC_ActiveCountBattle initialize
def initialize
initialize_KGC_ActiveCountBattle
@acb_gauge, @acb_gauge_max = 0, 1000
@chant_gauge_max, @turn_count = 0, 0
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def acb_max
return @chant_gauge_max > 0 ? @chant_gauge_max : @acb_gauge_max
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def acb_gauge=(value)
@acb_gauge = [value, 0].max
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def acb_gauge_max
return @acb_gauge_max
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def set_acb_gauge
self.make_action_speed
n = $game_temp.turn_acb_count / 4
case @current_action.kind
when 0
case @current_action.basic
when 0
n *= KGC::ACB_ATTACK_WAIT
when 1
n *= KGC::ACB_GUARD_WAIT
end
when 1
if KGC::ACB_SKILL_WAIT > 0
n *= KGC::ACB_SKILL_WAIT
else
skill = $data_skills[@current_action.skill_id]
rate = skill.sp_cost + skill.power.abs + (skill.atk_f + skill.str_f +
skill.dex_f + skill.agi_f + skill.int_f) / 4.0
rate = Math.sqrt(rate) / 20 + 1
n *= rate
end
if KGC::ACB_SKILL_CHANT && @chant_gauge_max > 0
skill = $data_skills[@current_action.skill_id]
chant = skill.int_f >= KGC::ACB_CHANT_SKILL_INT_F &&
skill.atk_f < KGC::ACB_NOT_CHANT_SKILL_ATK_F
n *= KGC::ACB_CHANT_WAIT if chant
end
when 2
n *= KGC::ACB_ITEM_WAIT
end
@acb_gauge = 0
@acb_gauge_max = [n.round, 1].max
@chant_gauge_max = 0
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemies. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def make_action
self.current_action.clear
return unless self.movable?
available_actions = []
rating_max = 0
self.actions.each { |action|
n = @turn_count
a = action.condition_turn_a
b = action.condition_turn_b
next if (b == 0 && n != a) || (b > 0 && (n < 1 || n < a || n % b != a % b))
next if self.hp * 100.0 / self.maxhp > action.condition_hp
next if $game_party.max_level < action.condition_level
switch_id = action.condition_switch_id
next if switch_id > 0 && $game_switches[switch_id] == false
available_actions.push(action)
rating_max = action.rating if action.rating > rating_max
}
ratings_total = 0
available_actions.each { |action|
if action.rating > rating_max - 3
ratings_total += action.rating - (rating_max - 3)
end
}
if ratings_total > 0
value = rand(ratings_total)
available_actions.each { |action|
if action.rating > rating_max - 3
if value < action.rating - (rating_max - 3)
self.current_action.kind = action.kind
self.current_action.basic = action.basic
self.current_action.skill_id = action.skill_id
self.current_action.decide_random_target_for_enemy
return
else
value -= action.rating - (rating_max - 3)
end
end
}
end
end
end
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias set_text_KGC_ActiveCountBattle set_text
def set_text(text, align = 0)
last_actor = @actor
set_text_KGC_ActiveCountBattle(text, align)
@actor = last_actor
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def text
return @text
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def reset
@text, @actor = nil, nil
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias refresh_KGC_ActiveCountBattle refresh
def refresh(itemkind = 0)
if $imported["ItemGrouping"]
refresh_KGC_ActiveCountBattle(itemkind)
else
refresh_KGC_ActiveCountBattle
end
Graphics.frame_reset
end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias refresh_KGC_ActiveCountBattle refresh
def refresh(skillkind = 0)
if $imported["SkillGrouping"]
refresh_KGC_ActiveCountBattle(skillkind)
else
refresh_KGC_ActiveCountBattle
end
Graphics.frame_reset
end
end
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
@@_acb_gauge = RPG::Cache.picture("acb_gauge.png")
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias initialize_KGC_ActiveCountBattle initialize
def initialize
@acb_gauge_x = 0
@acb_gauge = @@_acb_gauge.dup
@acb_g_width = @acb_gauge.width / 3
@acb_g_height = (@acb_gauge.height - 2) / 4
@sprite_acb = []
(0...($imported["LargeParty"] ? KGC::LP_MAX_MEMBER : 4)).each { |i|
@sprite_acb[i] = Sprite.new
@sprite_acb[i].bitmap = Bitmap.new(@acb_g_width + 7, @acb_g_height + 2)
@sprite_acb[i].y = 462
@sprite_acb[i].z = 2000
}
initialize_KGC_ActiveCountBattle
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def _acb_gauge
return @@_acb_gauge
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def _acb_gauge=(new_bitmap)
@@_acb_gauge = new_bitmap
@acb_gauge.dispose
@acb_gauge = @@_acb_gauge.dup
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def acb_gauge
return @acb_gauge
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def acb_gauge=(new_bitmap)
@acb_gauge = new_bitmap
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias dispose_KGC_ActiveCountBattle dispose
def dispose
for sprite in @sprite_acb.compact
sprite.bitmap.dispose
sprite.dispose
end
@sprite_acb = nil
dispose_KGC_ActiveCountBattle
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias refresh_KGC_ActiveCountBattle refresh
def refresh
refresh_KGC_ActiveCountBattle
actor_max = $imported["LargeParty"] ? KGC::LP_MAX_MEMBER : 4
(0...actor_max).each { |i|
if (actor = $game_party.actors[i]) == nil
@sprite_acb[i].bitmap.clear
next
end
draw_actor_acb_gauge(actor)
}
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias update_KGC_ActiveCountBattle update
def update
update_KGC_ActiveCountBattle
if @sprite_acb != nil
@acb_gauge_x -= [@acb_g_width / 20, 1].max
@acb_gauge_x = @acb_g_width << 1 if @acb_gauge_x < 0
$game_party.actors.each { |actor| draw_actor_acb_gauge(actor) }
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def draw_actor_acb_gauge(actor)
@sprite_acb[actor.index].x = actor.screen_x + 68 - @acb_g_width
if !$imported["HPSPAlter"] || ($imported["HPSPAlter"] && !KGC::HPSP_DRAW_NAME_LUMP)
@sprite_acb[actor.index].x -= 16
end
if actor.chant_gauge_max > 0
gw = actor.acb_gauge * @acb_g_width / actor.chant_gauge_max
else
gw = actor.acb_gauge * @acb_g_width / actor.acb_gauge_max
end
if KGC::ACB_GAUGE_SLANT
@sprite_acb[actor.index].bitmap.fill_rect(0, 0, @acb_g_width + 7, @acb_g_height + 2, Color.new(0, 0, 0, 0))
gy = @acb_g_height + 1
(@acb_g_height + 2).times { |i|
@sprite_acb[actor.index].bitmap.blt(i, gy - i, @acb_gauge, Rect.new(0, gy - i, @acb_g_width + 2, 1))
}
gy -= 1
(0...@acb_g_height).each { |i|
if gw < @acb_g_width
if actor.chant_gauge_max > 0
gy2 = @acb_g_height * 4 + 1
else
gy2 = @acb_g_height * 2 + 1
end
else
gy2 = @acb_g_height * 3 + 1
end
@sprite_acb[actor.index].bitmap.blt(2 + i, gy - i, @acb_gauge, Rect.new(@acb_gauge_x, gy2 - i, gw, 1))
}
else
@sprite_acb[actor.index].bitmap.fill_rect(0, 0, @acb_g_width + 2, @acb_g_height + 2, Color.new(0, 0, 0, 0))
@sprite_acb[actor.index].bitmap.blt(0, 0, @acb_gauge, Rect.new(0, 0, @acb_g_width + 2, @acb_g_height + 2))
if gw < @acb_g_width
if actor.chant_gauge_max > 0
gy = @acb_g_height * 4 + 2
else
gy = @acb_g_height * 2 + 2
end
else
gy = @acb_g_height * 3 + 2
end
@sprite_acb[actor.index].bitmap.blt(1, 1, @acb_gauge, Rect.new(@acb_gauge_x, gy, gw, @acb_g_height))
end
end
end
#==============================================================================
# ** Interpreter (part 4)
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias command_129_KGC_ActiveCountBattle command_129
def command_129
if command_129_KGC_ActiveCountBattle
$game_actors[@parameters[0]].set_acb_gauge
return true
else
return false
end
end
end
#==============================================================================
# ** Interpreter (part 7)
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def command_339
unless $game_temp.in_battle
return true
end
if $game_temp.battle_turn == 0
return true
end
iterate_battler(@parameters[0], @parameters[1]) do |battler|
next unless battler.exist?
battler.current_action.kind = @parameters[2]
if battler.current_action.kind == 0
battler.current_action.basic = @parameters[3]
else
battler.current_action.skill_id = @parameters[3]
end
if @parameters[4] == -2
if battler.is_a?(Game_Enemy)
battler.current_action.decide_last_target_for_enemy
else
battler.current_action.decide_last_target_for_actor
end
elsif @parameters[4] == -1
if battler.is_a?(Game_Enemy)
battler.current_action.decide_random_target_for_enemy
else
battler.current_action.decide_random_target_for_actor
end
elsif @parameters[4] >= 0
battler.current_action.target_index = @parameters[4]
end
battler.current_action.forcing = true
battler.acb_gauge -= 1
if $scene.input_battler == battler
$scene.command_input_cancel(true)
end
$scene.input_battlers.delete(battler)
$scene.action_battlers.delete(battler)
if battler.current_action.valid? and @parameters[5] == 1
battler.acb_gauge = battler.acb_max - 1
@index += 1
return false
end
end
return true
end
end
#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
attr_accessor :input_battler
attr_accessor :action_battler
attr_accessor :input_battlers
attr_accessor :action_battlers
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias main_KGC_ActiveCountBattle main
def main
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
all_speed = 0
for battler in $game_party.actors
if $imported["BattlerEffect"]
battler.effect_reset
end
battler.blink = false
all_speed += battler.agi if battler.is_a?(Game_Actor)
end
all_speed /= $game_party.actors.size
$game_temp.set_turn_acb_count(all_speed)
for battler in $game_party.actors
battler.turn_count = 0
battler.set_acb_gauge
battler.acb_gauge = rand(battler.acb_gauge_max * 2 / 3)
battler.chant_gauge_max = 0
end
@input_battlers, @action_battlers = [], []
@input_battler, @action_battler = nil, nil
@turn_acb_count = @escape_count = 0
main_KGC_ActiveCountBattle
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias update_KGC_ActiveCountBattle update
def update
if @phase == 1
for battler in $game_troop.enemies
battler.set_acb_gauge
battler.acb_gauge = rand(battler.acb_gauge_max / 2)
battler.chant_gauge_max = 0
end
$game_temp.battle_main_phase = true
@actor_command_window.opacity = 0
@phase = 0
elsif @phase != 5
@phase = 0
end
if $game_system.battle_interpreter.running?
@event_running = true
end
update_KGC_ActiveCountBattle
if (@action_battler == nil && @wait_count > 0) ||
(@bonus_wait != nil && @bonus_wait > 0) ||
(@preempt_wait != nil && @preempt_wait > 0)
return
end
if $game_system.battle_interpreter.running?
return
elsif @event_running
@status_window.refresh
@event_running = false
end
if $game_temp.gameover
return if @spriteset.effect?
$scene = Scene_Gameover.new
return
end
if @phase == 5
update_phase5
return
end
if Input.press?(Input::A)
if $game_temp.battle_can_escape
if !@help_window.visible && KGC::ACB_ESCAPE_MESSAGE != nil
@help_window.set_text("")
@help_window.set_text(KGC::ACB_ESCAPE_MESSAGE, 1)
@escaping = true
end
@escape_count += 1
if @escape_count >= $game_temp.turn_acb_count / 600
@escape_count = 0
update_phase2_escape unless $game_party.all_dead?
end
else
@help_window.set_text(KGC::ACB_CANT_ESCAPE_MESSAGE, 1)
end
else
if @escaping
@escaping = false
@help_window.visible = false
end
@escape_count = [@escape_count - 1, 0].max
end
acb_add
if @input_battlers[0] != nil && @input_battler == nil && !@wait_on
@input_battler = @input_battlers.shift
if @input_battler.current_action.forcing ||
@input_battler.restriction == 2 || @input_battler.restriction == 3
if @input_battler.restriction == 2 || @input_battler.restriction == 3
@input_battler.current_action.kind = 0
@input_battler.current_action.basic = 0
end
@action_battlers << @input_battler
@input_battler = nil
elsif @input_battler.inputable?
if KGC::ACB_MAX_SE.is_a?(RPG::AudioFile)
$game_system.se_play(KGC::ACB_MAX_SE)
else
Audio.se_play("Audio/SE/" + KGC::ACB_MAX_SE[0], KGC::ACB_MAX_SE[1], KGC::ACB_MAX_SE[2])
end
@actor_index = $game_party.actors.index(@input_battler)
@input_battler.current_action.clear
@input_battler.blink = true
else
@input_battler.set_acb_gauge
@input_battler = nil
end
end
if @input_battler != nil
@active_battler = @input_battler
if @actor_command_window.opacity == 0
phase3_setup_command_window
end
update_phase3
end
if @action_battlers[0] != nil && @action_battler == nil
@action_battler = @action_battlers.shift
if @action_battler.dead? || !@action_battler.movable?
@action_battler.acb_gauge = 0
@action_battler = nil
else
if @action_battler.is_a?(Game_Actor) &&
!$game_party.actors.include?(@action_battler)
@action_battler.set_acb_gauge
@action_battler = nil
else
start_phase4
end
end
end
if @action_battler != nil && !@spriteset.effect?
@active_battler = @action_battler
update_phase4
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def acb_add
if $game_system.wait_mode == 1 &&
(@skill_window != nil || @item_window != nil)
@wait_on = true
elsif $game_system.wait_mode == 2 && @input_battler != nil
@wait_on = true
elsif $game_system.wait_mode >= 1 && $game_system.action_wait &&
@action_battler != nil
@wait_on = true
else
@wait_on = false
end
return if @wait_on
@turn_acb_count += $game_temp.acb_count_speed
if @turn_acb_count >= $game_temp.turn_acb_count
$game_temp.battle_turn += 1
@turn_acb_count = 0
if $imported["BonusGauge"]
$game_temp.bonus_rate -= 10
$game_temp.bonus_rate = [$game_temp.bonus_rate, 0].max
end
for battler in $game_party.actors + $game_troop.enemies
battler.remove_states_auto if battler != nil
if KGC::ACB_SLIP_DAMAGE == 1 && battler.hp > 0 && battler.slip_damage?
battler.slip_damage_effect
battler.damage_pop = true
end
end
@status_window.refresh if @action_battler == nil
setup_battle_event
end
($game_party.actors + $game_troop.enemies).each { |battler|
unless battler.movable?
battler.acb_gauge = 0
battler.chant_gauge_max = 0
next
end
if $imported["CooperationSkill"] && cooperation_exec?(battler)
battler.set_acb_gauge
@input_battlers.delete(battler)
@action_battlers.delete(battler)
next
end
if $imported["EquipExtension"] && battler.is_a?(Game_Actor) &&
battler.attack_count > 0
next
end
gauge_max = battler.chant_gauge_max == 0 ?
battler.acb_gauge_max : battler.chant_gauge_max
next if battler.acb_gauge == gauge_max
inc_gauge = battler.chant_gauge_max == 0 ? battler.agi : battler.int
battler.acb_gauge += inc_gauge
if battler.acb_gauge >= gauge_max
battler.acb_gauge = gauge_max
battler.turn_count += 1
if battler.current_action.forcing
@action_battlers << battler
next
end
if battler.is_a?(Game_Actor)
if battler.chant_gauge_max > 0
@action_battlers << battler
elsif battler.inputable?
@input_battlers << battler
else
if battler.restriction == 2 || battler.restriction == 3
battler.current_action.kind = 0
battler.current_action.basic = 0
end
@action_battlers << battler
end
else
if battler.chant_gauge_max == 0
i = 0
loop {
battler.make_action
if i == 2
battler.current_action.kind = 0
battler.current_action.basic = 0
end
if battler.current_action.kind == 1 &&
!battler.skill_can_use?(battler.current_action.skill_id)
i += 1
next
end
break
}
if KGC::ACB_SKILL_CHANT
set_chant_time(battler)
else
@action_battlers << battler
end
else
@action_battlers << battler
end
end
end
}
end
end
#==============================================================================
# ** Scene_Battle (part 2)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias update_phase2_escape_KGC_ActiveCountBattle update_phase2_escape
def update_phase2_escape(skill = nil)
if skill != nil
update_phase2_escape_KGC_ActiveCountBattle(skill)
return
end
enemies_agi, enemies_number = 0, 0
for enemy in $game_troop.enemies
next unless enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
enemies_agi /= enemies_number if enemies_number > 0
actors_agi, actors_number = 0, 0
for actor in $game_party.actors
next unless actor.exist?
actors_agi += actor.agi
actors_number += 1
end
actors_agi /= actors_number if actors_number > 0
prob = 50 * actors_agi / [enemies_agi, 1].max
success = rand(100) < prob
if success
if @input_battler != nil
if @enemy_arrow != nil
@enemy_arrow.dispose
@enemy_arrow = nil
end
if @actor_arrow != nil
@actor_arrow.dispose
@actor_arrow = nil
end
if @skill_window != nil
@skill_window.dispose
@skill_window = nil
end
if @skill_group_window != nil
@skill_group_window.dispose
@skill_group_window = nil
end
if @item_window != nil
@item_window.dispose
@item_window = nil
end
if @actor_command_window != nil
@actor_command_window.active = false
@actor_command_window.visible = false
@actor_command_window.opacity = 0
end
@input_battler.blink = false
end
@help_window.visible = false
@help_window2.visible = false if @help_window2 != nil
$game_system.se_play($data_system.escape_se)
$game_system.bgm_play($game_temp.map_bgm)
battle_end(1)
return
else
return
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias start_phase5_KGC_ActiveCountBattle start_phase5
def start_phase5
if @input_battler != nil
if @enemy_arrow != nil
@enemy_arrow.dispose
@enemy_arrow = nil
end
if @actor_arrow != nil
@actor_arrow.dispose
@actor_arrow = nil
end
if @skill_window != nil
@skill_window.dispose
@skill_window = nil
end
if @skill_group_window != nil
@skill_group_window.dispose
@skill_group_window = nil
end
if @item_window != nil
@item_window.dispose
@item_window = nil
end
if @actor_command_window != nil
@actor_command_window.active = false
@actor_command_window.visible = false
@actor_command_window.opacity = 0
end
@input_battler.blink = false if @input_battler != nil
end
@help_window.visible = false
@help_window2.visible = false if @help_window2 != nil
start_phase5_KGC_ActiveCountBattle
end
end
#==============================================================================
# ** Scene_Battle (part 3)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def phase3_next_actor
if KGC::ACB_SKILL_CHANT
set_chant_time(@active_battler)
else
@action_battlers << @active_battler
end
@active_battler.blink = false
@actor_command_window.active = false
@actor_command_window.visible = false
@actor_command_window.opacity = 0
@input_battler = nil
@actor_index = nil
@active_battler = nil
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def set_chant_time(battler)
chant = false
if battler.current_action.kind == 1 &&
battler.chant_gauge_max == 0
skill = $data_skills[battler.current_action.skill_id]
chant = skill.int_f >= KGC::ACB_CHANT_SKILL_INT_F &&
skill.atk_f < KGC::ACB_NOT_CHANT_SKILL_ATK_F
end
if chant
if KGC::ACB_CHANT_TIME[skill.id] != nil
chant_time = KGC::ACB_CHANT_TIME[skill.id]
elsif skill.power != 0
chant_time = Math.sqrt(
skill.sp_cost + skill.power.abs + [skill.int_f, 1].max) / 30
else
chant_time = Math.sqrt(skill.sp_cost + skill.int_f) / 20
end
chant_time *= $game_temp.turn_acb_count / 4
battler.chant_gauge_max = Integer(chant_time)
battler.acb_gauge = 0
elsif KGC::ACB_CHANT_TIME[skill.id] != nil
chant_time = KGC::ACB_CHANT_TIME[skill.id]
chant_time *= $game_temp.turn_acb_count / 4
battler.chant_gauge_max = Integer(chant_time)
battler.acb_gauge = 0
else
@action_battlers << battler
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def phase3_prior_actor
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def command_input_cancel(delay = false)
if @enemy_arrow != nil
@enemy_arrow.dispose
@enemy_arrow = nil
end
if @actor_arrow != nil
@actor_arrow.dispose
@actor_arrow = nil
end
if @skill_window != nil
@skill_window.dispose
@skill_window = nil
end
if @skill_group_window != nil
@skill_group_window.dispose
@skill_group_window = nil
end
if @item_window != nil
@item_window.dispose
@item_window = nil
end
@help_window.visible = false
@help_window2.visible = false if $imported["HelpExtension"]
if @actor_command_window != nil
@actor_command_window.active = false
@actor_command_window.visible = false
@actor_command_window.opacity = 0
end
@input_battler.blink = false
@input_battler.set_acb_gauge unless delay
@input_battler = nil
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
unless $imported["SeparationCommand"]
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.dispose if @actor_command_window != nil
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = true
@actor_command_window.visible = true
@actor_command_window.x =
[@active_battler.screen_x - 80, 640 - @actor_command_window.width].min
@actor_command_window.index = 0
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias update_phase3_KGC_ActiveCountBattle update_phase3
def update_phase3
if @active_battler.current_action.forcing ||
!@active_battler.inputable? ||
@active_battler.restriction == 2 ||
@active_battler.restriction == 3 ||
!$game_party.actors.include?(@active_battler)
if @active_battler.current_action.forcing ||
@active_battler.restriction == 2 ||
@active_battler.restriction == 3
if @active_battler.restriction == 2 || @active_battler.restriction == 3
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
@action_battlers << @active_battler
end
command_input_cancel
return
end
update_phase3_KGC_ActiveCountBattle
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias update_phase3_basic_command_KGC_ActiveCountBattle update_phase3_basic_command
def update_phase3_basic_command
if Input.trigger?(Input::X)
$game_system.se_play($data_system.decision_se)
@input_battlers << @active_battler
@active_battler.blink = false
if @actor_command_window != nil
@actor_command_window.active = false
@actor_command_window.visible = false
@actor_command_window.opacity = 0
end
@input_battler = nil
@actor_index = nil
@active_battler = nil
return
end
update_phase3_basic_command_KGC_ActiveCountBattle
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias update_phase3_enemy_select_KGC_ActiveCountBattle update_phase3_enemy_select
def update_phase3_enemy_select
enemy_none = true
$game_troop.enemies.each { |enemy|
unless enemy.dead?
enemy_none = false
break
end
}
if enemy_none
end_enemy_select
return
end
update_phase3_enemy_select_KGC_ActiveCountBattle
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias start_enemy_select_KGC_ActiveCountBattle start_enemy_select
def start_enemy_select
enemy_none = true
for enemy in $game_troop.enemies
unless enemy.dead?
enemy_none = false
break
end
end
if enemy_none
$game_system.se_play($data_system.buzzer_se)
return
end
start_enemy_select_KGC_ActiveCountBattle
end
end
#==============================================================================
# ** Scene_Battle (part 4)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def start_phase4
@phase4_step = 1
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
def update_phase4_step1
@help_window.visible = false
return if judge
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
if KGC::ACB_SLIP_DAMAGE == 0 && @active_battler.hp > 0 &&
@active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
if $imported["DelaySkill"] && @active_battler != nil
for i in 0...@active_battler.delay_skill.size
@active_battler.delay_skill[i][0] -= 1
end
end
if @active_battler.current_action.kind == 0 &&
@active_battler.current_action.basic == 3
@phase4_step = 6
else
@phase4_step = 2
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias make_basic_action_result_KGC_ActiveCountBattle make_basic_action_result
def make_basic_action_result
make_basic_action_result_KGC_ActiveCountBattle
if @active_battler.current_action.basic == 0
dmg = 0
for i in @active_battler.element_set.compact
if $data_system.elements[i] =~ $game_special_elements["acb_delay"]
dmg += $1.to_i
end
end
if dmg > 0
battlers = $game_party.actors + $game_troop.enemies
@target_battlers.each { |target|
next if !target.damage.is_a?(Numeric) || target.damage <= 0
(0...battlers.size).each { |i|
next if battlers[i] != target
acb_dmg = $game_temp.turn_acb_count / 4
if $game_special_elements["acb_delay_resist"] != nil
acb_dmg *= target.element_rate($game_special_elements["acb_delay_resist"])
acb_dmg /= 100
end
acb_dmg = [acb_dmg * dmg / 200, 0].max
target.acb_gauge -= acb_dmg
if !KGC::ACB_INVALID_DELAY_INPUT && target.is_a?(Game_Actor) &&
target == @input_battler && target.acb_gauge < target.acb_max
command_input_cancel(true)
end
@input_battlers.delete(target)
@action_battlers.delete(target)
break
}
}
end
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias make_skill_action_result_KGC_ActiveCountBattle make_skill_action_result
def make_skill_action_result
make_skill_action_result_KGC_ActiveCountBattle
dmg = 0
@skill.element_set.compact.each { |i|
if $data_system.elements[i] =~ $game_special_elements["acb_delay"]
dmg += $1.to_i
end
}
if dmg > 0
battlers = $game_party.actors + $game_troop.enemies
@target_battlers.each { |target|
next if !target.damage.is_a?(Numeric) || target.damage <= 0
(0...battlers.size).each { |i|
next if battlers[i] != target
acb_dmg = $game_temp.turn_acb_count / 4
if $game_special_elements["acb_delay_resist"] != nil
acb_dmg *= target.element_rate($game_special_elements["acb_delay_resist"])
acb_dmg /= 100
end
acb_dmg = [acb_dmg * dmg / 200, 0].max
target.acb_gauge -= acb_dmg
if !KGC::ACB_INVALID_DELAY_INPUT && target.is_a?(Game_Actor) &&
target == @input_battler && target.acb_gauge < target.acb_max
command_input_cancel(true)
end
if target.acb_gauge < target.acb_max
@input_battlers.delete(target)
@action_battlers.delete(target)
end
break
}
}
end
end
#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
alias update_phase4_step6_KGC_ActiveCountBattle update_phase4_step6
def update_phase4_step6
@help_window.reset
update_phase4_step6_KGC_ActiveCountBattle
if !$imported["CooperationSkill"] || !@cooperation_skill_exec
setup_battle_event
@action_battler.set_acb_gauge
@action_battler.current_action.forcing = false
@action_battler = nil
judge
end
end
end
you will need the image attached on the Pictures folder, you can edit it.
Give a try and see if this one works with your script.
The HP/MP bars can be edited with one of the many scripts to edit the battle window out there.