[code]#==============================================================================
# hellMinor's Active-Time-Battles
#
# Version : 0.2.3.1 - 02.04.08
# Created by : hellMinor
# Description : This script changes the standard Battle-System to an
# Active-Time-Battle-System based on the agility of the
# character
# Notes : This script uses my CustomBattleScreen with some changes
# Do NOT redistribute without my permission
#
#==============================================================================
#==============================================================================
class Scene_Battle < Scene_Base
#==============================================================================
def start
super
$game_temp.in_battle = true
@spriteset = Spriteset_Battle.new
@message_window = Window_BattleMessage.new
@action_battlers = []
$playerwaitrate = [0,0,0,0]
$additionrate = [0,0,0,0]
$bar = [0,0,0,0]
$enemywaitrate = [0,0,0,0,0,0,0,0]
$enemyattackrate = [0,0,0,0,0,0,0,0]
create_info_viewport
@info_viewport.visible = true
end
#------------------------------------------------------------------------------
def next_actor
for enemy in $game_troop.members
enemy.action.clear
end
wert = 300
index = 0
if @actor_index == $game_party.members.size-1
start_main
return
end
for i in 0..$game_party.members.size-1
if $playerwaitrate[i] == 0
$playerwaitrate[i] = 60*(5.0*(1.0-($game_party.members[i].agi/500.0)))
$additionrate[i] = 120.0/$playerwaitrate[i]
end
end
for i in 0..$game_troop.members.size-1
if $enemywaitrate[i] == 0
$enemywaitrate[i] = 60*(5.0*(1.0-($game_troop.members[i].agi/500.0)))
$enemyattackrate[i] = 120.0/$enemywaitrate[i]
end
end
temp = $playerwaitrate
temp += $enemywaitrate
for i in 0..temp.length-1
if temp[i] > wert
wert = temp[i]
end
end
for i in 0..temp.length-1
if temp[i] < wert && temp[i] > 0
wert = temp[i]
if i < $game_party.members.size
@active_battler = $game_party.members[i]
index = i
else
@active_battler = $game_troop.members[i-4]
index = i
end
end
end
for i in 0..wert
wait(1)
for i in 0..$game_party.members.size-1
$bar[i] += $additionrate[i]
end
@status_window.refresh
end
for i in 0..$game_party.members.size-1
if i == index
$playerwaitrate[i] -= wert
else
$playerwaitrate[i] -= wert-0.001
end
end
for i in 0..$game_troop.members.size-1
if i == index-4
$enemywaitrate[i] -= wert
else
$enemywaitrate[i] -= wert-0.001
end
end
if @active_battler.inputable?
if @active_battler.actor?
@status_window.index = @active_battler.id-1
if @active_battler.id-1 < 4
$bar[@active_battler.id-1] = 0
else if @active_battler.id-1 < 8
$bar[@active_battler.id-5] = 0
else if @active_battler.id-1 < 12
$bar[@active_battler.id-9] = 0
end
end
end
if @autobattle || @active_battler.auto_battle
@active_battler.make_action
start_main
else
start_actor_command_selection
end
else
@active_battler.make_action
start_main
end
else
if @active_battler.actor?
$bar[@active_battler.id-1] = 0
end
next_actor
end
end
#------------------------------------------------------------------------------
def update_actor_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
elsif Input.trigger?(Input::C)
case @actor_command_window.index
when 0 # ??
Sound.play_decision
@active_battler.action.set_attack
start_target_enemy_selection
when 1 #

Sound.play_decision
start_skill_selection
when 2 # ??
Sound.play_decision
@active_battler.action.set_guard
start_main
when 3 #

