Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Can somebody edit this script so that it waits before showing battle results? (easy?)

I'm using this Battle Report script and really like it. However, when you win a battle, it goes STRAIGHT to the report screen. Since I'm also using the side battle script, when the heroes win, they have a victory animation. But you can't see this victory animation since it goes straight to the report screen.

So, can someone help me edit this script so that it waits a little for the victory animation to finish, and then allow the report screen to come up?

Thanks a lot!

#==============================================================================
# ** Battle Report v 1.6 by Illustrationism
# * Posted & Edited by Raziel
#==============================================================================
# A script that shows the battle result like in the Final Fantasy games.
#
# Features
# * Scrolling down Exp
#
# Edits:
# * Exp Bars filling up
# * Possible displaying of Facesets instead of Charactersets
# * Exp scrolling down faster, depending on how much exp you gain after battle.
# * Play a ME as long as you want in the result window.
#==============================================================================

class Game_Actor < Game_Battler
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1

# NEW - David
$d_new_skill = nil

for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)

# NEW - David
skill = $data_skills[j.skill_id]
$d_new_skill = skill.name

end
end
end
while @exp < @exp_list[@level]
@level -= 1
end
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end

#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end

end

class Window_LevelUp < Window_Base

#----------------------------------------------------------------
def initialize(actor, pos)
#change this to false to show the actor's graphic
@face = false
@actor = actor
y = (pos * 120)
super(280, y, 360, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
if $d_dum == false
refresh
end
end

#----------------------------------------------------------------
def dispose
super
end

#----------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 18
if @face == true
draw_actor_face(@actor, 4, 0)
else
draw_actor_graphic(@actor, 50, 80)
end
draw_actor_name(@actor, 111, 0)
draw_actor_level(@actor, 186, 0)
show_next_exp = @actor.level == 99 ? "---" : "#{@actor.next_exp}"
min_bar = @actor.level == 99 ? 1 : @actor.now_exp
max_bar = @actor.level == 99 ? 1 : @actor.next_exp
draw_slant_bar(115, 80, min_bar, max_bar, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
self.contents.draw_text(115, 24, 300, 32, "Exp:#{@actor.now_exp}")
self.contents.draw_text(115, 48, 300, 32, "Level Up:" + show_next_exp)
end


#----------------------------------------------------------------
def level_up
self.contents.font.color = system_color
self.contents.draw_text(230, 48, 80, 32, "LEVEL UP!")
end
#-----------------------------------------------------------------
def learn_skill(skill)
self.contents.font.color = normal_color
unless $d_new_skill == nil
Audio.se_play("Audio/SE/105-Heal01")
self.contents.draw_text(186, 24, 80, 32, "Learned:")
self.contents.font.color = system_color
self.contents.draw_text(261, 24, 90, 32, skill)
end
end


#----------------------------------------------------------------
def update
super
end

end # of Window_LevelUp

#=================================
#Window_EXP
# Written by: David Schooley
#=================================

class Window_EXP < Window_Base

#----------------------------------------------------------------
def initialize(exp)
super(0, 0, 280, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
refresh(exp)
end

#----------------------------------------------------------------
def dispose
super
end

#----------------------------------------------------------------
def refresh(exp)
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 150, 32, "Exp Earned:")
self.contents.font.color = normal_color
self.contents.draw_text(180, 0, 54, 32, exp.to_s, 2)
end

#----------------------------------------------------------------
def update
super
end

end # of Window_EXP

#=================================
#Window_Money_Items
# Written by: David Schooley
#=================================

class Window_Money_Items < Window_Base

#----------------------------------------------------------------
def initialize(money, treasures)
@treasures = treasures
super(0, 60, 280, 420)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 255
refresh(money)
end

#----------------------------------------------------------------
def dispose
super
end

#----------------------------------------------------------------
def refresh(money)
@money = money
self.contents.clear

self.contents.font.color = system_color
self.contents.draw_text(4, 4, 100, 32, "Items Found:")
self.contents.font.color = normal_color

y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += 32
end

cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(4, 340, 220-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(4, 300, 220-cx-2, 32, "+ " + @money.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 340, cx + 100, 32, $data_system.words.gold, 2)
end

def update
super
end

end # of Window_Money_Items


class Scene_Battle
alias raz_battle_report_main main
alias raz_battle_report_be battle_end

def main
# NEW - David
#$battle_end = false
@lvup_window = []
@show_dummies = true # Show dummy windows or not?
raz_battle_report_main
# NEW - David
@lvup_window = nil
@level_up = nil
@ch_stats = nil
@ch_compare_stats = nil
Audio.me_stop
end

def battle_end(result)
raz_battle_report_be(result)
# NEW - David
@status_window.visible = false
@spriteset.dispose
@actor_command_window.dispose

# Added for RTAB Patch version
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
# End of RTAB Patch Version

Graphics.transition
if result == 0
display_lv_up(@exp, @gold, @treasures)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
break
end
end
trash_lv_up
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]

# NEW - David
@treasures = treasures
@exp = exp
@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
@phase5_wait_count = 10
end

def update_phase5
if @phase5_wait_count > 0
@phase5_wait_count -= 1
if @phase5_wait_count == 0

# NEW - David
$game_temp.battle_main_phase = false
end
return
end

# NEW - David
battle_end(0)

end

def display_lv_up(exp, gold, treasures)

$d_dum = false
d_extra = 0
i = 0
for actor in $game_party.actors
# Fill up the Lv up windows
@lvup_window = Window_LevelUp.new($game_party.actors, i)
i += 1
end

# Make Dummies
if @show_dummies == true
$d_dum = true
for m in i..3
@lvup_window[m] = Window_LevelUp.new(m, m)
end
end

@exp_window = Window_EXP.new(exp)
@m_i_window = Window_Money_Items.new(gold, treasures)
@press_enter = nil
gainedexp = exp
@level_up = [0, 0, 0, 0]
@d_new_skill = ["", "", "", ""]
@d_breakout = false
@m_i_window.refresh(gold)
wait_for_OK

@d_remember = $game_system.bgs_memorize
Audio.bgs_play("Audio/SE/032-Switch01", 100, 300)

# NEW - David
max_exp = exp
value = 28
if exp < value
value = exp
end
if value == 0
value = 1
end
for n in 0..gainedexp - (max_exp / value)
exp -= (max_exp / value)
if @d_breakout == false
Input.update
end

for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += (max_exp / value)
# Fill up the Lv up windows
if @d_breakout == false
@lvup_window.refresh
@exp_window.refresh(exp)
end

if actor.level > last_level
@level_up = 5
Audio.se_play("Audio/SE/056-Right02.ogg", 70, 150)
if $d_new_skill
@d_new_skill = $d_new_skill
end
end

if @level_up == 0
@d_new_skill = ""
end

if @level_up > 0
@lvup_window.level_up
if @d_new_skill != ""
@lvup_window.learn_skill(@d_new_skill)
end
end

if Input.trigger?(Input::C) or exp <= 0
@d_breakout = true
end
end

if @d_breakout == false
if @level_up >0
@level_up -= 1
end
Graphics.update
end
end

if @d_breakout == true
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cant_get_exp? == false
actor.exp += exp
end
end
exp = 0
break
end
end
Audio.bgs_stop
@d_remember = $game_system.bgs_restore

for i in 0...$game_party.actors.size
@lvup_window.refresh
end
@exp_window.refresh(exp)
Audio.se_play("Audio/SE/decide2.wav", 100, 100)
$game_party.gain_gold(gold)
@m_i_window.refresh(0)
Graphics.update
end

def trash_lv_up
# NEW - David
i=0

for i in 0 ... 4
@lvup_window.visible = false
end
@exp_window.visible = false
@m_i_window.visible = false
@lvup_window = nil
@exp_window = nil
@m_i_window = nil
end

# Wait until OK key is pressed
def wait_for_OK
loop do
Input.update
Graphics.update
if Input.trigger?(Input::C)
break
end
end
end

end

class Window_Base < Window
def draw_actor_face(actor, x, y)
bitmap = RPG::Cache.picture("Faces/" + actor.character_name)
self.contents.blt(x, y, bitmap, Rect.new(0,0,96,96))
end

#--------------------------------------------------------------------------
# * Draw Slant Bar(by SephirothSpawn)
#--------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end
end
 

poccil

Sponsor

I don't believe the "battle report" script section is the problem; we need to see the code that displays the victory animation; there we can determine whether the animation ends and then display the "battle report".
 
Aw, what the heck. Here's the scripts for the Side Battler right here for convenience, just because I'm gonna go crazy if this problem persists any longer :P

# Ids of enemies using default battlers
DEFAULT_ACTOR_ID = [] # Ids of actors using default battlers
DEFAULT_COLLAPSE_ACTOR = false # If true, restores the old 'red fade'
DEFAULT_COLLAPSE_ENEMY = false # collapse effect (using spritesheets)

# * Animation Frames and Animation Speed
#--------------------------------------------------------------------------
MNK_SPEED = 4 # Framerate speed of the battlers
MNK_RUSH_SPEED = 1.5 # Melee/Skill/Item motion speed of the battlers
MNK_POSES = 11 # Maximum # of poses (stances) in the template
MNK_FRAMES = 4 # Maximum # of frames in each pose
MNK_FRAMES_STANDARD = 4 # Standard # of frames played in each pose.

# Individual Spritesheet Control Center
#--------------------------------------------------------------------------
MNK_POSES_ENEMY = {9 => 11} # ID and # of poses for each enemy
MNK_FRAMES_ENEMY = nil # ID and # of frames for each enemy
MNK_POSES_ACTOR = nil # ID and # of poses for each actor
MNK_FRAMES_ACTOR = nil # ID and # of frames for each actor.

# * Wooziness Rates
#--------------------------------------------------------------------------
MNK_LOW_HP_PERCENTAGE = 0.25 # Determines health% of battler for WOOZY pose.
MNK_LOW_HP_ACTOR = {7 => 0.50, 8 => 0.75} # Individual health% for actors.
MNK_LOW_HP_ENEMY = {1 => 0.50} # Individual health% for enemies.



#==========================================================================
# **** POSE CONTROL CENTER **** #
#==========================================================================

# Editable Template (Some people wanted to change their template design)
#--------------------------------------------------------------------------
MNK_POSE1 = 1 # Sets the 'Ready Pose' (MNK_POSE1) #1 in your template
MNK_POSE2 = 2 # Sets the 'Struck Pose' (MNK_POSE2) #2 in your template
MNK_POSE3 = 3 # Sets the 'Woozy Pose' (MNK_POSE3) #3 in your template
MNK_POSE4 = 4 # Sets the 'Block Pose' (MNK_POSE4) #4 in your template
MNK_POSE5 = 5 # Sets the 'Charge Pose' (MNK_POSE5) #5 in your template
MNK_POSE6 = 6 # Sets the 'Retreat Pose'(MNK_POSE6) #6 in your template
MNK_POSE7 = 7 # Sets the 'Attack Pose' (MNK_POSE7) #7 in your template
MNK_POSE8 = 8 # Sets the 'Item Pose' (MNK_POSE8) #8 in your template
MNK_POSE9 = 9 # Sets the 'Skill Pose' (MNK_POSE9) #9 in your template
MNK_POSE10 = 10 # Sets the 'Victory Pose'(MNK_POSE10) #10 in your template
MNK_POSE11 = 11 # Sets the 'Defeat Pose' (MNK_POSE11) #11 in your template

# Editable Template (for Custom Actor Spritesheets)
#--------------------------------------------------------------------------
MNK_APOSE1 = {2 => 1}
MNK_APOSE2 = {2 => 2} # Hilda is using a Charset graphic as a battler.
MNK_APOSE3 = {2 => 3} # The battler was copied into the Battler folder.
MNK_APOSE4 = {2 => 4} # This setup allows you to use Charactersets for
MNK_APOSE5 = {2 => 5} # battlers battlers.
MNK_APOSE6 = {2 => 6}
MNK_APOSE7 = {2 => 7}
MNK_APOSE8 = {2 => 8}
MNK_APOSE9 = {2 => 9}
MNK_APOSE10 = {2 => 10}
MNK_APOSE11 = {2 => 11}

# Editable Template (for Custom Enemy Spritesheets)
#--------------------------------------------------------------------------
MNK_EPOSE1 = {9 => 1}
MNK_EPOSE2 = {9 => 2}
MNK_EPOSE3 = {9 => 3}
MNK_EPOSE4 = {9 => 4}
MNK_EPOSE5 = {9 => 5}
MNK_EPOSE6 = {9 => 6}
MNK_EPOSE7 = {9 => 7}
MNK_EPOSE8 = {9 => 8}
MNK_EPOSE9 = {9 => 9}
MNK_EPOSE11 = {9 => 11}


#==========================================================================
# **** EXPANDED POSE CONTROL CENTER **** #
#==========================================================================

# Non-Default Poses (can expand beyond the default 11 poses here)
# (New system mimics the revised Template system. Can use 'custom' sheets)
#--------------------------------------------------------------------------
# The first value in each set indicates the index number in a spritesheet.
# This value is overrided by a value in one of the other two accompanying
# arrays... one for actor battlerss, the other for enemy battlers.
#
# To define a pose linked to a specific battler, the syntax is...
# '' hash array '' = { battler.id => pose# }
# Where Aluxes and the Ghost (RTP) would be the 1st battlers (per array),
# and the pose# would be the pose in your spritesheet.
#
# Combinations in the hash arrays are possible, so if the MNK_POSES_DYING_E
# array has {1 => 5, 9 => 2}, then the GHOST (enemy #1) would be using the
# 6th pose (index 5) and the 9th enemy battler would be using the 3rd pose.
#--------------------------------------------------------------------------
MNK_POSES_SETUP = 7 # Choose animation pose for 'preparation'
MNK_POSES_SETUP_A = {}
MNK_POSES_SETUP_E = {9 => 5}
MNK_POSES_CASTPREP = 4 # Set 'casting' pose for skill preparation
MNK_POSES_CASTPREP_A = {}
MNK_POSES_CASTPREP_E = {9 => 3}
MNK_POSES_DYING = 6 # Choose animation pose for dying throws.
MNK_POSES_DYING_a = {}
MNK_POSES_DYING_E = {9 => 5}
MNK_POSES_ESCAPE = 2 # Set 'coward' pose for fleeing monsters)
MNK_POSES_ESCAPE_A = {}
MNK_POSES_ESCAPE_E = {9 => 5}
MNK_POSES_CRITICAL = nil # Set pose for BIG hits
MNK_POSES_CRIT_A = {}
MNK_POSES_CRIT_E = {9 =>5}
MNK_POSES_WINNING = 4 # Set winning (Victory Dance before pose)
MNK_POSES_WINNING_A = {}
MNK_POSES_WINNING_E = {}

# Looping Poses
#--------------------------------------------------------------------------
# These arrays merely hold the ID of actors or enemies whose poses loop at
# the end of combat. Enemies have no 'winning' animation pose.
MNK_LOOPS_WINNING = [] # Actor IDs if their victory pose loops
MNK_LOOPS_DEFEATED_ACTOR = [] # Actor IDs if their defeat pose loops
MNK_LOOPS_DEFEATED_ENEMY = [] # Enemy IDs if their defeat pose loops

# Non-Default Pose Hashes (poses dependant on .id values)
# (New system mimics the revised Template system.)
#--------------------------------------------------------------------------
# The first hash in each set indicates the id number (be it skill, item or
# otherwise, and the pose it brings up. These mimic the 2nd array type in
# the above Non-Default poses. As such, a hash value of {1 => 10) for the
# MNK_POSES_WEAPONS hash would make the 'Bronze Sword' use the 10th index (or
# 11th spritesheet) pose... aka the 'Defeat' pose.
#
# To define an advanced pose linked to a specific battler, the syntax is...
# = { battler.id => { item/skill.id => pose# } }
# ...so this gets more complicated. But this does allow each battler to
# have his or her own unique pose, regardless of spritesheet type.
#--------------------------------------------------------------------------
MNK_POSES_CASTED = {61 => 6} # Set a specific skill to use a pose
MNK_POSES_CASTED_A = {}
MNK_POSES_CASTED_E = {}
MNK_POSES_STATUS = {3 => 3} # Set status values to poses here
MNK_POSES_STAT_A = {}
MNK_POSES_STAT_E = {}
MNK_POSES_SKILLS = {57 => 7} # Default: #57(Cross Cut) does 'Attack'
MNK_POSES_SKILLS_A = {}
MNK_POSES_SKILLS_E = {}
MNK_POSES_ITEMS = {13 => 4} # Default: #13(Sharp Stone) does 'Block'
MNK_POSES_ITEMS_A = {}
MNK_POSES_ITEMS_E = {}
MNK_POSES_WEAPONS = {} # Didn't set any weapons to any poses
MNK_POSES_WEAPS_A = {}
MNK_POSES_WEAPS_E = {} # Non-functional (Enemies don't use 'em.)



#==========================================================================
# **** FRAME CONTROL CENTER **** #
#==========================================================================

# * Frames Control
#--------------------------------------------------------------------------
MNK_FRAMES_PER_POSE = {} # Set #of frames to pose(by index)

# Advanced Individual Pose/Frame Hashes # Advanced Individual Poses uses
# hashes within hashes. As a demo
MNK_POSES_FR_ACTOR = {} # you can see that enemy #1 has 2
MNK_POSES_FR_ENEMY = {} # sets of controls: index 0 (for
# a ready pose is set to 1 frame,
# while index 3 (block) is set to 'two' frames. Likewise, for the actor's
# hash, Actor #7 (Gloria) has only 1 control hash. It sets index pose '0'
# (the ready pose again) to use four frames of animation (even though I had
# set the ready pose to just use '2' with the MNK_FRAMES_PER_POSE hash earlier.



#==========================================================================
# **** MOVEMENT CONTROL CENTER **** #
#==========================================================================

# * Forward Step System (Final Fantasy-Style)
#--------------------------------------------------------------------------
MNK_RUSH_OFFSET = 0 # How much additional space between battlers
MNK_RUSH_ATTACK = false # If true, battler steps forward to attack
MNK_RUSH_SKILL = true # If true, battler steps forward to use skill
MNK_RUSH_ITEM = true # If true, battler steps forward to use item

# * Movement Arrays (Arrays for skill/weapon/item IDs that affect movement)
#--------------------------------------------------------------------------
MNK_MOVING_ITEM = [1] # Examples are items that need to be applied.
MNK_MOVING_SKILL = [61] # Examples are martial-arts and sneak attacks
MNK_MOVE2CENTER_ATK = [] # Moves battler to center based on weapon id!
MNK_MOVE2CENTER_ITEM = [5] # Moves battler to center for a big item atk!
MNK_MOVE2CENTER_SKILL = [7] # Moves battler to center for a big skill atk!
#
# * Remember, do not supply Skill or Item ID#'s that have 'None' scopes into
# either the MNK_MOVING_ITEM or MNK_MOVING_SKILL hashes. These skills &
# item attacks have no target and would cause an error when trying to find
# an enemy to move towards.



#==========================================================================
# **** STATIONARY CONTROL CENTER **** #
#==========================================================================

# * Stationary Battlers (simple True/False settings)
#--------------------------------------------------------------------------
MNK_STATIONARY_ENEMIES = false # If the enemies don't move while attacking
MNK_STATIONARY_ACTORS = false # If the actors don't move while attacking

# * Arrays filled with skill/weapon/item IDs that halt movement
#--------------------------------------------------------------------------
MNK_STATIONARY_ENEMY_IDS = [] # Enemies that don't RUN during melee attacks
MNK_STATIONARY_WEAPONS = [17,18,19,20,21,22,23,24] # (examples are bows & guns)
MNK_STATIONARY_SKILLS = [] # (examples are bows & guns)
MNK_STATIONARY_ITEMS = [] # (examples are bows & guns)



#==========================================================================
# **** TRANSPARENCY CONTROL CENTER **** #
#==========================================================================
MNK_TRANSLUCENCY = 127 # Degree of transparency
MNK_TRANSLUCENT_ACTOR = [] # ID of actor at translucency settings
MNK_TRANSLUCENT_ENEMY = [1, 9] # ID of enemy at translucency settings
MNK_PHASING = false # If battlers fade in/out while charging
MNK_PHASING_ACTOR = [] # IDs of actors that fade in/out if charging
MNK_PHASING_ENEMY = [9] # IDs of enemies that fade in/out if charging

MNK_FADE_IN = true # Battler fades in if replaced or transparent



#==========================================================================
# **** CUSTOM FEATURE CENTER **** #
#==========================================================================

MNK_MIRROR_ENEMIES = true # Enemy battlers use reversed image
MNK_CALC_SPEED = false # System calculates a mean/average speed
MNK_AT_DELAY = true # Pauses battlesystem until animation done.

ion]

#==============================================================================
# ** Animated Battlers - Enhanced ver. 8.8 (07-31-2007)
#
#------------------------------------------------------------------------------
# * (2) Sprite System: The Sprite Battler Class
#==============================================================================

#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :battler_offset # Degree of action forcing
attr_accessor :skill_used # Degree of action forcing
attr_accessor :item_used # Degree of action forcing
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mnk_init initialize
def initialize(viewport, battler = nil)
# --Initialize poses
@frame, @pose = 0, 0
@last_time = 0
@last_move_time = 0
# --Initialize Battler placement and pose types
@battler_offset = 0
@skill_used = 0
@item_used = 0
# --Initialize Boolean values
@statusd = false
@dying = true
@s_pose = false
$victory = false
$defeat = false
@winning = true
# ORIGINAL Initialize call
mnk_init(viewport, battler)
# EVENT VALUE CALLS
# --Obtain the Sideview switch
$sv_mirror = $sideview_mirror
$sv_mirror = 0 if $sideview_mirror == nil
# -- Obtain the max party size
$max_member = $formation_max_member
$max_member = 4 if $formation_max_member == nil
# --Obtain the highest position for the formation
$formation_top = $formation_max_height
$formation_top = 220 if $formation_max_height == nil
# --Obtain the formation's width
$formation_width = $formation_max_width
$formation_width = 128 if $formation_max_width == nil
# --Obtain the height of the Battlestatus Window
$battlestat_height = $battlestatus_height
$battlestat_height = 160 if $battlestatus_height == nil
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias mnk_update update
def update
return unless @battler
if @battler.battler_name != @battler_name
@started = false
end
# Regular Update
mnk_update

# Set Translucency
if @battler.is_a?(Game_Actor) and @battler_visible
if MNK_TRANSLUCENT_ACTOR.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = MNK_TRANSLUCENCY
end
end
end
if @battler.is_a?(Game_Enemy) and @battler_visible
if MNK_TRANSLUCENT_ENEMY.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = MNK_TRANSLUCENCY
end
end
end

# Reset hash for Advanced Pose/Frames
pose_temp = {}
# Start Routine
unless @started
@pose = state
if @battler.is_a?(Game_Enemy)
if not DEFAULT_ENEMY
if DEFAULT_ENEMY_ID == nil
# Set up Spritesheet Standards
frametmp = MNK_FRAMES
if MNK_FRAMES_ENEMY != nil
if MNK_FRAMES_ENEMY.include?(@battler.id)
frametmp = MNK_FRAMES_ENEMY[@battler.id] if MNK_FRAMES_ENEMY[@battler.id] != nil
end
end
@width = @width / frametmp
posetmp = MNK_POSES
if MNK_POSES_ENEMY != nil
if MNK_POSES_ENEMY.include?(@battler.id)
posetmp = MNK_POSES_ENEMY[@battler.id] if MNK_POSES_ENEMY[@battler.id] != nil
end
end
@height = @height / posetmp
else
if not DEFAULT_ENEMY_ID.include?(@battler.id)
frametmp = MNK_FRAMES
if MNK_FRAMES_ENEMY != nil
if MNK_FRAMES_ENEMY.include?(@battler.id)
frametmp = MNK_FRAMES_ENEMY[@battler.id] if MNK_FRAMES_ENEMY[@battler.id] != nil
end
end
@width = @width / frametmp
posetmp = MNK_POSES
if MNK_POSES_ENEMY != nil
if MNK_POSES_ENEMY.include?(@battler.id)
posetmp = MNK_POSES_ENEMY[@battler.id] if MNK_POSES_ENEMY[@battler.id] != nil
end
end
@height = @height / posetmp
end
end
end
end

# Turn off Casting pose
@battler.casted = false
@battler.casting = false

if @battler.is_a?(Game_Actor)
if not DEFAULT_ACTOR
if DEFAULT_ACTOR_ID == nil
# Set up Spritesheet Standards
frametmp = MNK_FRAMES
if MNK_FRAMES_ACTOR != nil
if MNK_FRAMES_ACTOR.include?(@battler.id)
frametmp = MNK_FRAMES_ACTOR[@battler.id] if MNK_FRAMES_ACTOR[@battler.id] != nil
end
end
@width = @width / frametmp
posetmp = MNK_POSES
if MNK_POSES_ACTOR != nil
if MNK_POSES_ACTOR.include?(@battler.id)
posetmp = MNK_POSES_ACTOR[@battler.id] if MNK_POSES_ACTOR[@battler.id] != nil
end
end
@height = @height / posetmp
else
if not DEFAULT_ACTOR_ID.include?(@battler.id)
frametmp = MNK_FRAMES
if MNK_FRAMES_ACTOR != nil
if MNK_FRAMES_ACTOR.include?(@battler.id)
frametmp = MNK_FRAMES_ACTOR[@battler.id] if MNK_FRAMES_ACTOR[@battler.id] != nil
end
end
@width = @width / frametmp
posetmp = MNK_POSES
if MNK_POSES_ACTOR != nil
if MNK_POSES_ACTOR.include?(@battler.id)
posetmp = MNK_POSES_ACTOR[@battler.id] if MNK_POSES_ACTOR[@battler.id] != nil
end
end
@height = @height / posetmp
end
end
end
end

@battler_offset = @width * 0.75

@display_x = @battler.screen_x
@display_y = @battler.screen_y
@display_z = @battler.screen_z
@destination_x = @display_x
@destination_y = @display_y
@destination_z = @display_z
if MNK_FADE_IN
self.opacity = 0
end

# Make invisible if dead at battle start
if @battler.dead?
self.visible = false
end

@started = true
end

if @pose == nil
@pose = state
end

# Cut Out Frame
# Enemy Battler Routine
if @battler.is_a?(Game_Enemy)
if DEFAULT_ENEMY
self.src_rect.set(@width * 0, @height * 0, @width, @height)
else
if DEFAULT_ENEMY_ID !=nil
if DEFAULT_ENEMY_ID.include?(@battler.id)
self.src_rect.set(@width * 0, @height * 0, @width, @height)
else
if @pose != nil
if @frame != nil
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
end
end
end
else
if @pose != nil
if @frame != nil
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
end
end
end
end
end

# Actor Battler Routine
if @battler.is_a?(Game_Actor)
if DEFAULT_ACTOR
self.src_rect.set(@width * 0, @height * 0, @width, @height)
else
if DEFAULT_ACTOR_ID !=nil
if DEFAULT_ACTOR_ID.include?(@battler.id)
self.src_rect.set(@width * 0, @height * 0, @width, @height)
else
if @pose != nil
if @frame != nil
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
end
end
end
else
if @pose != nil
if @frame != nil
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
end
end
end
end
end

# Position Sprite
self.x = @display_x
self.y = @display_y
self.z = @display_z
self.ox = @width / 2
self.oy = @height

# Adjust sprite direction if facing the other way...
if $sv_mirror == 1
if @battler.is_a?(Game_Actor)
self.mirror = !!battler
else
if not MNK_MIRROR_ENEMIES
self.mirror = !!battler
end
end
else
if @battler.is_a?(Game_Enemy)
if MNK_MIRROR_ENEMIES
self.mirror = !!battler
end
end
end

# Setup Frames per Pose
poseframe = MNK_FRAMES_STANDARD
poseframe = MNK_FRAMES_PER_POSE[@pose] if MNK_FRAMES_PER_POSE.include?(@pose)
# Set Advanced Poses for Actors
if @battler.is_a?(Game_Actor)
pose_temp = MNK_POSES_FR_ACTOR[@battler.id] if MNK_POSES_FR_ACTOR.include?(@battler.id)
poseframe = pose_temp[@pose] if pose_temp.include?(@pose)
end
# Set Advanced Poses for Enemies
if @battler.is_a?(Game_Enemy)
pose_temp = MNK_POSES_FR_ENEMY[@battler.id] if MNK_POSES_FR_ENEMY.include?(@battler.id)
poseframe = pose_temp[@pose] if pose_temp.include?(@pose)
end

# Make visible if returned to life
unless @battler.dead?
self.visible = true if @state == pose_obtain(MNK_POSE1, MNK_APOSE1, MNK_EPOSE1)
@freeze = false
end

# Setup Animation
time = Graphics.frame_count / (Graphics.frame_rate / MNK_SPEED)
if @last_time < time
@frame = (@frame + 1) % poseframe
if @frame == 0
if @freeze
@frame = poseframe - 1
return
end
@pose = state
end
end
@last_time = time
# Setup Dying Animation
if @battler.dead?
if @dying == true
@pose = state
@dying = false
end
else

# Setup/Ready for Battle (Let's get ready to RUMBLE!)
if @s_pose == false
tmp_pose = pose_obtain(MNK_POSES_SETUP, MNK_POSES_SETUP_A, MNK_POSES_SETUP_E)
if tmp_pose != nil
@pose = tmp_pose
@s_pose = true
end
end

if @battler.is_a?(Game_Actor)
if $victory == true
if @winning == true
@pose = state
@winning = false
end
end
end
end

# Move It
move if moving
end

#--------------------------------------------------------------------------
# * Current State
#--------------------------------------------------------------------------
def state

@statusd = false

unless @battler.dead?
if @battler.is_a?(Game_Enemy) and MNK_TRANSLUCENT_ENEMY.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = MNK_TRANSLUCENCY
end
end
if @battler.is_a?(Game_Actor) and MNK_TRANSLUCENT_ACTOR.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = MNK_TRANSLUCENCY
end
end
end

# Damage State
if [nil,{}].include?(@battler.damage)
# Battler Fine
@state = pose_obtain(MNK_POSE1, MNK_APOSE1, MNK_EPOSE1)

# Battler Wounded
temp_percentage = MNK_LOW_HP_PERCENTAGE
if @battler.is_a?(Game_Actor)
temp_percentage = MNK_LOW_HP_ACTOR[@battler.id] if MNK_LOW_HP_ACTOR[@battler.id] != nil
end
if @battler.is_a?(Game_Enemy)
temp_percentage = MNK_LOW_HP_ENEMY[@battler.id] if MNK_LOW_HP_ENEMY[@battler.id] != nil
end
if @battler.hp < @battler.maxhp * temp_percentage
@state = pose_obtain(MNK_POSE3, MNK_APOSE3, MNK_EPOSE3)
@statusd = true
end

# Battler Status-Effect
for i in @battler.states
tmp_pose2 = pose_array_obtain(MNK_POSES_STATUS, MNK_POSES_STAT_A, MNK_POSES_STAT_E, i)
@state = tmp_pose2 if tmp_pose2 != nil
@statusd = true if tmp_pose2 != nil
end


# If Battler Dead
if @battler.dead?
# If using default battlers or default collapse
if (DEFAULT_COLLAPSE_ACTOR and @battler.is_a?(Game_Actor)) or
(DEFAULT_COLLAPSE_ENEMY and @battler.is_a?(Game_Enemy)) or
(DEFAULT_ACTOR and @battler.is_a?(Game_Actor)) or
(DEFAULT_ENEMY and @battler.is_a?(Game_Enemy)) or
(DEFAULT_ENEMY_ID.include?(@battler.id) and @battler.is_a?(Game_Enemy)) or
(DEFAULT_ACTOR_ID.include?(@battler.id) and @battler.is_a?(Game_Actor))
# Do absolutely nothing :)
else

# Dying Animation pose
if @dying == true
tmp_pose = pose_obtain(MNK_POSES_DYING, MNK_POSES_DYING_a, MNK_POSES_DYING_E)
if tmp_pose != nil
@state = tmp_pose
else
@state = pose_obtain(MNK_POSE11, MNK_APOSE11, MNK_EPOSE11)
if @battler.is_a?(Game_Actor)
@freeze = true if not MNK_LOOPS_DEFEATED_ACTOR.include?(@battler.id)
else
@freeze = true if not MNK_LOOPS_DEFEATED_ENEMY.include?(@battler.id)
end
end
else
@state = pose_obtain(MNK_POSE11, MNK_APOSE11, MNK_EPOSE11)
if @battler.is_a?(Game_Actor)
@freeze = true if not MNK_LOOPS_DEFEATED_ACTOR.include?(@battler.id)
else
@freeze = true if not MNK_LOOPS_DEFEATED_ENEMY.include?(@battler.id)
end
end

# Fix Opacity
if @battler.is_a?(Game_Enemy)
if MNK_TRANSLUCENT_ENEMY.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = MNK_TRANSLUCENCY
end
else
if @battler.hidden
self.opacity = 0
else
self.opacity = 255
end
end
else
if MNK_TRANSLUCENT_ACTOR.include?(@battler.id)
if @battler.hidden
self.opacity = 0
else
self.opacity = MNK_TRANSLUCENCY
end
else
if @battler.hidden
self.opacity = 0
else
self.opacity = 255
end
end
end
end
end
end

# Casting State
if @battler.casted
if $game_system.mnk_det_para_spell
if @battler.spelling?
tmp_pose = pose_obtain(MNK_POSES_CASTPREP, MNK_POSES_CASTPREP_A, MNK_POSES_CASTPREP_E)
tmp_pose2 = pose_array_obtain(MNK_POSES_CASTED, MNK_POSES_CASTED_A, MNK_POSES_CASTED_E, @battler.skill_casted)
tmp_pose = tmp_pose2 if tmp_pose2 != nil
@state = tmp_pose if tmp_pose != nil
end
else
if $game_system.mnk_det_sd_casting
if @battler.sd_casting
tmp_pose = pose_obtain(MNK_POSES_CASTPREP, MNK_POSES_CASTPREP_A, MNK_POSES_CASTPREP_E)
tmp_pose2 = pose_array_obtain(MNK_POSES_CASTED, MNK_POSES_CASTED_A, MNK_POSES_CASTED_E, @battler.skill_casted)
tmp_pose = tmp_pose2 if tmp_pose2 != nil
@state = tmp_pose if tmp_pose != nil
end
end
if @battler.rtp != 0
tmp_pose = pose_obtain(MNK_POSES_CASTPREP, MNK_POSES_CASTPREP_A, MNK_POSES_CASTPREP_E)
tmp_pose2 = pose_array_obtain(MNK_POSES_CASTED,MNK_POSES_CASTED_A,MNK_POSES_CASTED_E,@battler.skill_casted)
tmp_pose = tmp_pose2 if tmp_pose2 != nil
@state = tmp_pose if tmp_pose != nil
end
end
end

# Victory State
if @battler.is_a?(Game_Actor)
if $victory
if not @battler.dead?
if @winning == true
if MNK_POSES_WINNING != nil
tmp_pose = pose_obtain(MNK_POSES_WINNING, MNK_POSES_WINNING_A, MNK_POSES_WINNING_E)
@state = tmp_pose if tmp_pose != nil
end
else
tmp_pose = MNK_POSE10-1
tmp_pose = MNK_APOSE10[@battler.id]-1 if MNK_APOSE10[@battler.id] != nil
@state = tmp_pose
if not MNK_LOOPS_WINNING.include?(@battler.id)
@freeze = true
end
end
else
if not @battler.dead?
tmp_pose = MNK_POSE10-1
tmp_pose = MNK_APOSE10[@battler.id]-1 if MNK_APOSE10[@battler.id] != nil
@state = tmp_pose
if not MNK_LOOPS_WINNING.include?(@battler.id)
@freeze = true
end
end
end
end
# Perform check for Enemies
else

if $defeat
if not @battler.dead?
if @winning == true
if MNK_POSES_WINNING != nil
tmp_pose = pose_obtain(MNK_POSES_WINNING, MNK_POSES_WINNING_A, MNK_POSES_WINNING_E)
@state = tmp_pose if tmp_pose != nil
end
else
tmp_pose = MNK_POSE10-1
tmp_pose = MNK_APOSE10[@battler.id]-1 if MNK_APOSE10[@battler.id] != nil
@state = tmp_pose
if not MNK_LOOPS_WINNING.include?(@battler.id)
@freeze = true
end
end
else
if not @battler.dead?
tmp_pose = MNK_POSE10-1
tmp_pose = MNK_APOSE10[@battler.id]-1 if MNK_APOSE10[@battler.id] != nil
@state = tmp_pose
if not MNK_LOOPS_WINNING.include?(@battler.id)
@freeze = true
end
end
end
end
end

# Guarding State (not if dead OR in victory)
if not @battler.dead?
if not $victory
if @statusd == false
@state = pose_obtain(MNK_POSE4, MNK_APOSE4, MNK_EPOSE4) if @battler.guarding?
end
end
end
# Moving State
if moving
# Adjust sprite direction if facing the other way...
if $sv_mirror == 1
# If enemy battler moving
if @battler.is_a?(Game_Enemy)
# Battler Moving Left
@state = pose_obtain(MNK_POSE5, MNK_APOSE5, MNK_EPOSE5) if moving.eql?(0)
# Battler Moving Right
@state = pose_obtain(MNK_POSE6, MNK_APOSE6, MNK_EPOSE6) if moving.eql?(1)
# Else actor battler moving
else
# Battler Moving Left
@state = pose_obtain(MNK_POSE6, MNK_APOSE6, MNK_EPOSE6) if moving.eql?(0)
# Battler Moving Right
@state = pose_obtain(MNK_POSE5, MNK_APOSE5, MNK_EPOSE5) if moving.eql?(1)
end
else
# If enemy battler moving
if @battler.is_a?(Game_Enemy)
# Battler Moving Left
@state = pose_obtain(MNK_POSE6, MNK_APOSE6, MNK_EPOSE6) if moving.eql?(0)
# Battler Moving Right
@state = pose_obtain(MNK_POSE5, MNK_APOSE5, MNK_EPOSE5) if moving.eql?(1)
# Else actor battler moving
else
# Battler Moving Left
@state = pose_obtain(MNK_POSE5, MNK_APOSE5, MNK_EPOSE5) if moving.eql?(0)
# Battler Moving Right
@state = pose_obtain(MNK_POSE6, MNK_APOSE6, MNK_EPOSE6) if moving.eql?(1)
end
end
end
# Return State
return @state
end

#--------------------------------------------------------------------------
# * Move
#--------------------------------------------------------------------------
def move
time = Graphics.frame_count / (Graphics.frame_rate.to_f / (MNK_SPEED * 5))

if @last_move_time < time
# Pause for Animation
return if @pose != state

opa = 255
if @battler.is_a?(Game_Enemy) and MNK_TRANSLUCENT_ENEMY.include?(@battler.id)
opa = MNK_TRANSLUCENCY
end
if @battler.is_a?(Game_Actor) and MNK_TRANSLUCENT_ACTOR.include?(@battler.id)
opa = MNK_TRANSLUCENCY
end

# Phasing
if MNK_PHASING
d1 = (@display_x - @original_x).abs
d2 = (@display_y - @original_y).abs
d3 = (@display_x - @destination_x).abs
d4 = (@display_y - @destination_y).abs
self.opacity = [opa - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max

end
# Phasing per Actor/Enemy
if @battler.is_a?(Game_Actor)
if MNK_PHASING_ACTOR.include?(@battler.id)
d1 = (@display_x - @original_x).abs
d2 = (@display_y - @original_y).abs
d3 = (@display_x - @destination_x).abs
d4 = (@display_y - @destination_y).abs
self.opacity = [opa - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
end
else
if MNK_PHASING_ENEMY.include?(@battler.id)
d1 = (@display_x - @original_x).abs
d2 = (@display_y - @original_y).abs
d3 = (@display_x - @destination_x).abs
d4 = (@display_y - @destination_y).abs
self.opacity = [opa - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
end
end

# Calculate Difference
difference_x = (@display_x - @destination_x).abs
difference_y = (@display_y - @destination_y).abs
difference_z = (@display_z - @destination_z).abs
# Done? Reset, Stop
if [difference_x, difference_y].max.between?(0, 8)
@display_x = @destination_x
@display_y = @destination_y
@display_z = @destination_z
@pose = state
return
end

# Calculate Movement Increments
increment_x = increment_y = 1
if difference_x < difference_y
increment_x = 1.0 / (difference_y.to_f / difference_x)
elsif difference_y < difference_x
increment_y = 1.0 / (difference_x.to_f / difference_y)
end
increment_z = increment_y

# Calculate Movement Speed
if MNK_CALC_SPEED
total = 0; $game_party.actors.each{ |actor| total += actor.agi }
speed = @battler.agi.to_f / (total / $game_party.actors.size)
increment_x *= speed
increment_y *= speed
increment_z *= speed
end

# Multiply and Move
multiplier_x = MNK_RUSH_SPEED * (@destination_x - @display_x > 0 ? 8 : -8)
multiplier_y = MNK_RUSH_SPEED * (@destination_y - @display_y > 0 ? 8 : -8)
multiplier_z = MNK_RUSH_SPEED * (@destination_z - @display_z > 0 ? 8 : -8)
@display_x += (increment_x * multiplier_x).to_i
@display_y += (increment_y * multiplier_y).to_i
@display_z += (increment_z * multiplier_z).to_i

end
@last_move_time = time
end

#--------------------------------------------------------------------------
# * Set Movement
#--------------------------------------------------------------------------
def setmove(destination_x, destination_y, destination_z)
unless (@battler.is_a?(Game_Enemy) and MNK_STATIONARY_ENEMIES) or
(@battler.is_a?(Game_Actor) and MNK_STATIONARY_ACTORS)
unless MNK_STATIONARY_WEAPONS.include?(@battler.weapon_id) or
MNK_STATIONARY_SKILLS.include?(@skill_used) or
MNK_STATIONARY_ITEMS.include?(@item_used)
@original_x = @display_x
@original_y = @display_y
@original_z = @display_z
@destination_x = destination_x
@destination_y = destination_y
@destination_z = destination_z
end
end
end

#--------------------------------------------------------------------------
# * Movement Check
#--------------------------------------------------------------------------
def moving
if (@display_x != @destination_x and @display_y != @destination_y and !@battler.dead?)
return (@display_x > @destination_x ? 0 : 1)
end
end

#--------------------------------------------------------------------------
# * Set Pose
#--------------------------------------------------------------------------
def pose=(pose)
@pose = pose
@frame = 0
end

#--------------------------------------------------------------------------
# * Freeze
#--------------------------------------------------------------------------
def freeze
@freeze = true
end

#--------------------------------------------------------------------------
# * Fallen Pose
#--------------------------------------------------------------------------
if @derv_anim_bat_stack.nil?
@derv_anim_bat_stack = true
alias mnk_collapse collapse
def collapse
if DEFAULT_COLLAPSE_ENEMY
mnk_collapse if @battler.is_a?(Game_Enemy)
end
if DEFAULT_COLLAPSE_ACTOR
mnk_collapse if @battler.is_a?(Game_Actor)
end
if DEFAULT_ENEMY
mnk_collapse if @battler.is_a?(Game_Enemy)
end
if DEFAULT_ACTOR
mnk_collapse if @battler.is_a?(Game_Actor)
end
if DEFAULT_ENEMY_ID != nil
if DEFAULT_ENEMY_ID.include?(@battler.id)
mnk_collapse if @battler.is_a?(Game_Enemy)
end
end
if $defend_actor.id != nil
if DEFAULT_ACTOR_ID.include?(@battler.id)
mnk_collapse if @battler.is_a?(Game_Actor)
end
end
end
end

#--------------------------------------------------------------------------
# * Obtain Pose
# pose_base : default pose to return
# pose_actor : list of poses for actors
# pose_enemy : list of poses for enemies
#--------------------------------------------------------------------------
def pose_obtain(pose_base, pose_actor, pose_enemy)
# create Arrays
pos_a = {}
pos_e = {}
# fill created Arrays & Set pose
pos_a = pose_actor
pos_e = pose_enemy
pose_now = pose_base
# Obtain pose if not a standard pose
if @battler.is_a?(Game_Actor)
pose_now = pos_a[@battler.id] if pos_a[@battler.id] != nil
else
pose_now = pos_e[@battler.id] if pos_e[@battler.id] != nil
end
# Return the final pose (minus 1 for neceties)
pose_now -= 1 if pose_now != nil
return pose_now
end

#--------------------------------------------------------------------------
# * Obtain Pose from hashes
# hash_base : hash with default poses
# hash_actor : advanced list of poses for actors
# hash_enemy : advanced list of poses for enemies
# condition : value determining where to get the final pose
#--------------------------------------------------------------------------
def pose_array_obtain(hash_base, hash_actor, hash_enemy, condition)
# create Arrays
hash_b = {}
hash_a = {}
hash_e = {}
pose_temp = {}
# fill created Arrays & Set pose
hash_b = hash_base
hash_a = hash_actor
hash_e = hash_enemy
# Setup the temp Array
if @battler.is_a?(Game_Actor)
pose_temp = hash_a[@battler.id] if hash_a.include?(@battler.id)
else
pose_temp = hash_e[@battler.id] if hash_e.include?(@battler.id)
end
# Obtain the base pose based on condition (or nil)
pose_now = hash_b[condition] if hash_b.include?(condition)
# Obtain the optional actor/enemy pose based on condition (unless nil)
pose_now = pose_temp[condition] if pose_temp.include?(condition)
# Return the final pose (minus 1 for neceties)
pose_now -= 1 if pose_now != nil
return pose_now
end
end

#==============================================================================
# ** Animated Battlers - Enhanced ver. 8.8 (07-31-2007)
#
#------------------------------------------------------------------------------
# * (3) Battle System: The Scene Battle class
#==============================================================================

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias mnkmain main
def main
# Obtain the formation style
# Only once per battle start
$formation = $formation_style
$formation = 0 if $formation_style == nil
# if Formation is random
if $formation == 8 then
$formation = rand(8).to_i
end
mnkmain
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 1 : action preparation)
#--------------------------------------------------------------------------
alias mkf_up4s1 update_phase4_step1
def update_phase4_step1(battler = @active_battler)
if $game_system.mnk_det_rtab_systm == true
mkf_up4s1(battler)
else
mkf_up4s1
end
if $game_system.mnk_det_sd_casting == true
if battler != nil
if battler.sd_casting
battler.casted = true
end
end
end
end

#--------------------------------------------------------------------------
# * End Skill Selection
#--------------------------------------------------------------------------
alias mkf_endss end_skill_select
def end_skill_select
mkf_endss
if $game_system.mnk_det_rtab_systm
@active_actor.skill_casted = @skill.id
else
@active_battler.skill_casted = @skill.id
end
end

#--------------------------------------------------------------------------
# * Make Skill Action Results (alias used to determine skill used)
#--------------------------------------------------------------------------
alias make_skill_action_result_anim make_skill_action_result
def make_skill_action_result(battler = @active_battler, plus_id = 0)
@rtab = !@target_battlers
if $game_system.mnk_det_rtab_attck
make_skill_action_result_anim(battler, plus_id)
else
@rtab ? make_skill_action_result_anim(battler) : make_skill_action_result_anim
end
@skill_used = @skill.id
if $game_system.mnk_det_para_spell == true
if battler.spelling?
battler.casted = true
end
end
end

#--------------------------------------------------------------------------
# * Make Item Action Results (alias used to determine item used)
#--------------------------------------------------------------------------
alias make_item_action_result_anim make_item_action_result
def make_item_action_result(battler = @active_battler)
@rtab = !@target_battlers
@rtab ? make_item_action_result_anim(battler) : make_item_action_result_anim
@item_used = @item.id
@item_usage = @item.scope
end

#--------------------------------------------------------------------------
# * Frame Update (main phase step 1 : action preparation) (Casting Routine)
#--------------------------------------------------------------------------
alias update_phase4_step1_anim update_phase4_step1
def update_phase4_step1(battler = @active_battler)
@rtab = !@target_battlers
if $game_system.mnk_det_rtab_systm == true
update_phase4_step1_anim(battler)
if battler.current_action.kind == 1 and
(not battler.current_action.forcing or @force != 2)
if battler.rtp != 0
battler.casted = true
end
end
else
update_phase4_step1_anim
end
end

#--------------------------------------------------------------------------
# * Action Animation, Movement
#--------------------------------------------------------------------------
alias mnk_update_phase4_step3 update_phase4_step3
def update_phase4_step3(battler = @active_battler)
@rtab = !@target_battlers
target = (@rtab ? battler.target : @target_battlers)[0]
# Battle Delay System
if MNK_AT_DELAY
# Fomar's Action Cost Detection
if $game_system.mnk_det_acb_detect
for actor in $game_party.actors
actor.vitality= 0
end
for enemy in $game_troop.enemies
enemy.vitality= 0
end
end
# Trickster's AT Detection
if $game_system.mnk_det_abs_detect
for actor in $game_party.actors
actor.at_multiplier= 0
end
for enemy in $game_troop.enemies
enemy.at_multiplier= 0
end
end
# Cogwheel RTAB Detection
if $game_system.mnk_det_rtab_systm
@rtab_wait_flag = true
end
end

# If enemy is a default battler
if battler.is_a?(Game_Enemy)
if DEFAULT_ENEMY
if @rtab then battler.white_flash = true end
if @rtab then battler.wait = 10 end
end
if DEFAULT_ENEMY_ID != nil
if DEFAULT_ENEMY_ID.include?(battler.id)
if @rtab then battler.white_flash = true end
if @rtab then battler.wait = 10 end
end
end
end
# If actor is a default battler
if battler.is_a?(Game_Actor)
if DEFAULT_ACTOR
if @rtab then battler.white_flash = true end
if @rtab then battler.wait = 10 end
end
if DEFAULT_ACTOR_ID != nil
if DEFAULT_ACTOR_ID.include?(battler.id)
if @rtab then battler.white_flash = true end
if @rtab then battler.wait = 10 end
end
end
end
# Reset the 'Do Nothing' flag
dn_flag = false
# Set values and poses based on Action
case battler.current_action.kind
when 0 # Attack
# if Do Nothing, just return
if battler.current_action.basic == 3
dn_flag = true
end
if dn_flag != true
rush_type = MNK_RUSH_ATTACK
full_moving = true ; if rush_type; full_moving = false; end
if MNK_MOVE2CENTER_ATK.include?(battler.weapon_id); center_move=true ; end
if MNK_STATIONARY_ENEMY_IDS.include?(battler.id) and battler.is_a?(Game_Enemy)
full_moving = false
center_move = false
rush_type = false
end

base_pose = pose_obtain(battler, MNK_POSE7, MNK_APOSE7, MNK_EPOSE7)
base_pose2 = pose_array_obtain(battler, MNK_POSES_WEAPONS, MNK_POSES_WEAPS_A, MNK_POSES_WEAPS_E, battler.weapon_id)
base_pose = base_pose2 if base_pose2 != nil

if battler.current_action.basic == 2
# If escaping, disable all movement
full_moving = false
center_move = false
rush_type = false
# Set the graphics
temp_pose = pose_obtain(battler, MNK_POSES_ESCAPE, MNK_POSES_ESCAPE_A, MNK_POSES_ESCAPE_E)
base_pose = temp_pose if temp_pose != nil
end
end
when 1 # Skill
rush_type = MNK_RUSH_SKILL
if MNK_MOVING_SKILL.include?(@skill_used) ; full_moving = true ; end
if MNK_MOVE2CENTER_SKILL.include?(@skill_used) ; center_move = true ; end
base_pose = pose_obtain(battler, MNK_POSE9, MNK_APOSE9, MNK_EPOSE9)
base_pose2 = pose_array_obtain(battler, MNK_POSES_SKILLS, MNK_POSES_SKILLS_A, MNK_POSES_SKILLS_E, @skill_used)
base_pose = base_pose2 if base_pose2 != nil
when 2 # Item
rush_type = MNK_RUSH_ITEM
if MNK_MOVING_ITEM.include?(@item_used) or @item_scope == 1..2 ; full_moving = true ; end
if MNK_MOVE2CENTER_ITEM.include?(@item_used); center_move = true; end
base_pose = pose_obtain(battler, MNK_POSE8, MNK_APOSE8, MNK_EPOSE8)
base_pose2 = pose_array_obtain(battler, MNK_POSES_ITEMS, MNK_POSES_ITEMS_A, MNK_POSES_ITEMS_E, @item_used)
base_pose = base_pose2 if base_pose2 != nil
end

# Only perform action if 'Do Nothing' flag is off, ie... doing something...
if dn_flag != true
# Control Movement and use current pose
@moved = {} unless @moved
return if @spriteset.battler(battler).moving
if not (@moved[battler] or battler.guarding?)
offset = offset_value(battler)
if rush_type # Steps forward
@spriteset.battler(battler).setmove(battler.screen_x - offset, battler.screen_y + 1, battler.screen_z)
end
if full_moving # Runs to target
@spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y - 1, target.screen_z + 10)
end
if center_move # Runs to center
@spriteset.battler(battler).setmove(320+(offset/4), battler.screen_y-1, battler.screen_z)
end
@moved[battler] = true
return
@spriteset.battler(battler).pose = base_pose
elsif not battler.guarding?
@spriteset.battler(battler).pose = base_pose
@spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y, battler.screen_z)
end

# Finish Up Skill and Item Use
case battler.current_action.kind
when 1
# Flag system that skill was used
battler.casted = false
battler.casting = false
@spriteset.battler(battler).skill_used = 0
when 2
# Flag system that item was used
@spriteset.battler(battler).item_used = 0
end

# Battle_Charge value for BattleCry script
$battle_charge = true
end

# Battle Delay System
if MNK_AT_DELAY
# Fomar's Action Cost Detection
if $game_system.mnk_det_acb_detect
for actor in $game_party.actors
actor.vitality= 1
end
for enemy in $game_troop.enemies
enemy.vitality= 1
end
end
# Trickster's AT Detection
if $game_system.mnk_det_abs_detect
for actor in $game_party.actors
actor.at_multiplier= 1.0
end
for enemy in $game_troop.enemies
enemy.at_multiplier= 1.0
end
end
# Cogwheel RTAB Detection
if $game_system.mnk_det_rtab_systm
@rtab_wait_flag = false
end
end

# Done
@moved[battler] = false
@rtab ? mnk_update_phase4_step3(battler) : mnk_update_phase4_step3
end
#--------------------------------------------------------------------------
# * Offset Calculation
#--------------------------------------------------------------------------
def offset_value(battler = @active_battler)
offst = @spriteset.battler(battler).battler_offset
offst += MNK_RUSH_OFFSET
if $sv_mirror == 1
offset = (battler.is_a?(Game_Actor) ? -(offst) : offst)
else
offset = (battler.is_a?(Game_Actor) ? offst : -(offst))
end
return offset
end
#--------------------------------------------------------------------------
# * Hit Animation
#--------------------------------------------------------------------------
alias mnk_update_phase4_step4 update_phase4_step4
def update_phase4_step4(battler = @active_battler)
for target in (@rtab ? battler.target : @target_battlers)
damage = (@rtab ? target.damage[battler] : target.damage)
critical = (@rtab ? target.critical[battler] : target.critical)
if damage.is_a?(Numeric) and damage > 0
base_pose = pose_obtain(target, MNK_POSE2, MNK_APOSE2, MNK_EPOSE2)
@spriteset.battler(target).pose = base_pose
if critical == true
temp_pose = pose_obtain(target, MNK_POSES_CRITICAL, MNK_POSES_CRIT_A, MNK_POSES_CRIT_E)
@spriteset.battler(target).pose = temp_pose if temp_pose != nil
end
end
end
@rtab ? mnk_update_phase4_step4(battler) : mnk_update_phase4_step4
end
#--------------------------------------------------------------------------
# * Victory Animation
#--------------------------------------------------------------------------
alias mnk_start_phase5 start_phase5
def start_phase5
for actor in $game_party.actors
return if @spriteset.battler(actor).moving
end
# See if an actor remains alive
for actor in $game_party.actors
unless actor.dead?
$victory = true
end
end
# See if an enemy remains alive
for enemy in $game_troop.enemies.reverse
unless enemy.dead?
$defeat = true
end
end

mnk_start_phase5
end
#--------------------------------------------------------------------------
# * Change Arrow Viewport
#--------------------------------------------------------------------------
alias mnk_start_enemy_select start_enemy_select
def start_enemy_select
mnk_start_enemy_select
@enemy_arrow.dispose
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
@enemy_arrow.help_window = @help_window
end
#--------------------------------------------------------------------------
# * Obtain Pose (Scene Battle version)
# battler : battler performing attack
# pose_base : default pose to return
# pose_actor : list of poses for actors
# pose_enemy : list of poses for enemies
#--------------------------------------------------------------------------
def pose_obtain(battler, pose_base, pose_actor, pose_enemy)
# create Arrays
pos_a = {}
pos_e = {}
# fill created Arrays & Set pose
pos_a = pose_actor
pos_e = pose_enemy
pose_now = pose_base
# Obtain pose if not a standard pose
if battler.is_a?(Game_Actor)
pose_now = pos_a[battler.id] if pos_a[battler.id] != nil
else
pose_now = pos_e[battler.id] if pos_e[battler.id] != nil
end
# Return the final pose (minus 1 for niceties)
pose_now -= 1 if pose_now != nil
return pose_now
end

#--------------------------------------------------------------------------
# * Obtain Pose from hashes (Scene Battle version)
# battler : battler performing attack
# hash_base : hash with default poses
# hash_actor : advanced list of poses for actors
# hash_enemy : advanced list of poses for enemies
# condition : value determining where to get the final pose
#--------------------------------------------------------------------------
def pose_array_obtain(battler, hash_base, hash_actor, hash_enemy, condition)
# create Arrays
# create Arrays
hash_b = {}
hash_a = {}
hash_e = {}
pose_temp = {}
# fill created Arrays & Set pose
hash_b = hash_base
hash_a = hash_actor
hash_e = hash_enemy
# Setup the temp Array
if battler.is_a?(Game_Actor)
pose_temp = hash_a[battler.id] if hash_a.include?(battler.id)
else
pose_temp = hash_e[battler.id] if hash_e.include?(battler.id)
end
# Obtain the base pose based on condition (or nil)
pose_now = hash_b[condition] if hash_b.include?(condition)
# Obtain the optional actor/enemy pose based on condition (unless nil)
pose_now = pose_temp[condition] if pose_temp.include?(condition)
# Return the final pose (minus 1 for niceties)
pose_now -= 1 if pose_now != nil
return pose_now
end
end

#==============================================================================
# ** Animated Battlers - Enhanced ver. 8.8 (07-31-2007)
#
#------------------------------------------------------------------------------
# * (4) Miscellaneous: Formations, Viewport and various Detection routines.
#==============================================================================

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Auto-Detection Values
attr_accessor :mnk_det_abs_detect # Trickster's ATB System Detection
attr_accessor :mnk_det_acb_detect # Action Cost Battlesystem Detection
attr_accessor :mnk_det_para_spell # ParaDog Detection
attr_accessor :mnk_det_rtab_attck # Connected Attacking Detection
attr_accessor :mnk_det_rtab_systm # RTAB Detection
attr_accessor :mnk_det_sd_casting # DBS Skill Delay Detection
# Additional values for the save/load feature
attr_accessor :mnk_sm # sideview mirror
attr_accessor :mnk_fmm # formation max members
attr_accessor :mnk_fmh # formation max height
attr_accessor :mnk_fmw # formation max width
attr_accessor :mnk_bh # battlestatus height
attr_accessor :mnk_fs # formation style
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mnk_init initialize
def initialize
# Perform the original call
mnk_init
# Create the savable values
@mnk_sm = 0
@mnk_fmm = 4
@mnk_fmh = 220
@mnk_fmw = 128
@mnk_bh = 160
@mnk_fs = 0
end
end


#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================

class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
alias mnk_wsd write_save_data
def write_save_data(file)
# Store the globals
$game_system.mnk_sm = $sideview_mirror
$game_system.mnk_fmm = $formation_max_member
$game_system.mnk_fmh = $formation_max_height
$game_system.mnk_fmw = $formation_max_width
$game_system.mnk_bh = $battlestatus_height
$game_system.mnk_fs = $formation_style
# Perform the original call
mnk_wsd(file)
end
end


#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
alias mnk_rsd read_save_data
def read_save_data(file)
#Perform the original call
mnk_rsd(file)
# ReStore the globals
$sideview_mirror = $game_system.mnk_sm
$formation_max_member = $game_system.mnk_fmm
$formation_max_height = $game_system.mnk_fmh
$formation_max_width = $game_system.mnk_fmw
$battlestatus_height = $game_system.mnk_bh
$formation_style = $game_system.mnk_fs
end
end


#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :casted # if spell is casted
attr_accessor :casting # if currently casting
attr_accessor :skill_casted # ID of skill used
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias mnk_init initialize
def initialize
@casted = false
@casting = false
@skill_casted = 0
mnk_init
# ParaDog's Spell Delay Detection
if defined?(spelling?)
$game_system.mnk_det_para_spell = true
end
# DBS Spell Delay Detection
if @sd_casting != nil
$game_system.mnk_det_sd_casting = true
end
# Fomar's Action Cost Detection
if @vitality != nil
$game_system.mnk_det_acb_detect = true
end
# Trickster's AT Detection
if @at_multiplier != nil
$game_system.mnk_det_abs_detect = true
end
end
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor
alias mnk_ini initialize
def initialize(actor_id)
mnk_ini(actor_id)
if defined?(change_weapon)
$game_system.mnk_det_rtab_attck = true
end
end
#--------------------------------------------------------------------------
# * Actor X Coordinate
#--------------------------------------------------------------------------
def screen_x
# Determine minimum horizontal space between battlers
x_spacer = $formation_width / $max_member
if self.index != nil
case $formation
when 0 # DIAGONAL PATTERN 1
if $sv_mirror == 1
return self.index * -x_spacer + (($max_member+1)*x_spacer) #202
else
return self.index * x_spacer + (640-(($max_member+1)*x_spacer))#450
end
when 1 # DIAGONAL PATTERN 2
if $sv_mirror == 1
return self.index * x_spacer + x_spacer #64
else
return self.index * -x_spacer + (640-x_spacer*2) #576
end
when 2 # 2-ROW SLANT
if $sv_mirror == 1
if self.index < ($max_member/2)
return self.index + (($max_member+1)*x_spacer) + (x_spacer * self.index)
 

poccil

Sponsor

I found the solution: just change the value of "@phase5_wait_count" in the battle report script. Sorry, but the way you presented the battle report script seemed a little intimidating.

You can change that value, located near line 300, to a higher value, like this:
Code:
@phase5_wait_count = 100
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top