First, allow me say, I am relatively new when it comes to scripting (my knowledge is mostly confined to script modifying, not creating), so any help would be greatly appreciated.
Anyway, I've been using Atoa's version of Tankentai's Side view battle system and most of the add-on's with it. I have already adjusted the interface (windows and so forth) to make them compatible with the ATB system in Tankentai's sideview battle system. I recently tried an advanced skills option script that allows the actor to use a certain amount of MP to increase/decrease the power of a skill. Everything works, except when I go to actually use the skill. The actors simply don't move, they don't use the skill. There is no error, and the script works fine with the regular battle system that comes with the maker, but for whatever reason everything in the script works fine except the actual skill use. Like I said, nothing happens, but I cannot seem to locate why or where the problem is occurring.
So my question is, does anyone have any ideas of what might be causing this? I pasted the code below. Any ideas what might be conflicting and what could be done to make them compatible?
Thank you again for any help in advance.
#==============================================================================
# Advanced Skill Options
# Version 1.0
# Author: modern algebra
# Date: June 5, 2007
#------------------------------------------------------------------------------
# Description: This script is loosely based off the Betrayal at Krondor Spell
# System, with a few differences. Basically, it allows the player to determine
# the power of his skills by choosing how much SP he will use to use the skill.
# Basically, it multiplies each stat which determines effect (POWER, ATK-F,
# etc...) by the percentage of the max SP the player uses. So, if the player
# devotes 20 SP to a skill with 100 max SP, then each of the stats of the skill
# will be only 20% their original value. Also, skills with a power of 0 are
# ignored by this script, so for skills which cause status effects, just set the
# power to 0
#------------------------------------------------------------------------------
# Instructions:
# Place this script above main in the script editor
#==============================================================================
class Window_SkillData < Window_Base
def initialize (skill)
super(340, 80, 300, 240)
self.contents = Bitmap.new(width - 32, height - 32)
self.z=190
self.opacity = 100
@skill = skill
$choice_sp_cost = 0
refresh
end
def refresh
self.contents.clear
line = []
tw = @skill.name.length*10
if tw > 280
tw = 280
end
self.contents.font.color = system_color
self.contents.draw_text (130 - (0.5*tw),0,tw,32, @skill.name)
self.contents.font.color = normal_color
self.contents.font.size = 18
tw = @skill.description.length
line_index = 0
limit = 0
loop do
line[line_index] = @skill.description[limit, 36]
for i in 1...36
if line[line_index][-i,1] == " " || limit + (36-i) >= @skill.description.size
limit += (37-i)
tw -= 36-i
line_index +=1
break
else
line[line_index][-i,1] = " "
end
end
if tw <= 0
break
end
end
line.compact!
for i in 0...line.size
self.contents.draw_text (0, 26*i + 32, 280,32, line[i])
end
self.contents.font.color = system_color
self.contents.font.size = 22
self.contents.draw_text (0,2*26 + 64,160,32, "Skill Power:")
self.contents.draw_text (0,2*26 + 96,160,32, "Max " +$data_system.words.sp+ " Cost:")
self.contents.draw_text (0,2*26 + 128,160,32, "Current Power:")
self.contents.font.color = normal_color
max_power = @skill.power.to_f / @skill.sp_cost.to_f
max_power = (max_power*100).round.to_f / 100.0
tw = (max_power.to_s + " * " +$data_system.words.sp).length
tw = tw*6
self.contents.draw_text (248 - tw,2*26 + 64,140,32, max_power.to_s + " * " +$data_system.words.sp)
self.contents.draw_text (248 - tw,2*26 + 96,160,32, @skill.sp_cost.to_s)
self.contents.draw_text (248 - tw,2*26 + 128,160,32, (max_power*$choice_sp_cost).to_s)
end
end
class Window_ChoosePower < Window_Selectable
def initialize (skill, actor)
super(0, 246, 160, 80)
self.contents = Bitmap.new(width - 32, height - 32)
self.z=200
self.opacity = 235
@actor = actor
@skill = skill
sp_cost_digits_temp = @skill.sp_cost
$sp_cost_digits = 0
while sp_cost_digits_temp != 0
sp_cost_digits_temp = sp_cost_digits_temp / 10
$sp_cost_digits +=1
end
$digits = []
for i in 0...$sp_cost_digits
$digits[i] = 0
end
self.active = false
self.index = 0
refresh
end
def refresh
self.contents.clear
for i in 0...$sp_cost_digits
self.contents.draw_text(75+ i*20 - $sp_cost_digits*10,5,20,32,$digits[i].to_s)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
@index = self.index
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(70 + @index*20 - $sp_cost_digits*10,5,20,32)
end
end
def determine_sp_cost
current_sp = ""
for i in 0...$sp_cost_digits
current_sp += $digits[i].to_s
end
current_sp = current_sp.to_i
return current_sp
end
def update
$choice_sp_cost = determine_sp_cost
if Input.repeat? (Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
self.index = (self.index + 1) % ($sp_cost_digits)
update_cursor_rect
elsif Input.repeat? (Input::LEFT)
$game_system.se_play($data_system.cursor_se)
self.index = (self.index - 1)% ($sp_cost_digits)
update_cursor_rect
elsif Input.repeat? (Input::DOWN)
$digits[self.index] = ($digits[self.index] - 1)%10
current_sp = determine_sp_cost
if @skill.sp_cost < @actor.sp
max_sp_cost = @skill.sp_cost
else
max_sp_cost = @actor.sp
end
while current_sp > max_sp_cost
$digits[self.index] = ($digits[self.index] - 1)
current_sp = determine_sp_cost
end
$choice_sp_cost = current_sp
elsif Input.repeat? (Input::UP)
$game_system.se_play($data_system.cursor_se)
$digits[self.index] = ($digits[self.index] + 1) % 10
current_sp = determine_sp_cost
if @skill.sp_cost < @actor.sp
max_sp_cost = @skill.sp_cost
else
max_sp_cost = @actor.sp
end
if current_sp > max_sp_cost
$digits[self.index] = 0
end
$choice_sp_cost = determine_sp_cost
end
refresh
end
end
class Game_Battler
#--------------------------------------------------------------------------
# * Determine Usable Skills
# skill_id : skill ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# If there's not enough SP, the skill cannot be used.
if self.sp == 0 || ($data_skills[skill_id].power == 0 && $data_skills[skill_id].sp_cost > self.sp)
return false
end
# Unusable if incapacitated
if dead?
return false
end
# If silent, only physical skills can be used
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# Get usable time
occasion = $data_skills[skill_id].occasion
# If in battle
if $game_temp.in_battle
# Usable with [Normal] and [Only Battle]
return (occasion == 0 or occasion == 1)
# If not in battle
else
# Usable with [Normal] and [Only Menu]
return (occasion == 0 or occasion == 2)
end
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@wait = 0
$skill_stats = []
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make help window, status window, and skill window
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
# Associate help window
@skill_window.help_window = @help_window
# Make target window (set to invisible / inactive)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
if @data_window != nil
@data_window.dispose
@power_window.dispose
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
if @wait == 1
@target_window.visible = false
@skill_window.active = true
@wait -=1
return
elsif @wait > 0
@wait -=1
return
end
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
# If skill target is active: call update_target
if @target_window.active
update_target
return
end
# If power window is active: call update_power
if @power_window.active
update_power
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If unable to use
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is ally
if @skill.scope >= 3
# Activate power window
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
if @skill.power != 0
@power_window = Window_ChoosePower.new (@skill, @actor)
@data_window = Window_SkillData.new (@skill)
@power_window.active = true
@power = true
else
@target_window.active = true
@target_window.visible = true
@power = false
end
# Set cursor position to effect scope (single / all)
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
# If effect scope is other than ally
else
# If common event ID is valid
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Play use skill SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase target window
@target_window.visible = false
@target_window.active = false
@power_window.active = true
@power_window.visible = true
@data_window.visible = true
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
unless @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
@target_window.active = false
return
end
# If target is all
if @target_window.index == -1
# Apply skill use effects to entire party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# If target is user
if @target_window.index <= -2
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# If single target
if @target_window.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# If skill was used
if used
# Play skill use SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# If SP Cost Chosen
if @power == true
# Return stats to original values
$data_skills[@skill.id].sp_cost = $skill_stats[@skill.id][7]
$data_skills[@skill.id].power = $skill_stats[@skill.id][0]
$data_skills[@skill.id].atk_f = $skill_stats[@skill.id][1]
$data_skills[@skill.id].eva_f = $skill_stats[@skill.id][2]
$data_skills[@skill.id].str_f = $skill_stats[@skill.id][3]
$data_skills[@skill.id].dex_f = $skill_stats[@skill.id][4]
$data_skills[@skill.id].agi_f = $skill_stats[@skill.id][5]
$data_skills[@skill.id].int_f = $skill_stats[@skill.id][6]
end
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# If entire party is dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If command event ID is valid
if @skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
@target_window.active = false
@wait = 15
end
# If skill wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
# If SP Cost was chosen
if @power == true
# Return stats to original values
$data_skills[@skill.id].sp_cost = $skill_stats[@skill.id][7]
$data_skills[@skill.id].power = $skill_stats[@skill.id][0]
$data_skills[@skill.id].atk_f = $skill_stats[@skill.id][1]
$data_skills[@skill.id].eva_f = $skill_stats[@skill.id][2]
$data_skills[@skill.id].str_f = $skill_stats[@skill.id][3]
$data_skills[@skill.id].dex_f = $skill_stats[@skill.id][4]
$data_skills[@skill.id].agi_f = $skill_stats[@skill.id][5]
$data_skills[@skill.id].int_f = $skill_stats[@skill.id][6]
end
end
return
end
end
def update_power
@power_window.update
@data_window.refresh
# If Enter is pressed, assign updated stats to the skill
if Input.trigger? (Input::C)
$game_system.se_play($data_system.decision_se)
# Retain original stats in an array
$skill_stats[@skill.id] = [@skill.power, @skill.atk_f, @skill.eva_f, @skill.str_f, @skill.dex_f, @skill.agi_f, @skill.int_f, @skill.sp_cost]
# Set the stats of the skill to their new power
multiplier = ($choice_sp_cost.to_f / $data_skills[@skill.id].sp_cost.to_f)
$data_skills[@skill.id].power = ($data_skills[@skill.id].power * multiplier).to_i
$data_skills[@skill.id].atk_f = ($data_skills[@skill.id].atk_f * multiplier).to_i
$data_skills[@skill.id].eva_f = ($data_skills[@skill.id].eva_f * multiplier).to_i
$data_skills[@skill.id].str_f = ($data_skills[@skill.id].str_f * multiplier).to_i
$data_skills[@skill.id].dex_f = ($data_skills[@skill.id].dex_f * multiplier).to_i
$data_skills[@skill.id].agi_f = ($data_skills[@skill.id].agi_f * multiplier).to_i
$data_skills[@skill.id].int_f = ($data_skills[@skill.id].int_f * multiplier).to_i
$data_skills[@skill.id].sp_cost = $choice_sp_cost
# turn off choose_power and choose target
@power_window.active = false
@power_window.visible = false
@data_window.visible = false
@target_window.visible = true
@target_window.active = true
end
# If ESC is pressed, return to the skill choosing window
if Input.trigger? (Input::B)
$game_system.se_play ($data_system.cancel_se)
@power_window.active = false
@power_window.visible = false
@data_window.visible = false
@skill_window.active = true
end
end
end
class Scene_Battle
alias dispose_new_windows end_skill_select
def end_skill_select
dispose_new_windows
if @power_window != nil
@power_window.dispose
@power_window = nil
end
if @data_window != nil
@data_window.dispose
@data_window = nil
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase)
#--------------------------------------------------------------------------
def update_phase3
# If enemy arrow is enabled
if @enemy_arrow != nil
update_phase3_enemy_select
# If actor arrow is enabled
elsif @actor_arrow != nil
update_phase3_actor_select
# If skill window is enabled
elsif @power_window != nil
update_power
elsif @skill_window != nil
update_phase3_skill_select
# If item window is enabled
elsif @item_window != nil
update_phase3_item_select
# If actor command window is enabled
elsif @actor_command_window.active
update_phase3_basic_command
end
end
def update_phase3_skill_select
# Make skill window visible
@skill_window.visible = true
# Update skill window
@skill_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End skill selection
end_skill_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If it can't be used
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
@data_window = Window_SkillData.new (@skill)
@power_window = Window_ChoosePower.new (@skill, $game_party.actors[@actor_index])
if @power == nil
@power = []
end
if @skill.power != 0
@power_window.visible = true
@power_window.active = true
@power[@skill.id] = true
else
@power[@skill.id] = false
@power_window.active = false
@power_window.visible = false
@data_window.visible = false
# Set action
@active_battler.current_action.skill_id = @skill.id
# Make skill window invisible
@skill_window.visible = false
# If effect scope is single enemy
if @skill.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is single ally
elsif @skill.scope == 3 or @skill.scope == 5
# Start actor selection
start_actor_select
# If effect scope is not single
else
# End skill selection
end_skill_select
# Go to command input for next actor
phase3_next_actor
end
end
return
end
end
def update_power
@power_window.update
@data_window.refresh
if Input.trigger? (Input::C)
if $choice_sp_cost == 0
$choice_sp_cost = 1
end
if $skill_stats == nil
$skill_stats = []
end
$game_system.se_play($data_system.decision_se)
# Retain original stats in an array
$skill_stats[@skill.id] = [@skill.power, @skill.atk_f, @skill.eva_f, @skill.str_f, @skill.dex_f, @skill.agi_f, @skill.int_f, @skill.sp_cost]
# Set the stats of the skill to their new power
multiplier = ($choice_sp_cost.to_f / $data_skills[@skill.id].sp_cost.to_f)
$data_skills[@skill.id].power = ($data_skills[@skill.id].power * multiplier).to_i
$data_skills[@skill.id].atk_f = ($data_skills[@skill.id].atk_f * multiplier).to_i
$data_skills[@skill.id].eva_f = ($data_skills[@skill.id].eva_f * multiplier).to_i
$data_skills[@skill.id].str_f = ($data_skills[@skill.id].str_f * multiplier).to_i
$data_skills[@skill.id].dex_f = ($data_skills[@skill.id].dex_f * multiplier).to_i
$data_skills[@skill.id].agi_f = ($data_skills[@skill.id].agi_f * multiplier).to_i
$data_skills[@skill.id].int_f = ($data_skills[@skill.id].int_f * multiplier).to_i
$data_skills[@skill.id].sp_cost = $choice_sp_cost
# Get rid of power and data window
@power_window.active = false
@power_window.visible = false
@data_window.visible = false
# Set action
@active_battler.current_action.skill_id = @skill.id
# Make skill window invisible
@skill_window.visible = false
# If effect scope is single enemy
if @skill.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is single ally
elsif @skill.scope == 3 or @skill.scope == 5
# Start actor selection
start_actor_select
# If effect scope is not single
else
# End skill selection
end_skill_select
# Go to command input for next actor
phase3_next_actor
end
end
if Input.trigger? (Input::B)
$game_system.se_play($data_system.buzzer_se)
@data_window.visible = false
@power_window.dispose
@power_window = nil
end
end
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
def make_skill_action_result
# Get skill
@skill = $data_skills[@active_battler.current_action.skill_id]
# If not a forcing action
unless @active_battler.current_action.forcing
# If unable to use due to SP running out
unless @active_battler.skill_can_use?(@skill.id)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
end
# Use up SP
@active_battler.sp -= @skill.sp_cost
# Refresh status window
@status_window.refresh
# Show skill name on help window
@help_window.set_text(@skill.name, 1)
# Set animation ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# Set command event ID
@common_event_id = @skill.common_event_id
# Set target battlers
set_target_battlers(@skill.scope)
# Apply skill effect
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
if @power[@skill.id] == true
# Return stats to original values
$data_skills[@skill.id].sp_cost = $skill_stats[@skill.id][7]
$data_skills[@skill.id].power = $skill_stats[@skill.id][0]
$data_skills[@skill.id].atk_f = $skill_stats[@skill.id][1]
$data_skills[@skill.id].eva_f = $skill_stats[@skill.id][2]
$data_skills[@skill.id].str_f = $skill_stats[@skill.id][3]
$data_skills[@skill.id].dex_f = $skill_stats[@skill.id][4]
$data_skills[@skill.id].agi_f = $skill_stats[@skill.id][5]
$data_skills[@skill.id].int_f = $skill_stats[@skill.id][6]
end
end
end
end
Remove this from your script...
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
def make_skill_action_result
# Get skill
@skill = $data_skills[@active_battler.current_action.skill_id]
# If not a forcing action
unless @active_battler.current_action.forcing
# If unable to use due to SP running out
unless @active_battler.skill_can_use?(@skill.id)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
end
# Use up SP
@active_battler.sp -= @skill.sp_cost
# Refresh status window
@status_window.refresh
# Show skill name on help window
@help_window.set_text(@skill.name, 1)
# Set animation ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# Set command event ID
@common_event_id = @skill.common_event_id
# Set target battlers
set_target_battlers(@skill.scope)
# Apply skill effect
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
if @power[@skill.id] == true
# Return stats to original values
$data_skills[@skill.id].sp_cost = $skill_stats[@skill.id][7]
$data_skills[@skill.id].power = $skill_stats[@skill.id][0]
$data_skills[@skill.id].atk_f = $skill_stats[@skill.id][1]
$data_skills[@skill.id].eva_f = $skill_stats[@skill.id][2]
$data_skills[@skill.id].str_f = $skill_stats[@skill.id][3]
$data_skills[@skill.id].dex_f = $skill_stats[@skill.id][4]
$data_skills[@skill.id].agi_f = $skill_stats[@skill.id][5]
$data_skills[@skill.id].int_f = $skill_stats[@skill.id][6]
end
end
end
Thank you very much. I BELIEVE that has worked. Playing with it now but it seems to be running smoothly.
cool, so you wanna make scripting one of your main skills?
I'm quite interested in learning how to script. Do you have any suggestions?
just keep doing what your doing, learn how windows work and when ever your stuck on something you have examples all over in the RTP scripts that show how windows work, scenes, and how to create and use RPG::Sprite and Plane.
Also something that really helped me learn was de-compiling, take some ones script and read it line for line commenting what it does.
oh and this site will also help you alot.. http://ruby-doc.org/docs/ProgrammingRuby/
I appreciate the support. I will continue learning and check out that link you provided.
I am having another problem in which the game freezes when the character that uses the dual wield system is alone in a battle. I have an introductory battle in my game and usually it runs fine, however, I've noticed that when the dual-wielding character is the last left alive and goes to attack the game freezes. I am guessing this also has to do with Tenkantai's battle system script, but and am not sure what would be causing the freeze. There is no error message, and the actors continue their animation, but the battle freezes and no one attacks (actors or enemies). Any suggestions?
Do you think it may be something specific to the dual wield script? It's strange because I don't think it happens with other characters (I have tested it by having a different character with dual wielding ability go and fight in other battles and it has not, as of yet, frozen). So, it makes me think that the script itself actually works, but something in this particular battle/with this particular actor may be wrong...
I'm at a loss.
Well, only thing that i could think it is, is possibly the the way the action is taken out in battle. My advice is to go into the scripts (all) and see how the commands are transfers from player into code and then how it processes them.
Your gonna have to trace down through the process and figure out where its going wrong.
Ok, I'll keep trying. Thanks. :)
Believe me you will learn quite a bit just by doing that.
Well, I've just done about 50 test runs and found out it is NOT just when there is a dual-wielding character left. I got no freezes for about the first 49 times (estimating, lol) and then, boom, had a non dual-wielding character left (1 out of three) and got a freeze... It seems pretty rare, but I'm still not sure what is causing it and, unfortunately, the possibilities have just been broadened...
The duel wielding script another add on to the other two? ( i ask cause i have never used the scripts your talking bout)
Well, here's how it's broken down.
The Tenkantai side-view ABS has a host of add-ons, one of which is the dual-wielding script (actually, a portion of a script).
The advanced skill option add-on (which allows for the player to choose how much SP to use) is actually a separate add-on not associated with Tenkaintai's ABS.
I cannot seem to narrow down what is causing the freezing, however. I have noticed that it occurs when a character (usually the only character left alive) has his "wait" bar full and the attack command has been selected.
That being said, it only happens once in awhile, and I have a hard time reproducing it when needed to examine it more thoroughly.
Hmm what i think it is, there is a missing "=" sign where its needed, cause if you say its only when the wait is full then in code some place there is this example.
if @wait_time < some_num
do_this
end
where i think it should be
if @wait_time <= then_this
do_this
end
i could be wrong but you can try looking for something like that.
Thanks, I'll keep in eye out for that as I'm checking over the code. I'll let you know what happens!
Edit: Well, here's a portion of the code that's relevant, but I cannot find a serious problem with it that would be causing the freeze.
#==============================================================================
# ? Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
include N01
#--------------------------------------------------------------------------
attr_accessor :cast_action
attr_accessor :cast_target
attr_accessor :turn_count
attr_accessor :guarding
attr_accessor :passed
#--------------------------------------------------------------------------
alias acbs_initialize_atb initialize
def initialize
acbs_initialize_atb
@cast_skill = @turn_count = 0
@guarding = @passed = false
end
#--------------------------------------------------------------------------
def atb_linetype
return 4 if self.cast_action != nil and self.atb_full?
return 3 if self.cast_action != nil
return 2 if self.atb_full?
return 1
end
#--------------------------------------------------------------------------
def atb_lineamount
return 0 if self.dead?
return 100 * self.atb / self.max_atb
end
#--------------------------------------------------------------------------
def atb_enemy_visible
return 0 if self.dead? and Enemy_Meter > 0
return 255
end
#--------------------------------------------------------------------------
def max_atb
return Max_Atb
end
#--------------------------------------------------------------------------
def atb
return @atb.nil? ? @atb = 0 : @atb
end
#--------------------------------------------------------------------------
def atb=(n)
@atb = [[n.to_i, 0].max, self.max_atb].min
end
#--------------------------------------------------------------------------
def atb_preset
percent = self.max_atb * Atb_Initial_Rate * (rand(64) + 16) * self.agi / total_agi / 240
self.atb = Atb_Initial_Value + percent
end
#--------------------------------------------------------------------------
def total_agi
total = 0
for battler in $game_party.actors + $game_troop.enemies
total += battler.agi
end
return total
end
#--------------------------------------------------------------------------
def atb_full?
return @atb == self.max_atb
end
#--------------------------------------------------------------------------
def atb_update
if self.cast_action.nil?
self.atb += Speed * (190 + rand(10)) * self.agi / total_agi
else
cast = cast_action.cast_speed(self)
self.atb += Speed * cast / total_agi
end
end
#--------------------------------------------------------------------------
def casting
if Casting_Pose[self.id] != nil
return Casting_Pose[self.id]
end
return Casting_Pose_Default
end
end
K, that looks like its the Action meter part of the script, where is it being used at in the battle? search for "atb_" using "ctrl + shift + f"
Oh man, atb_ is all over the script, lol. There are a lot of references, but perhaps the "Scene_Battle" portion would be the most helpful? I can't seem to find exactly where the problem would be in that particular section (it is fairly large).
I see where it deals specifically with escaping, using items, skills, etc. but where does it relate to a simple attack?
#==============================================================================
# ? Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
include N01
#--------------------------------------------------------------------------
alias acbs_main_atb main
def main
turn_count_speed
@escape_ratio = 40
$game_temp.escape_count = 0
@escape_type, @escape_name = Escape_Type, Escape_Name
@input_battlers, @action_battlers = [], []
@input_battler, @action_battler = nil, nil
@escaped = @update_turn_end = @action_phase = false
acbs_main_atb
end
#--------------------------------------------------------------------------
alias acbs_start_atb start
def start
acbs_start_atb
add_bars
for battler in $game_party.actors + $game_troop.enemies
battler.turn_count = 0
battler.atb = 0
battler.atb_preset
battler.cast_action = nil
battler.cast_target = nil
battler.defense_pose = false
end
for actor in $game_party.actors
actor.atb = actor.max_atb - 1 if $preemptive
actor.atb = 0 if $back_attack
end
for enemy in $game_troop.enemies
enemy.atb = 0 if $preemptive
enemy.atb = enemy.max_atb - 1 if $back_attack
end
update_meters
end
#--------------------------------------------------------------------------
alias acbs_terminate_atb terminate
def terminate
acbs_terminate_atb
remove_bars
end
#--------------------------------------------------------------------------
def add_bars
@atb_meters = ATB_Meters.new if Meters
@atb_meters_enemy = ATB_Meters_Enemy.new if Enemy_Meter != 0 and Meters
@atb_bars = ATB_Bars.new if Bars
end
#--------------------------------------------------------------------------
def remove_bars
@atb_meters.dispose if Meters
@atb_bars.dispose if Bars
@atb_meters_enemy.dispose if Enemy_Meter != 0 and Meters
end
#--------------------------------------------------------------------------
alias acbs_update_atb update
def update
if @phase == 1
$game_temp.battle_main_phase = true
@actor_command_window.opacity = 0
@phase = 0
elsif @phase != 5
@phase = 0
end
@event_running = true if $game_system.battle_interpreter.running?
acbs_update_atb
if $game_system.battle_interpreter.running?
return
elsif @event_running
@status_window.refresh
@event_running = false
end
return $scene = Scene_Gameover.new if $game_temp.gameover
return update_phase5 if @phase == 5
@event_running = true if $game_system.battle_interpreter.running?
if @update_turn_end
turn_ending
@update_turn_end = false
end
if Input.press?(Escape_Input) and @escape_type > 0
if $game_temp.battle_can_escape
$game_temp.max_escape_count = update_phase2_escape_rate
$game_temp.escape_count += 2 unless @wait_on
@escaping = true
if !@help_window.visible and @escape_type == 1
@help_window.set_text('')
@help_window.set_text(Escape_Message, 1)
end
if @escape_type == 2
if @escape_atb_meters.nil?
@escape_atb_meters = Escape_Meters.new
@escape_meter_opacity = 0
@escape_atb_meters.visible = true
else @escape_atb_meters != nil
@escape_atb_meters.opacity = 15 * @escape_meter_opacity
@escape_meter_opacity = [@escape_meter_opacity + 1, 17].min
@escape_atb_meters.refresh
end
end
if $game_temp.escape_count >= $game_temp.max_escape_count
$game_temp.escape_count = 0
update_phase2_escape unless $game_party.all_dead?
end
else
@help_window.set_text(Cant_Escape_Message, 1) if @escape_type == 1
if @escape_type == 2
if @escape_atb_meters.nil?
@escape_atb_meters = Escape_Meters.new
@escape_meter_opacity = 0
@escape_atb_meters.visible = true
else @escape_atb_meters != nil
@escape_atb_meters.opacity = 15 * @escape_meter_opacity
@escape_meter_opacity = [@escape_meter_opacity + 1, 17].min
@escape_atb_meters.refresh
end
end
end
elsif @escape_type > 0
if @escaping
@escaping = false
@help_window.visible = false
end
$game_temp.escape_count = [$game_temp.escape_count - 1, 0].max unless @wait_on
if @escape_atb_meters != nil and $game_temp.escape_count == 0
@escape_atb_meters.opacity = 15 * @escape_meter_opacity
@escape_meter_opacity = [@escape_meter_opacity - 1, 0].max
if @escape_meter_opacity == 0
@escape_atb_meters.dispose
@escape_atb_meters = nil
end
end
@escape_atb_meters.refresh if @escape_atb_meters != nil
end
return if @escaped
atb_update
input_battler_update(false)
if @action_battlers[0] != nil && @action_battler.nil?
@action_battlers.flatten!
@action_battler = @action_battlers[0]
if @action_battler.dead?
@action_battler.atb = 0
@action_battler = nil
else
start_phase4
end
end
if @action_battler != nil && !@spriteset.effect?
@active_battler = @action_battler
update_phase4
end
end
#--------------------------------------------------------------------------
alias acbs_judge_atb judge
def judge
@end_battle = acbs_judge_atb
return @end_battle
end
#--------------------------------------------------------------------------
alias acbs_update_basic_atb update_basic
def update_basic
atb_update unless @battle_start
input_battler_update(true)
acbs_update_basic_atb
end
#--------------------------------------------------------------------------
def input_battler_update(basic)
for battler in $game_troop.enemies + $game_party.actors
if battler.atb_full? and battler != @action_battler and not
@action_battlers.include?(battler)
battler_turn(battler)
break if Wait_Act_End and not battler.actor?
end
end
if @input_battlers[0] != nil && @input_battler.nil? && !@wait_on
@input_battlers.flatten!
@input_battler = @input_battlers[0]
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
@input_battler.defense_pose = false
@action_battlers << @input_battler
@input_battlers.shift
@input_battler = nil
elsif @input_battler.inputable?
@actor_index = $game_party.actors.index(@input_battler)
@input_battler.current_action.clear
@input_battler.blink = true
else
@input_battler.atb_update
@input_battlers.shift
@input_battler = nil
end
end
if @input_battler != nil
@input_action = true if basic
@now_battler = @active_battler
@active_battler = @input_battler
@input_battler.defense_pose = false
phase3_setup_command_window if @actor_command_window.opacity == 0
update_phase3
@active_battler = @now_battler
@input_action = false if basic
end
for battler in $game_party.actors + $game_troop.enemies
if battler.dead? or not battler.exist?
@input_battlers.delete(battler)
@action_battlers.delete(battler)
end
end
end
#--------------------------------------------------------------------------
def battler_turn(battler)
battler.turn_count += 1
if battler.is_a?(Game_Actor)
if battler.inputable? and battler.cast_action.nil?
@input_battlers << battler
else
if battler.restriction == 2 || battler.restriction == 3
battler.current_action.kind = 0
battler.current_action.basic = 0
end
battler.defense_pose = false
@action_battlers << battler
end
else
battler.make_action
@action_battlers << battler
end
end
#--------------------------------------------------------------------------
def atb_update
@wait_on = wait_on
return if @wait_on
@atb_turn_count += 1 if Custom_Turn_Count == 2
if @atb_turn_count >= @abt_turn_speed
@update_turn_end = true
$game_temp.battle_turn += 1
turn_count_speed
for battler in $game_party.actors + $game_troop.enemies
battler.remove_states_auto if battler.exist?
end
setup_battle_event
end
for battler in $game_party.actors + $game_troop.enemies
unless battler == @action_battler or
(@escaping and battler.actor? and @escape_type > 0)
battler.atb_update if battler.exist? and not battler.restriction == 4
end
end
update_meters
end
#--------------------------------------------------------------------------
def wait_on
return true if $game_system.wait_mode == 1 and (@skill_window != nil or @item_window != nil)
return true if $game_system.wait_mode == 0 and @input_battler != nil
return true if $game_system.action_wait and @action_battler != nil
return true if @force_wait or @battle_end or @escaped
return false
end
#--------------------------------------------------------------------------
def start_phase2
end
#--------------------------------------------------------------------------
def update_meters
@atb_meters.refresh if Meters
@atb_meters_enemy.refresh if Enemy_Meter != 0 and Meters
@atb_bars.refresh if Bars
end
#--------------------------------------------------------------------------
def turn_count_speed
@atb_turn_count = @abt_turn_speed = 0
case Custom_Turn_Count
when 0
for battler in $game_party.actors + $game_troop.enemies
@abt_turn_speed += 1 if battler.exist?
end
when 1
@abt_turn_speed = Action_Turn_Count
when 2
@abt_turn_speed = Time_Tunr_Count
end
end
#--------------------------------------------------------------------------
def update_phase2_escape
windows_dispose
update_phase2_escape_type1 if @escape_type == 0
update_phase2_escape_type2 if @escape_type > 0
end
#--------------------------------------------------------------------------
def update_phase2_escape_type1
enemies_agi = enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
enemies_agi /= [enemies_number, 1].max
actors_agi = actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
actors_agi /= [actors_number, 1].max
@success = rand(100) < @escape_ratio * actors_agi / enemies_agi
if @success
@battle_end = true
$game_system.se_play($data_system.escape_se)
$game_system.bgm_play($game_temp.map_bgm)
battle_end(1)
else
@escape_ratio += 3
phase3_next_actor
end
end
#--------------------------------------------------------------------------
def update_phase2_escape_type2
@escaped = true
@party_command_window.visible = false
@party_command_window.active = false
@actor_command_window.visible = false if @actor_command_window != nil
@actor_command_window.active = false if @actor_command_window != nil
wait(1)
@battle_end = true
$game_system.se_play($data_system.escape_se)
$game_system.bgm_play($game_temp.map_bgm)
if @escape_atb_meters != nil
@escape_atb_meters.dispose
@escape_atb_meters = nil
end
battle_end(1)
end
#--------------------------------------------------------------------------
def update_phase2_escape_rate
enemies_agi = enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
enemies_agi /= [enemies_number, 1].max
actors_agi = actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
actors_agi /= [actors_number, 1].max
escape_rate = Escape_Time * enemies_agi / (actors_agi * Speed)
return escape_rate
end
#--------------------------------------------------------------------------
alias acbs_start_phase5_atb start_phase5
def start_phase5
if @input_battler != nil
@help_window.visible = false if @help_window != nil
windows_dispose
@input_battler.blink = false if @input_battler != nil
end
@atb_meters.opacity = 0 if Meter_Pos_Style == 3
update_meters
acbs_start_phase5_atb
end
#--------------------------------------------------------------------------
alias acbs_update_phase5_atb update_phase5
def update_phase5
windows_dispose
acbs_update_phase5_atb
end
#--------------------------------------------------------------------------
def phase3_setup_command_window
return if @escaped
if @active_battler != nil && @active_battler.cast_action != nil
@active_battler.blink = false
return
end
Audio.se_play('Audio/SE/' + Command_Up_SE)
@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.item
s4 = $data_system.words.guard
s5 = @escape_name
if @escape_type == 0
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
else
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
end
@actor_command_window.x = COMMAND_WINDOW_POSITION[0]
@actor_command_window.y = COMMAND_WINDOW_POSITION[1]
@actor_command_window.back_opacity = COMMAND_OPACITY
@actor_command_window.z = 4500
@active_battler_window.refresh(@active_battler)
@active_battler_window.visible = BATTLER_NAME_WINDOW
@active_battler_window.x = COMMAND_WINDOW_POSITION[0]
@active_battler_window.y = COMMAND_WINDOW_POSITION[1] - 64
@active_battler_window.z = 4500
end
#--------------------------------------------------------------------------
alias acbs_start_enemy_select_atb start_enemy_select
def start_enemy_select
@teste = true
acbs_start_enemy_select_atb
@atb_meters.visible = true if Meters
update_meters unless Wait_Mode == 2
end
#--------------------------------------------------------------------------
alias acbs_update_phase3_skill_select_atb update_phase3_skill_select
def update_phase3_skill_select
@atb_meters.visible = false if Meters and Meter_Pos_Style < 3 and HIDE_WINDOW
acbs_update_phase3_skill_select_atb
update_meters unless Wait_Mode == 2
end
#--------------------------------------------------------------------------
alias acbs_update_phase3_item_select_atb update_phase3_item_select
def update_phase3_item_select
@atb_meters.visible = false if Meters and Meter_Pos_Style < 3 and HIDE_WINDOW
acbs_update_phase3_item_select_atb
update_meters unless Wait_Mode == 2
end
#--------------------------------------------------------------------------
alias acbs_start_actor_select_atb start_actor_select
def start_actor_select
acbs_start_actor_select_atb
@atb_meters.visible = true if Meters
update_meters unless Wait_Mode == 2
end
#--------------------------------------------------------------------------
alias acbs_start_skill_select_atb start_skill_select
def start_skill_select
acbs_start_skill_select_atb
@atb_meters.visible = false if Meters and Meter_Pos_Style < 3 and HIDE_WINDOW
update_meters unless Wait_Mode == 2
end
#--------------------------------------------------------------------------
alias acbs_end_skill_select_atb end_skill_select
def end_skill_select
acbs_end_skill_select_atb
@atb_meters.visible = true if Meters
update_meters unless Wait_Mode == 2
end
#--------------------------------------------------------------------------
alias acbs_start_item_select_atb start_item_select
def start_item_select
acbs_start_item_select_atb
@atb_meters.visible = false if Meters and Meter_Pos_Style < 3 and HIDE_WINDOW
update_meters unless Wait_Mode == 2
end
#--------------------------------------------------------------------------
alias acbs_end_item_select_atb end_item_select
def end_item_select
acbs_end_item_select_atb
@atb_meters.visible = true if Meters
update_meters unless Wait_Mode == 2
end
#--------------------------------------------------------------------------
def phase3_next_actor
@input_battler.blink = false
action_battler = @input_battlers.shift
@action_battlers << action_battler
command_input_cancel
@input_battler = nil
@actor_index = nil
@active_battler = nil
end
#--------------------------------------------------------------------------
def phase3_prior_actor
@input_battler.current_action.kind = 0
@input_battler.current_action.basic = 3
@input_battler.blink = false
action_battler = @input_battlers.shift
@action_battlers << action_battler
@input_battler = nil
@actor_index = nil
@active_battler = nil
windows_dispose
end
#--------------------------------------------------------------------------
alias acbs_update_phase3_atb update_phase3
def update_phase3
if cancel_command?
if can_act?
if [2, 3].include?(@input_battler.restriction)
@input_battler.current_action.kind = 0
@input_battler.current_action.basic = 0
end
@action_battlers << @input_battler
end
command_input_cancel
return
end
acbs_update_phase3_atb
end
#--------------------------------------------------------------------------
def cancel_command?
return false if @input_battler.nil?
return true if @input_battler.current_action.forcing
return true if [2, 3, 4].include?(@input_battler.restriction)
return true if not $game_party.actors.include?(@input_battler)
return false
end
#--------------------------------------------------------------------------
def can_act?
return true if @input_battler.current_action.forcing
return true if [2, 3].include?(@input_battler.restriction)
return false
end
#--------------------------------------------------------------------------
alias acbs_update_phase3_basic_command_atb update_phase3_basic_command
def update_phase3_basic_command
if Input.trigger?(Input::C)
case @actor_command_window.commands[@actor_command_window.index]
when @escape_name
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
return
end
end
if Input.trigger?(Input::UP) and @input_action
$game_system.se_play($data_system.cursor_se)
@actor_command_window.index -= 1
if @actor_command_window.index <= -1
@actor_command_window.index = @actor_command_window.commands_size - 1
end
return
end
if Input.trigger?(Input::DOWN) and @input_action
$game_system.se_play($data_system.cursor_se)
@actor_command_window.index += 1
if @actor_command_window.index >= @actor_command_window.commands_size - 1
@actor_command_window.index = 0
end
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.decision_se)
phase3_next_actor
return
end
if Input.trigger?(Input::A)
$game_system.se_play($data_system.decision_se)
@input_battler.passed = true
phase3_next_actor
return
end
acbs_update_phase3_basic_command_atb
end
#--------------------------------------------------------------------------
def command_input_cancel
windows_dispose
@input_battler.blink = false
@input_battlers.delete(@input_battler)
@input_battler = nil
end
#--------------------------------------------------------------------------
def windows_dispose
@help_window.visible = false if !@escaping
if @enemy_arrow != nil
@enemy_arrow.dispose
@enemy_arrow = nil
end
if @actor_arrow != nil
@actor_arrow.dispose
@actor_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 @item_window != nil
@item_window.dispose
@item_window = nil
end
if @enemy_arrow_all != nil
@enemy_arrow_all.dispose_multi_arrow
@enemy_arrow_all = nil
end
if @actor_arrow_all != nil
@actor_arrow_all.dispose_multi_arrow
@actor_arrow_all = nil
end
if @battler_arrow_all != nil
@battler_arrow_all.dispose_multi_arrow
@battler_arrow_all = nil
end
if @actor_command_window != nil
@actor_command_window.active = false
@actor_command_window.visible = false
@active_battler_window.visible = false
@actor_command_window.opacity = 0
end
@status_window.visible = true
end
#--------------------------------------------------------------------------
alias acbs_update_phase4_step1_atb update_phase4_step1
def update_phase4_step1
if @action_battlers.size == 0
@input_battlers.clear
@action_battlers.clear
@action_battler.atb = 0
@action_battler = nil
end
acbs_update_phase4_step1_atb
end
#--------------------------------------------------------------------------
alias acbs_update_phase4_step2_atb update_phase4_step2
def update_phase4_step2
@active_battler.defense_pose = false
if @active_battler.cast_action != nil
active_cast = @active_battler.cast_action
if active_cast.scope == 1 or active_cast.scope == 3 or active_cast.scope == 5
@active_battler.current_action.target_index = @active_battler.cast_target
end
if active_cast.is_a?(RPG::Skill)
@active_battler.current_action.kind = 1
@active_battler.current_action.skill_id = @active_battler.cast_action.id
elsif active_cast.is_a?(RPG::Item)
@active_battler.current_action.kind = 2
@active_battler.current_action.item_id = @active_battler.cast_action.id
end
end
for state in @active_battler.battler_states
@active_battler.remove_state(state.id) if state.extension.include?("ZEROTURNLIFT")
end
acbs_update_phase4_step2_atb
end
#--------------------------------------------------------------------------
alias make_skill_action_result_atb_n01 make_skill_action_result
def make_skill_action_result
skill = $data_skills[@action_battler.current_action.skill_id]
if @action_battler.cast_action == nil
@active_battler.cast_action = skill
@active_battler.cast_target = @active_battler.current_action.target_index
@cast_speed = skill.cast_speed(@active_battler)
@active_battler.cast_action = nil if @cast_speed == 0
@spriteset.set_stand_by_action(@active_battler.actor?, @active_battler.index)
return unless @cast_speed == 0
end
make_skill_action_result_atb_n01
@active_battler.cast_action = nil
end
#--------------------------------------------------------------------------
alias make_item_action_result_atb_n01 make_item_action_result
def make_item_action_result
item = $data_items[@action_battler.current_action.item_id]
if @action_battler.cast_action == nil
@active_battler.cast_action = item
@active_battler.cast_target = @active_battler.current_action.target_index
@cast_speed = item.cast_speed(@active_battler)
@active_battler.cast_action = nil if @cast_speed == 0
@spriteset.set_stand_by_action(@active_battler.actor?, @active_battler.index)
return unless @cast_speed == 0
end
make_item_action_result_atb_n01
@active_battler.cast_action = nil
end
#--------------------------------------------------------------------------
alias acbs_action_end_atb action_end
def action_end
acbs_action_end_atb
@active_battler.cast_action = nil
end
#--------------------------------------------------------------------------
def start_phase4
@phase4_step = 1
@action_phase = true
end
#--------------------------------------------------------------------------
alias acbs_update_phase4_step6_atb update_phase4_step6
def update_phase4_step6
acbs_update_phase4_step6_atb
@atb_turn_count += 1 unless Custom_Turn_Count == 2
@active_battler.atb = 0 unless @active_battler.passed
@active_battler.passed = false
@input_battlers.delete(@active_battler)
@action_battlers.delete(@active_battler)
@action_battler = nil
@action_phase = false
update_meters
judge
end
end
yes it does here is the chunk that deals with the basic attacks
#--------------------------------------------------------------------------
alias acbs_update_phase3_basic_command_atb update_phase3_basic_command
def update_phase3_basic_command
if Input.trigger?(Input::C)
case @actor_command_window.commands[@actor_command_window.index]
when @escape_name
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
return
end
end
if Input.trigger?(Input::UP) and @input_action
$game_system.se_play($data_system.cursor_se)
@actor_command_window.index -= 1
if @actor_command_window.index <= -1
@actor_command_window.index = @actor_command_window.commands_size - 1
end
return
end
if Input.trigger?(Input::DOWN) and @input_action
$game_system.se_play($data_system.cursor_se)
@actor_command_window.index += 1
if @actor_command_window.index >= @actor_command_window.commands_size - 1
@actor_command_window.index = 0
end
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.decision_se)
phase3_next_actor
return
end
if Input.trigger?(Input::A)
$game_system.se_play($data_system.decision_se)
@input_battler.passed = true
phase3_next_actor
return
end
acbs_update_phase3_basic_command_atb
end
the above code is aliased so it also includes this original method.
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : basic command)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Go to command input for previous actor
phase3_prior_actor
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by actor command window cursor position
case @actor_command_window.index
when 0 # attack
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# Start enemy selection
start_enemy_select
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 1
# Start skill selection
start_skill_select
when 2 # guard
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# Go to command input for next actor
phase3_next_actor
when 3 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 2
# Start item selection
start_item_select
end
return
end
end
the basic action carry through is this "make_basic_action_result" its not changed from the default, so im thinking it has something to do with where its called and how its carried through.
so either something with the above code or this one..
alias acbs_update_phase4_step2_atb update_phase4_step2
def update_phase4_step2
@active_battler.defense_pose = false
if @active_battler.cast_action != nil
active_cast = @active_battler.cast_action
if active_cast.scope == 1 or active_cast.scope == 3 or active_cast.scope == 5
@active_battler.current_action.target_index = @active_battler.cast_target
end
if active_cast.is_a?(RPG::Skill)
@active_battler.current_action.kind = 1
@active_battler.current_action.skill_id = @active_battler.cast_action.id
elsif active_cast.is_a?(RPG::Item)
@active_battler.current_action.kind = 2
@active_battler.current_action.item_id = @active_battler.cast_action.id
end
end
for state in @active_battler.battler_states
@active_battler.remove_state(state.id) if state.extension.include?("ZEROTURNLIFT")
end
acbs_update_phase4_step2_atb
end
but it could have nothing to do with those, it could be something that is suppose to tell it that the battle phase is over and to bring up the actor selection and start the battle phases all over again. but your saying that this happens after the attack went through? (did the attack show or no?)
Whoa, thanks for pointing those sections out. I'm still learning how to read these things accurately.
The attack is never actually carried through, I'm trying to reproduce the freeze right now and will update this if anything different occurs.
another usfull trick when scripting for me is to print an action..
print ("")
with this you can put it along the steps and print out when it reaches them, (like "entering battle phase 1" and such)
you can also make it show the values of variables like so..
print("value is #{@variable}.")
this will show the value of the @variable. this seems to be a great debugging tool for me, how ever its put in a spot that continually updates, or loops it will make it near impossible to continue the game or close the program with out opening command prompt, so just watch where you stick it.
Alright, quick update. I've had some people do some play testing. It has now happened in different scenarios. First, it happened in the beginning battle again, but this time with two players left alive. It happened immediately after using the "attack" option. The attack never carried through, the game just freezes but the characters continue their animation.
Second, it happened in a later spot in the game, in a regular battle in a forest area. There was one player left alive and it was directly after the "attack" command had been issued.
So it is absolutely something to do with the attack command.
like i said its a matter of just chasing it down through the list.
to get a better idea of how the battle works take a look at the defalut scripts, ignore the plug in one that you have the problems with, see how each phase works and what parts they play. see how the attack command is transferd around then go back to the other script and apply what you learned.
Will work on that tonight. Thanks again. I'll let you know what I find.
np, also this is a great chance to improve your scripting skills.