I've got this active time battle script which has been playing up a bit. All of the characters and monsters ATBs (though the monsters ATBs arn't visible) start at the same point, when actually they're supost to begin at random points. Also the battle BGM dosn't play, no matter what file I play, and the map BGM continues playing through out the battle. Then when the battle finishes the BGM stops until a BGM is told to play with an event or when i enter a new map with a native BGM. I have no idea how to fix these problems but any help would be apprecieated. I'm, not sure what scripts will be needed to fix this so ill post all of the battle_scene and window_base scripts if it isn't too much trouble. Within these scripts should be an Hp and MP script and an ATB script and possably part of KGC Equipment Skills script.
Scene_Battle 1
Scene_Battle 2
Scene_Battle 3
Scene_Battle 4
Scene_Battle D
Window_Base
Scene_Battle 1
Code:
#==============================================================================
# ■Scene_Battle (分割定義 1)
#------------------------------------------------------------------------------
# Turn-based battle system by David Schooley
# NOTE!! Be sure that skill 17 is "Normal" and
# cancels "act"
#==============================================================================
class Scene_Battle
#----------------------------------------------------------------
def main
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
$game_system.battle_interpreter.setup(nil, 0)
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# NEW - David
$battle_end = false
$game_temp_battle_true_turn = 0
$game_temp_turn_passed = false
$ct_full = 1000
$turn = 0
$keep_count = []
$keep_id = []
$keep_number = []
$total_number = 0
$total_allies = 0
$total_baddies = 0
for actor in $game_party.actors
$keep_count[$total_number] = 0
$keep_id[$total_number] = actor
$keep_number[$total_number] = $total_number
$total_number += 1
$total_allies += 1
end
for enemy in $game_troop.enemies
$keep_count[$total_number] = 0
$keep_id[$total_number] = enemy
$keep_number[$total_number] = $total_number
$total_number += 1
$total_baddies += 1
end
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 = false
@actor_command_window.visible = false
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
# NEW - David - Enemy status window
#@e_status_window = Window_EnemyStatus.new
@message_window = Window_Message.new
@spriteset = Spriteset_Battle.new
@wait_count = 0
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
start_phase1
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
$game_map.refresh
Graphics.freeze
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
# NEW - David
#@e_status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
@spriteset.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
def judge
if $game_party.all_dead? or $game_party.actors.size == 0
if $game_temp.battle_can_lose
$game_system.bgm_play($game_temp.map_bgm)
battle_end(2)
return true
end
$game_temp.gameover = true
return true
end
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
start_phase5
return true
end
#--------------------------------------------------------------------------
def battle_end(result)
$game_temp.in_battle = false
$game_party.clear_actions
for actor in $game_party.actors
actor.remove_states_battle
end
$game_troop.enemies.clear
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
Audio.me_stop
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
def setup_battle_event
if $game_system.battle_interpreter.running?
return
end
for index in 0...$data_troops[@troop_id].pages.size
page = $data_troops[@troop_id].pages[index]
c = page.condition
unless c.turn_valid or c.enemy_valid or
c.actor_valid or c.switch_valid
next
end
if $game_temp.battle_event_flags[index]
next
end
if c.turn_valid
n = $game_temp.battle_turn
a = c.turn_a
b = c.turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
end
if c.enemy_valid
enemy = $game_troop.enemies[c.enemy_index]
if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
next
end
end
if c.actor_valid
actor = $game_actors[c.actor_id]
if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
next
end
end
if c.switch_valid
if $game_switches[c.switch_id] == false
next
end
end
$game_system.battle_interpreter.setup(page.list, 0)
if page.span <= 1
$game_temp.battle_event_flags[index] = true
end
return
end
end
#--------------------------------------------------------------------------
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
# NEW - David
#@e_status_window.refresh
end
end
end
$game_system.update
$game_screen.update
if $game_system.timer_working and $game_system.timer == 0
$game_temp.battle_abort = true
end
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
# NEW - David
#@e_status_window.update
@message_window.update
@spriteset.update
if $game_temp.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
if $game_temp.message_window_showing
return
end
if @spriteset.effect?
return
end
if $game_temp.gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
$scene = Scene_Title.new
return
end
if $game_temp.battle_abort
$game_system.bgm_play($game_temp.map_bgm)
battle_end(1)
return
end
if @wait_count > 0
@wait_count -= 1
return
end
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
case @phase
when 1
update_phase1
when 2
# NEW - David
#Helper ON
#update_phase2
# Helper OFF
start_phase2_5
when 3
update_phase3
when 4
update_phase4
when 5
update_phase5
end
end
end
Scene_Battle 2
Code:
#==============================================================================
# ■Scene_Battle (分割定義 2)
#------------------------------------------------------------------------------
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
def start_phase1
@phase = 1
$game_party.clear_actions
setup_battle_event
end
#--------------------------------------------------------------------------
def update_phase1
if judge
return
end
start_phase2
end
#--------------------------------------------------------------------------
def start_phase2
@phase = 2
# NEW - David - Refresh status windows
@status_window.refresh
#@e_status_window.refresh
@actor_index = -1
@active_battler = nil
# NEW - David - Changed values here false -> true
@party_command_window.active = false
@party_command_window.visible = false
@actor_command_window.x = @actor_index * 160
@actor_command_window.active = true
@actor_command_window.visible = true
$game_temp.battle_main_phase = true
$game_party.clear_actions
# NEW - David
battle_stop_wait
unless $game_party.inputable?
# NEW - David
battle_cause_wait
start_phase4
end
# NEW - David
battle_cause_wait
end
#--------------------------------------------------------------------------
def update_phase2
# NEW - David - Enable
@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 = true
$game_party.clear_actions
if Input.trigger?(Input::C)
case @party_command_window.index
when 0
$game_system.se_play($data_system.decision_se)
# NEW - David - Comment out phase 3 and add in Phase 2.5
#start_phase3
start_phase2_5
when 1
if $game_temp.battle_can_escape == false
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
update_phase2_escape
end
return
end
end
#--------------------------------------------------------------------------
def update_phase2_escape
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
success = rand(100) < 50 * actors_agi / enemies_agi
if success
$game_system.se_play($data_system.escape_se)
$game_system.bgm_play($game_temp.map_bgm)
battle_end(1)
else
$game_party.clear_actions
start_phase4
end
end
#--------------------------------------------------------------------------
def start_phase5
@phase = 5
$game_system.me_play($game_system.battle_end_me)
$game_system.bgm_play($game_temp.map_bgm)
exp = 0
gold = 0
treasures = []
for enemy in $game_troop.enemies
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
treasures = treasures[0..5]
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
$game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
@result_window = Window_BattleResult.new(exp, gold, treasures)
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
def update_phase5
if @phase5_wait_count > 0
@phase5_wait_count -= 1
if @phase5_wait_count == 0
@result_window.visible = true
$game_temp.battle_main_phase = false
@status_window.refresh
# NEW - David
#@e_status_window.refresh
end
return
end
if Input.trigger?(Input::C)
battle_end(0)
end
end
end
Scene_Battle 3
Code:
#==============================================================================
# ■Scene_Battle (分割定義 3)
#------------------------------------------------------------------------------
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
def start_phase3
@phase = 3
@actor_index = -1
@active_battler = nil
phase3_next_actor
end
#--------------------------------------------------------------------------
def phase3_next_actor
begin
if @active_battler != nil
@active_battler.blink = false
end
if @actor_index == $game_party.actors.size-1
start_phase4
return
end
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
end until @active_battler.inputable?
phase3_setup_command_window
end
#--------------------------------------------------------------------------
def phase3_prior_actor
begin
if @active_battler != nil
@active_battler.blink = false
end
if @actor_index == 0
start_phase2
return
end
@actor_index -= 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
end until @active_battler.inputable?
phase3_setup_command_window
end
#--------------------------------------------------------------------------
def phase3_setup_command_window
@party_command_window.active = false
@party_command_window.visible = false
# NEW - David - Refresh the windows
@status_window.refresh
#@e_status_window.refresh
@actor_command_window.x = @actor_index * 160
@actor_command_window.active = true
@actor_command_window.visible = true
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
def update_phase3
if @enemy_arrow != nil
update_phase3_enemy_select
elsif @actor_arrow != nil
update_phase3_actor_select
elsif @skill_window != nil
update_phase3_skill_select
elsif @item_window != nil
update_phase3_item_select
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
def update_phase3_basic_command
# NEW - David - make it so the B button is disabled
#if Input.trigger?(Input::B)
#$game_system.se_play($data_system.cancel_se)
#phase3_prior_actor
#return
#end
if Input.trigger?(Input::C)
case @actor_command_window.index
when 0
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
start_enemy_select
when 1
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 1
start_skill_select
when 2
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# NEW - David
$keep_count[$turn] = 50
phase3_next_actor
when 3
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 2
start_item_select
end
return
end
end
#--------------------------------------------------------------------------
def update_phase3_skill_select
@skill_window.visible = true
@skill_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_skill_select
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.skill_id = @skill.id
@skill_window.visible = false
if @skill.scope == 1
start_enemy_select
elsif @skill.scope == 3 or @skill.scope == 5
start_actor_select
else
end_skill_select
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
def update_phase3_item_select
@item_window.visible = true
@item_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_item_select
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.item_id = @item.id
@item_window.visible = false
if @item.scope == 1
start_enemy_select
elsif @item.scope == 3 or @item.scope == 5
start_actor_select
else
end_item_select
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
def update_phase3_enemy_select
@enemy_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_enemy_select
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @enemy_arrow.index
end_enemy_select
if @skill_window != nil
end_skill_select
end
if @item_window != nil
end_item_select
end
phase3_next_actor
end
end
#--------------------------------------------------------------------------
def update_phase3_actor_select
@actor_arrow.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
end_actor_select
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.target_index = @actor_arrow.index
end_actor_select
if @skill_window != nil
end_skill_select
end
if @item_window != nil
end_item_select
end
phase3_next_actor
end
end
#--------------------------------------------------------------------------
def start_enemy_select
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)
@enemy_arrow.help_window = @help_window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
def end_enemy_select
@enemy_arrow.dispose
@enemy_arrow = nil
if @actor_command_window.index == 0
@actor_command_window.active = true
@actor_command_window.visible = true
@help_window.visible = false
end
end
#--------------------------------------------------------------------------
def start_actor_select
@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
@actor_arrow.index = @actor_index
@actor_arrow.help_window = @help_window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
def end_actor_select
@actor_arrow.dispose
@actor_arrow = nil
end
#--------------------------------------------------------------------------
def start_skill_select
@skill_window = Window_Skill.new(@active_battler)
@skill_window.help_window = @help_window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
def end_skill_select
@skill_window.dispose
@skill_window = nil
@help_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
end
#--------------------------------------------------------------------------
def start_item_select
@item_window = Window_Item.new
@item_window.help_window = @help_window
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
def end_item_select
@item_window.dispose
@item_window = nil
@help_window.visible = false
@actor_command_window.active = true
@actor_command_window.visible = true
end
end
Scene_Battle 4
Code:
#==============================================================================
# ■Scene_Battle (分割定義 4)
#------------------------------------------------------------------------------
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
def start_phase4
@phase = 4
# NEW - David - Calculate units on field
@units_on_field = 0
for actor in $game_party.actors
if actor.exist?
@units_on_field += 1
end
end
for enemy in $game_troop.enemies
if enemy.exist?
@units_on_field += 1
end
end
if $game_temp.battle_turn == 0
$game_temp.battle_turn = 1
end
$game_temp_battle_true_turn += 1
$game_temp_turn_passed = false
if $game_temp_battle_true_turn > @units_on_field
$game_temp.battle_turn += 1
$game_temp_battle_true_turn = 0
$game_temp_turn_passed = true
end
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
@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
@phase4_step = 1
end
#--------------------------------------------------------------------------
def make_action_orders
@action_battlers = []
for enemy in $game_troop.enemies
@action_battlers.push(enemy)
end
for actor in $game_party.actors
@action_battlers.push(actor)
end
for battler in @action_battlers
battler.make_action_speed
end
# NEW - David
#@action_battlers.sort! {|a,b|
#b.current_action.speed - a.current_action.speed }
end
#--------------------------------------------------------------------------
def update_phase4
case @phase4_step
when 1
update_phase4_step1
when 2
update_phase4_step2
when 3
update_phase4_step3
when 4
update_phase4_step4
when 5
update_phase4_step5
when 6
update_phase4_step6
end
end
#--------------------------------------------------------------------------
def update_phase4_step1
@help_window.visible = false
if judge
return
end
if $game_temp.forcing_battler == nil
setup_battle_event
if $game_system.battle_interpreter.running?
return
end
end
if $game_temp.forcing_battler != nil
@action_battlers.delete($game_temp.forcing_battler)
@action_battlers.unshift($game_temp.forcing_battler)
end
if @action_battlers.size == 0
start_phase2
return
end
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
@active_battler = @action_battlers.shift
if @active_battler.index == nil
return
end
# NEW - David - Slip Damage control
if $game_temp_turn_passed == true
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
@active_battler.remove_states_auto # NEW - David - 04.14.05
end
@status_window.refresh
# NEW - David
#@e_status_window.refresh
@phase4_step = 2
end
#--------------------------------------------------------------------------
def update_phase4_step2
unless @active_battler.current_action.forcing
if @active_battler.restriction == 2 or @active_battler.restriction == 3
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
if @active_battler.restriction == 4
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
@target_battlers = []
case @active_battler.current_action.kind
when 0
make_basic_action_result
when 1
make_skill_action_result
when 2
make_item_action_result
end
if @phase4_step == 2
@phase4_step = 3
end
end
#--------------------------------------------------------------------------
def make_basic_action_result
if @active_battler.current_action.basic == 0
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
@target_battlers = [target]
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
if @active_battler.current_action.basic == 1
@help_window.set_text($data_system.words.guard, 1)
return
end
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
@help_window.set_text("Escape", 1)
@active_battler.escape
return
end
if @active_battler.current_action.basic == 3
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
def set_target_battlers(scope)
if @active_battler.is_a?(Game_Enemy)
case scope
when 1
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 2
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 3
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 5
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
end
when 7
@target_battlers.push(@active_battler)
end
end
if @active_battler.is_a?(Game_Actor)
case scope
when 1
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 3
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 4
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 5
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6
for actor in $game_party.actors
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
end
when 7
@target_battlers.push(@active_battler)
end
end
end
#--------------------------------------------------------------------------
def make_skill_action_result
@skill = $data_skills[@active_battler.current_action.skill_id]
unless @active_battler.current_action.forcing
unless @active_battler.skill_can_use?(@skill.id)
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
@active_battler.sp -= @skill.sp_cost
@status_window.refresh
# NEW - David
#@e_status_window.refresh
@help_window.set_text(@skill.name, 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_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
#--------------------------------------------------------------------------
def make_item_action_result
@item = $data_items[@active_battler.current_action.item_id]
unless $game_party.item_can_use?(@item.id)
@phase4_step = 1
return
end
if @item.consumable
$game_party.lose_item(@item.id, 1)
end
@help_window.set_text(@item.name, 1)
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
@common_event_id = @item.common_event_id
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
set_target_battlers(@item.scope)
for target in @target_battlers
target.item_effect(@item)
end
end
#--------------------------------------------------------------------------
def update_phase4_step3
if @animation1_id == 0
@active_battler.white_flash = true
else
@active_battler.animation_id = @animation1_id
@active_battler.animation_hit = true
end
@phase4_step = 4
end
#--------------------------------------------------------------------------
def update_phase4_step4
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
@wait_count = 8
@phase4_step = 5
end
#--------------------------------------------------------------------------
def update_phase4_step5
@help_window.visible = false
@status_window.refresh
# NEW - David
#@e_status_window.refresh
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
end
end
@phase4_step = 6
end
#--------------------------------------------------------------------------
def update_phase4_step6
$game_temp.forcing_battler = nil
if @common_event_id > 0
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
# NEW - David
# Add "Waiting" status onto all units
battle_cause_wait
@phase4_step = 1
end
end
Scene_Battle D
Code:
#==============================================================================
# ■Scene_Battle (分割定義 1)
#------------------------------------------------------------------------------
#  ãƒãƒˆãƒ«ç”»é¢ã®å‡¦ç†ã‚’è¡Œã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚
#==============================================================================
class Scene_Battle
# NEW - David
def start_phase2_5
#Define Phase 2.5
@phase = 2.5
#Now, remove the bad status or "Waiting"
#from all units
battle_stop_wait
#Fix the -1 CT Count thing...
for i in 0 ... $total_number
if ($keep_count[i] == -1)
$keep_count[i] = 0
end
end
#Loop to give things their turns
loop do
#Slow this thing down a little
# Yeah... do something here...
battle_refresh_windows
i=0
@break_out = false
for i in 0 ... $total_number
if ($keep_count[i] >= $ct_full)
$turn = i
@break_out = true
end
end
if (@break_out == true)
break
end
i=0
#Do your guys first
for actor in $game_party.actors
#if actor.exist? and actor.inputable?
if actor.exist?
$keep_count[i] += actor.agi
end
i += 1
end
#Then the enemies
for enemy in $game_troop.enemies
if enemy.exist? and enemy.inputable?
$keep_count[i] += enemy.agi
end
i += 1
end
end
#broken out of the loop
# Remember... turn = counter ID 1 is first hero, etc...
#So... make his/her CT -1
$keep_count[$turn] = -1
@target_id = $turn
@target = "Ally"
if ($turn >= $total_allies)
@target_id = $turn - ($total_allies +1)
@target = "Enemy"
end
# NEW _ David
# Add "Waiting" status onto all units
battle_cause_wait
# Now, remove the bad status or "Waiting"
# Status from only the unit whose turn it is
if (@target == "Ally")
for actor in $game_party.actors
if ($keep_id[$turn] == actor)
actor.remove_state(17)
end
end
end
# Or if it's an enemie's turn...
if (@target == "Enemy")
for enemy in $game_troop.enemies
if ($keep_id[$turn] == enemy)
enemy.remove_state(17)
end
end
end
#start phase 3
start_phase3
end
# NEW - David
def battle_cause_wait
#make all allies and enemies have the "Waiting" ailment
for actor in $game_party.actors
if (actor.exist?)
actor.add_state(17)
end
end
for enemy in $game_troop.enemies
if (enemy.exist?)
enemy.add_state(17)
end
end
end
# NEW - David
def battle_stop_wait
#make all allies and enemies have the "Waiting" ailment
for actor in $game_party.actors
if (actor.exist?)
actor.remove_state(17)
end
end
for enemy in $game_troop.enemies
if (enemy.exist?)
enemy.remove_state(17)
end
end
end
def battle_refresh_windows
# NEW - David - Refresh the window
@status_window.refresh
# NEW - David - Enemy status window
#@e_status_window.refresh
Graphics.update
end
end
Window_Base
Code:
#==============================================================================
# â– Window_Base
#------------------------------------------------------------------------------
#  ゲームä¸ã®ã™ã¹ã¦ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®ã‚¹ãƒ¼ãƒ‘ークラスã§ã™ã€‚
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
# x : ウィンドウ㮠X 座標
# y : ウィンドウ㮠Y 座標
# width : ウィンドウã®å¹…
# height : ウィンドウã®é«˜ã•
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
# NEW - David
@main_color=normal_color
@secondary_color=system_color
@davids_color=Color.new(255, 255, 64, 255)
# NEW - David - 04.14.05
@d_light = Color.new(50, 50, 50, 255)
@d_dark = Color.new(200, 200, 200, 255)
@d_black = Color.new(0, 0, 0, 255)
end
#--------------------------------------------------------------------------
# ◠解放
#--------------------------------------------------------------------------
def dispose
# ウィンドウ内容ã®ãƒ“ットマップãŒè¨å®šã•ã‚Œã¦ã„ã‚Œã°è§£æ”¾
if self.contents != nil
self.contents.dispose
end
super
end
#--------------------------------------------------------------------------
# â— æ–‡å—色å–å¾—
# n : æ–‡å—è‰²ç•ªå· (0~7)
#--------------------------------------------------------------------------
def text_color(n)
case n
when 0
return Color.new(255, 255, 255, 255)
when 1
return Color.new(128, 128, 255, 255)
when 2
return Color.new(255, 128, 128, 255)
when 3
return Color.new(128, 255, 128, 255)
when 4
return Color.new(128, 255, 255, 255)
when 5
return Color.new(255, 128, 255, 255)
when 6
return Color.new(255, 255, 128, 255)
when 7
return Color.new(192, 192, 192, 255)
else
normal_color
end
end
#--------------------------------------------------------------------------
# ◠通常文å—色ã®å–å¾—
#--------------------------------------------------------------------------
def normal_color
return Color.new(255, 255, 255, 255)
end
#--------------------------------------------------------------------------
# ◠無効文å—色ã®å–å¾—
#--------------------------------------------------------------------------
def disabled_color
return Color.new(255, 255, 255, 128)
end
#--------------------------------------------------------------------------
# ◠システム文å—色ã®å–å¾—
#--------------------------------------------------------------------------
def system_color
return Color.new(192, 224, 255, 255)
end
#--------------------------------------------------------------------------
# ◠ピンãƒæ–‡å—色ã®å–å¾—
#--------------------------------------------------------------------------
def crisis_color
return Color.new(255, 255, 64, 255)
end
#--------------------------------------------------------------------------
# ◠戦闘ä¸èƒ½æ–‡å—色ã®å–å¾—
#--------------------------------------------------------------------------
def knockout_color
return Color.new(255, 64, 0)
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
def update
super
# ウィンドウスã‚ンãŒå¤‰æ›´ã•ã‚ŒãŸå ´åˆã€å†è¨å®š
if $game_system.windowskin_name != @windowskin_name
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
end
#--------------------------------------------------------------------------
# ◠グラフィックã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# â— åå‰ã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
#FACE PICS-------------------------------------------
def draw_actor_face(actor, x, y)
bitmap = RPG::Cache.picture(actor.id.to_s)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 5, y - ch, bitmap, src_rect)
end
#----------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
#--------------------------------------------------------------------------
# ◠クラスã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 236, 32, actor.class_name)
end
#--------------------------------------------------------------------------
# ◠レベルã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
#--------------------------------------------------------------------------
# â— æ画用ã®ã‚¹ãƒ†ãƒ¼ãƒˆæ–‡å—列作æˆ
# actor : アクター
# width : æ画先ã®å¹…
# need_normal : [æ£å¸¸] ãŒå¿…è¦ã‹ã©ã†ã‹ (true / false)
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
# 括弧ã®å¹…ã‚’å–å¾—
brackets_width = self.contents.text_size("[]").width
# ステートåã®æ–‡å—列を作æˆ
text = ""
for i in battler.states
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
# ステートåã®æ–‡å—列ãŒç©ºã®å ´åˆã¯ "[æ£å¸¸]" ã«ã™ã‚‹
if text == ""
if need_normal
text = "[Normal]"
end
else
# 括弧をã¤ã‘ã‚‹
text = "[" + text + "]"
end
# 完æˆã—ãŸæ–‡å—列を返ã™
return text
end
#--------------------------------------------------------------------------
# ◠ステートã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
# width : æ画先ã®å¹…
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 120)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text)
end
#--------------------------------------------------------------------------
# â— EXP ã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x +2, y, 32, 32, "Exp")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
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.draw_text(x +2, y, 32, 32, $data_system.words.hp)
# MaxHP ã‚’æç”»ã™ã‚‹ã‚¹ãƒšãƒ¼ã‚¹ãŒã‚ã‚‹ã‹è¨ˆç®—
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# HP ã‚’æç”»
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
# MaxHP ã‚’æç”»
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
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.draw_text(x +2, y, 32, 32, $data_system.words.sp)
# MaxSP ã‚’æç”»ã™ã‚‹ã‚¹ãƒšãƒ¼ã‚¹ãŒã‚ã‚‹ã‹è¨ˆç®—
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# SP ã‚’æç”»
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
#self.contents.draw_text(sp_x, y, 48, 32, $game_temp.battle_turn.to_s, 2)
# MaxSP ã‚’æç”»
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# ◠パラメータã®æç”»
# actor : アクター
# x : æ画先 X 座標
# y : æ画先 Y 座標
# type : パラメータã®ç¨®é¡ž (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
#--------------------------------------------------------------------------
# ◠アイテムåã®æç”»
# item : アイテãƒ
# x : æ画先 X 座標
# y : æ画先 Y 座標
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
# NEW - David - All below
def draw_total_number(actor, total, x, y)
sp_x = x + 144 - 108
#self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(sp_x, y, 48, 32, total.to_s)
end
# NEW - David - All below
def draw_actor_ct_meter(actor, x, y, width = 144, height = 8)
if type == 1 and actor.hp == 0
return
end
for i in 0 ... $total_number
if actor == $keep_id[i]
actor_turn = $keep_number[i]
end
end
actor_ct = $keep_count[actor_turn]
if (actor_ct > 1000) or (actor_ct == -1)
actor_ct = 1000
end
self.contents.fill_rect(x-1, y, width +2, height +2, @d_light)
self.contents.fill_rect(x-1, y, width +1, height +1, @d_dark)
self.contents.fill_rect(x, y+1, width, height, @d_black)
self.contents.fill_rect(x, y+1, width * actor_ct / $ct_full, height, @davids_color)
end
# NEW - David - All below
def draw_enemy_ct_meter(enemy, x, y, width = 144, height = 8)
if type == 1 and enemy.hp == 0
return
end
for i in 0 ... $total_number
if enemy == $keep_id[i]
enemy_turn = $keep_number[i]
end
end
enemy_ct = $keep_count[enemy_turn]
if (enemy_ct > $ct_full) or (enemy_ct == -1)
enemy_ct = $ct_full
end
self.contents.fill_rect(x-1, y, width +2, height +2, @d_light)
self.contents.fill_rect(x-1, y, width +1, height +1, @d_dark)
self.contents.fill_rect(x, y+1, width, height, @d_black)
self.contents.fill_rect(x, y+1, width * enemy_ct / $ct_full, height, @davids_color)
end
#--------------------------------------------------------------------------
# Showing the HP BAR
# Script by Firewords
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y, width = 200, height =8)
# Showing and cutting the picture
self.contents.fill_rect(x-1, y-2, width +2, height +2, Color.new(0, 0, 0, 255))
bitmap=RPG::Cache.picture("HP_Barra")
cw=bitmap.width
ch=bitmap.height
src_rect=Rect.new(0,0,cw,ch)
# %
dest_rect=Rect.new(x,y-1,width * actor.hp / actor.maxhp,height)
# Shows if there's a real value
if actor.hp != 0
self.contents.stretch_blt(dest_rect,bitmap,src_rect)
end
end
#--------------------------------------------------------------------------
# Showing the SP BAR
# Script by Firewords
#--------------------------------------------------------------------------
def draw_actor_mp_bar(actor, x, y, width = 200, height =8)
# Showing and cutting the picture
self.contents.fill_rect(x-1, y-2, width +2, height +2, Color.new(0, 0, 0, 255))
bitmap=RPG::Cache.picture("MP_Barra")
cw=bitmap.width
ch=bitmap.height
src_rect=Rect.new(0,0,cw,ch)
# %
dest_rect=Rect.new(x,y-1,width * actor.sp / actor.maxsp,height)
# Shows if there's a real value
if actor.sp != 0
self.contents.stretch_blt(dest_rect,bitmap,src_rect)
end
end # of Window_Base