ACBS FIX SCRIPT #1: Victory Cries Patch

ACBS FIX SCRIPT #1
Victory Cries Patch
Version: 1.0​



Introduction
This fixes a major flaw with the ACBS (Atoa's CBS) v 3.2 by Victor Sant. The bug was caused by an oversight which would crash the system if one wished to have audible cues from actors when they win a battle (or enemies taunting the heroes if they lose).



Script
Code:
#==============================================================================
# ** ACBS FIX SCRIPT #1:  Victory Cries Patch
#------------------------------------------------------------------------------
#     by DerVVulfman (08/07/2019) MM/DD/YYYY
#------------------------------------------------------------------------------
#  The ACBS System has a flaw with audible victory cries.  This fixes a major
#  flaw that can crash the system due to missing array content.
#==============================================================================



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

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Set Victory battlecry for enemies
  #--------------------------------------------------------------------------
  def set_enemy_victory_battlecry
    @victory_battlercry_enemy = nil
    battle_cry_set = []
    for battler in $game_troop.enemies
      if check_bc_basic(battler, "VICTORY") and not battler.dead?
        battle_cry_set << battler
      end
    end
    unless battle_cry_set.empty? or $game_temp.no_enemy_victory_bc
      @victory_battlercry_enemy = battle_cry_set [rand(battle_cry_set.size)]
    end
    if @last_active_enemy != nil and not @last_active_enemy.dead? and not
       $game_temp.no_enemy_victory_bc and battle_cry_set.include?(@last_active_enemy)
      @victory_battlercry_enemy = @last_active_enemy
    end
  end
  #--------------------------------------------------------------------------
  # * Set allies victory battlecry
  #--------------------------------------------------------------------------
  def set_victory_battlecry
    @victory_battlercry_battler
    battle_cry_set = []
    for battler in $game_party.actors
      if check_bc_basic(battler, "VICTORY") and not battler.dead?
        battle_cry_set << battler
      end
    end
    unless battle_cry_set.empty? or $game_temp.no_actor_victory_bc
      @victory_battlercry_battler = battle_cry_set [rand(battle_cry_set.size)]
    end
    if @last_active_actor != nil and not @last_active_actor.dead? and not
       $game_temp.no_actor_victory_bc and battle_cry_set.include?(@last_active_enemy)
      @victory_battlercry_battler = @last_active_actor
    end
    battle_cry_basic(@victory_battlercry_battler, "VICTORY") if @victory_battlercry_battler != nil
  end
end



Instructions
Paste this directly below the ACBS | Scene_Battle 4 script so it can take effect and replace the broken methods in question.



FAQ
A surprise, this is the first bug I've seen in the system... ever?



Compatibility
Specifically geared for the ACBS v 3.2. IF you don't have a copy....
ACBS - Atoa Custom Battle System v 3.2 by Atoa (Victor Sant) Posted July 2009




Credits and Thanks
To aeliath of Save-Point.Org who supplied me with the error message that pointed out the bug.



Terms and Conditions
Free for use with just due credit required.

Original thread: https://forums.rpgmakerweb.com/threads/acbs-fix-script-1-victory-cries-patch.111911/