?
Sound.play_decision
start_item_selection
end
end
end
#------------------------------------------------------------------------------
def start_target_enemy_selection
@target_enemy_window = Window_TargetEnemy.new
@target_enemy_window.y = 193
@info_viewport.rect.x += @target_enemy_window.width
@info_viewport.ox += @target_enemy_window.width
@actor_command_window.active = false
end
#------------------------------------------------------------------------------
def update_target_enemy_selection
@target_enemy_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_target_enemy_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
@active_battler.action.target_index = @target_enemy_window.enemy.index
end_target_enemy_selection
end_skill_selection
end_item_selection
start_main
end
end
#------------------------------------------------------------------------------
def update_target_actor_selection
@target_actor_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_target_actor_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
@active_battler.action.target_index = @target_actor_window.index
end_target_actor_selection
end_skill_selection
end_item_selection
start_main
end
end
#------------------------------------------------------------------------------
def determine_skill
@active_battler.action.set_skill(@skill.id)
@skill_window.active = false
if @skill.need_selection?
if @skill.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_skill_selection
start_main
end
end
#------------------------------------------------------------------------------
def determine_item
@active_battler.action.set_item(@item.id)
@item_window.active = false
if @item.need_selection?
if @item.for_opponent?
start_target_enemy_selection
else
start_target_actor_selection
end
else
end_item_selection
start_main
end
end
#------------------------------------------------------------------------------
def start_main
$game_troop.increase_turn
@info_viewport.visible = true
@info_viewport.ox = 0
@message_window.visible = true
@actor_command_window.visible = false
@party_command_window.active = false
@actor_command_window.active = false
@status_window.index = @actor_index = -1
@active_battler = nil
@message_window.clear
make_action_orders
wait(20)
end
#------------------------------------------------------------------------------
def create_info_viewport
@info_viewport = Viewport.new(0, 0, 544, 480)
@info_viewport.z = 100
@status_window = Window_BattleStatus.new
@party_command_window = Window_PartyCommand.new
@actor_command_window = Window_ActorCommand.new
@status_window.viewport = @info_viewport
@party_command_window.viewport = @info_viewport
@actor_command_window.viewport = @info_viewport
@party_command_window.x = 159
@party_command_window.y = 360
@status_window.x = 0
@actor_command_window.x = 159
@actor_command_window.y = 360
@actor_command_window.visible = false
@info_viewport.visible = false
end
#------------------------------------------------------------------------------
def update_info_viewport
@party_command_window.update
@actor_command_window.update
@status_window.update
if @party_command_window.active
@party_command_window.visible = true
@actor_command_window.visible = false
elsif @actor_command_window.active
@actor_command_window.visible = true
@party_command_window.visible = false
end
end
#------------------------------------------------------------------------------
def start_party_command_selection
if $game_temp.in_battle
@status_window.refresh
@status_window.index = @actor_index = -1
@active_battler = nil
@info_viewport.visible = true
@message_window.visible = false
@party_command_window.active = true
@party_command_window.index = 0
@actor_command_window.active = false
$game_party.clear_actions
if $game_troop.surprise or not $game_party.inputable?
start_main
end
if @autobattle
next_actor
end
end
end
#------------------------------------------------------------------------------
def update_party_command_selection
if Input.trigger?(Input::C)
case @party_command_window.index
when 0 # ??
@party_command_window.visible = false
Sound.play_decision
@status_window.index = @actor_index = -1
next_actor
when 1 # ??
Sound.play_decision
@status_window.index = @actor_index = -1
@party_command_window.active = false
@party_command_window.visible = false
@autobattle = true
next_actor
when 2 #

if $game_troop.can_escape == false
Sound.play_buzzer
return
end
Sound.play_decision
process_escape
end
end
end
#------------------------------------------------------------------------------
def start_skill_selection
@help_window = Window_Help.new
@skill_window = Window_Skill.new(0, 55, 544, 306, @active_battler)
@skill_window.help_window = @help_window
@actor_command_window.active = false
end
#------------------------------------------------------------------------------
def start_item_selection
@help_window = Window_Help.new
@item_window = Window_Item.new(0, 55, 544, 306)
@item_window.help_window = @help_window
@actor_command_window.active = false
end
#------------------------------------------------------------------------------
def process_victory
@info_viewport.visible = true
@message_window.visible = true
RPG::BGM.stop
$game_system.battle_end_me.play
unless $BTEST
$game_temp.map_bgm.play
$game_temp.map_bgs.play
end
display_exp_and_gold
display_drop_items
display_level_up
battle_end(0)
end
#------------------------------------------------------------------------------
def process_defeat
@info_viewport.visible = true
@message_window.visible = true
text = sprintf(Vocab::Defeat, $game_party.name)
$game_message.texts.push(text)
wait_for_message
battle_end(2)
end
end
#==============================================================================
# CustomBattleScreen
# Version : 0.2 - Customized
# Created by : hellMinor
#==============================================================================
#==============================================================================
class Window_BattleStatus < Window_Selectable
#==============================================================================
def initialize
super(0, 0, 160, 416)
refresh
self.active = false
end
#------------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = 126
rect.height = 96
rect.y = index / @column_max * 96
return rect
end
#------------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = $game_party.members[index]
draw_atb_gauge(index, 3, rect.y+10)
draw_actor_name(actor, 3, rect.y)
draw_actor_state(actor, 35, rect.y+20, 48)
draw_actor_graphic(actor,18,rect.y+55)
draw_actor_mp(actor, 35, rect.y+45, 88)
draw_actor_hp(actor, 3, rect.y+65, 120)
end
#------------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = hp_color(actor)
self.contents.draw_text(x, y, 120, WLH, actor.name, 1)
end
#------------------------------------------------------------------------------
def draw_atb_gauge(index,x, y, width = 120)
if $bar[index] == nil
$bar[index] = 0
end
if $bar[index] >= 120
gc1 = hp_gauge_color1
gc2 = hp_gauge_color2
else
gc1 = mp_gauge_color1
gc2 = mp_gauge_color2
end
self.contents.fill_rect(x, y, 120, 5, gauge_back_color)
self.contents.gradient_fill_rect(x, y, $bar[index], 5, gc1, gc2)
end
end
#==============================================================================
class Window_PartyCommand < Window_Command
#==============================================================================
def initialize
s1 = Vocab::fight
s2 = "Auto-Fight"
s3 = Vocab::escape
super(385, [s1, s2, s3], 3, 1)
draw_item(0, true)
draw_item(1, true)
draw_item(2, $game_troop.can_escape)
self.active = false
end
#------------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], 1)
end
end
#==============================================================================
class Window_ActorCommand < Window_Command
#==============================================================================
def initialize
super(385, [], 4, 1)
self.active = false
end
#------------------------------------------------------------------------------
def setup(actor)
s1 = Vocab::attack
s2 = Vocab::skill
s3 = Vocab::guard
s4 = Vocab::item
if actor.class.skill_name_valid
s2 = actor.class.skill_name
end
@commands = [s1,s2, s3, s4]
@item_max = 4
refresh
self.index = 0
end
#------------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index], 1)
end
end
#====================