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.

Dalissa's Freak Out

I'll start by saying that I can't script for beans, but I haven't really had any trouble before this.  Give me a script, some time, and a couple of examples and I can customize nearly any script to fit my needs, but for some reason this one is just being stubborn.

I'm currently trying to "customize" DerVVulfman's "Dalissa's Battle Cry" Script, found here:

Code:
#==============================================================================
# ** Dalissa's Battle Cry
#	   by DerVVulfman
#	   Version 2.8-b (Game_System instance version)
#	   06-26-2007
#    Full SDK 2.2 Compatible (Does not need or require SDK 2.2)
#------------------------------------------------------------------------------
#
#  INTRODUCTION:
#
#  This add-on system allows you to pre-program additional vocal cues for your
#  battlers so they can play these additional vocals during battle events.  It
#  can perform battle cries for heroes and enemies, for regular attacks or for
#  skill events.
#
#  This script was a request by a couple of friends.   Both wanted a system to 
#  enhance their combat systems  and personalize  their battles  with an audio
#  system not dependant on the "battle animation" built into RMXP.   Now, with
#  this script, you can set each battler to scream out their 'battle cry' when
#  they perform their battle action.
#
#
#------------------------------------------------------------------------------
#
#  THE CONFIGURATION SECTION:
#
#  This version uses instance values stored within the $game_system class.  As
#  such, it has two bonuses:   reduced memory requirements  and a smaller RMXP
#  script.  This version is smaller than the one that uses ($)Global values.
#
#  However,  calling the values 'in-game' from map events or in-script requires 
#  you to call the $game_system class to perform any changes:
#
#  EX:
#  @>script: $game_system.actor_cry_attack = {1 >= "Charge",
#   :      :    2 => "Yarrrr", 7 => "HieeeYah", 8 => "Haa" }
#
#  Not much except the string is a little longer as it requres the $game_system
#  prefix at the start of each value.
#
#  Also as stated,  the values are stored  withing the $game_system class.   As 
#  such, the configuration system  of this script is located around line 238 of
#  this script, and not at the top.
#
#------------------------------------------------------------------------------
#
#  SETTING THE BATTLECRIES:
#
#  First off,  let me point out  that this system  plays audio clips  that are
#  kept in either your project's or the RTP's Audio\SE directory.  These clips
#  may be of any file format goverened by RMXP, and as such, no file extension
#  will be necessary when actually setting up your battlecry system.
#
#  In this script's  "CONFIGURATION"  system,  you will see two sets of hashes,
#  one set for the actor battlers  and the other for the enemy battlers.   Each
#  set has eight identical hashes:  Attack, Skill, Skill_I, Item, Item_I, Block
#  Escape and Defeat.
#
#  Under most circumstances,  you merely need to enter  the ID number of a bat-
#  tler and the audio clip  it will perform...  or a group  of battlers  as the
#  below syntax shows:
#
#  $hash = { battler id => "audiofile", battler id => "audiofile", .... }
#
#  A few hashes are designed for items and skills,  allowing you to set a range
#  of audio effects for each battler.  Each battler can now have multiple audio
#  clips, one for each skill and/or item used.  The syntax for these few hashes
#  is similar in nature:
#
#  hash = { battler id => { id => "audiofile", id => "audiofile",... },... }
#
#  A few more hashes are designed to give a range of random sound effects. 
#  These are designed in the following fashion:
#
#  hash = { battler id => [ "audiofile", "audiofile",...],... }
#
#  And a few actually combine the two, individual skills/items 'and' random
#  audio clips...  though that may seem excessive???
#
#  hash = {battler => (id => ["audio",...], id=>["audio",... ],... },... }
#
#  If, for example,  you want a 'ghost'  battler to moan when it is performing
#  an attack (assuming it's enemy #1 in your RTP), you would add the following:
#
#	    $game_system.enemy_cry_attack = {1 => "GhostMoan01"}
#
#  ... assuming you have an audio file named  "GhostMoan01"  in your project's
#  Audio\SE directory  or in your RTP directory.   Again,  please note that no
#  file extension is needed or required.  
#
#  And, if you were to set TWO sets of battlecries  (one for a ghost & one for 
#  a zombie),  you'd enter them in the following manner  (again,  assuming the
#  RTP monsters are being used):
#
#	    $game_system.enemy_cry_attack = {1 => "GhostMoan01", 9 => "ZombieGroan04"}
#
#  As you can see, you can skip between battlers when setting audio clips. And
#  while it is preferred to enter them in the id number order, it isn't neces-
#  sary.
#
# (NOTE:  Enemies normally cannot use items, so unless an additional script has
#         been added that permits item usage for enemies,  the item hashes will
#         be useless.)
#
#  To prevent monotony, there is an additional value that is in the system be-
#  low the two sets of hashes.  This value, 'occur_cry_chance', determines the
#  chance of an audio clip to be played.   A value of 100 equals a 100% chance
#  of the file to be played, while a 25 gives the system a 1 in 4 chance of it
#  being played.
#
#------------------------------------------------------------------------------
#
#  COMPATIBILITY:
#
#  This script was designed around the basic DBS system.   I can confirm it's
#  functionality with the RTAB system,  as well as ParaDog's CTB v 2.58,  the
#  newest CTB by XRXS (version 65a).
#
#  It is NOT compatible with She-Who-Must-Not-be-Named's CTB v 3.04 script and it is unknown as to
#  the compatability to KGC's Active Count Battle system.
#
#  This audio system will not work, and is not compatible with Cybersam's Ani-
#  mation system.
#
#------------------------------------------------------------------------------
#
#  KNOWN ISSUES:
#
#  As this system retrieves the action states of the battlers:  Attack, Skill,
#  Item...  and from nothing else,  then this system begins to play the battle
#  cries from the  very moment  these states are triggered.   The only battler
#  overlay system  (Front-View system to a Side-View System)  that this script
#  works with is the new incarnation of Minkoff's Animated Battlers - Enhanced
#  (version 4.7 or higher) as a trigger system has been recently added to that
#  script.
#
#  Earlier versions of Animated Battlers will not play the audio clips for the
#  battlers... if any are still around.
#
#------------------------------------------------------------------------------
#
#  JUST IN CASE:
#
#  By default, the battlecry system will merely NOT play any sound effect if a
#  given battler has no related audio clip.  The system will even skip search-
#  ing through the system  if a hash is empty.   This is  designed  to prevent 
#  avoidable errors  as well  as to play  only the proper clip  for the proper
#  battler.
#
#  Also, with a little assistance from Me? and Mr.Mo,  I was able to create an
#  Error-Check routine that 'ensures' that no error  in this system will cause
#  the system to crash.
#
#  For example, if you enter into a hash of audio clips in the system,  a piece
#  that doesn't exist (either in the project or the RTP file), then this script
#  will merely skip playing this audio file to prevent errors.
#
#------------------------------------------------------------------------------
#
#  THANKS:
#
#  Thanks to  Mimi-Chan  and  ~AtlasWing~  for requesting  this script,  and to 
#  grimreaper1357 for noticing a 'bug',  though it wasn't the error  he thought 
#  it was.  uzumakishade, for 'forcing my hand' to add weapon hashes.   He also
#  suggested the inclusion of 'random' sets for each audio type.  I went so far
#  as to  expand and allow  each skill,  item  & etc to have multiple  'random'
#  Clips. And thanks to Grimreaper1357 for suggesting 'struck' audio clips, and 
#  to joooda for suggesting 'critical hit' audio clips.
#
#==============================================================================



#==============================================================================
# ** 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
  #--------------------------------------------------------------------------
  attr_accessor :default_ase
  attr_accessor :default_ese
  attr_accessor :actor_cry_attack
  attr_accessor :actor_cry_attack_r
  attr_accessor :actor_cry_attack_i
  attr_accessor :actor_cry_attack_r_i
  attr_accessor :actor_cry_skill
  attr_accessor :actor_cry_skill_r
  attr_accessor :actor_cry_skill_i
  attr_accessor :actor_cry_skill_r_i
  attr_accessor :actor_cry_item
  attr_accessor :actor_cry_item_r
  attr_accessor :actor_cry_item_i
  attr_accessor :actor_cry_item_r_i
  attr_accessor :actor_cry_block
  attr_accessor :actor_cry_block_r
  attr_accessor :actor_cry_escape
  attr_accessor :actor_cry_escape_r
  attr_accessor :actor_cry_struck
  attr_accessor :actor_cry_struck_r
  attr_accessor :actor_cry_critical
  attr_accessor :actor_cry_critical_r
  attr_accessor :actor_cry_defeat
  attr_accessor :actor_cry_defeat_r
  attr_accessor :enemy_cry_attack
  attr_accessor :enemy_cry_attack_r
  attr_accessor :enemy_cry_attack_i
  attr_accessor :enemy_cry_attack_r_i
  attr_accessor :enemy_cry_skill
  attr_accessor :enemy_cry_skill_r
  attr_accessor :enemy_cry_skill_i
  attr_accessor :enemy_cry_skill_r_i
  attr_accessor :enemy_cry_item
  attr_accessor :enemy_cry_item_r
  attr_accessor :enemy_cry_item_i
  attr_accessor :enemy_cry_item_r_i
  attr_accessor :enemy_cry_block
  attr_accessor :enemy_cry_block_r
  attr_accessor :enemy_cry_escape
  attr_accessor :enemy_cry_escape_r
  attr_accessor :enemy_cry_struck
  attr_accessor :enemy_cry_struck_r
  attr_accessor :enemy_cry_critical
  attr_accessor :enemy_cry_critical_r
  attr_accessor :enemy_cry_defeat
  attr_accessor :enemy_cry_defeat_r
  attr_accessor :occur_cry_chance
  attr_accessor :anim_cry_detect
  attr_accessor :rtab_cry_detect

  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias dbc_init initialize
  def initialize
    # Perform the original call
    dbc_init
    
   #========================================================================
   #  **  C  O  N  F  I  G  U  R  A  T  I  O  N      S  Y  S  T  E  M  **  #
   #========================================================================
    # Hero battle cries
    @actor_cry_attack       = {}
      @actor_cry_attack_r   = { 3 => ["AAd6", "AAd7"] }
      @actor_cry_attack_i   = {}
      @actor_cry_attack_r_i = {}
    @actor_cry_skill        = {}	
      @actor_cry_skill_r    = {}	
      @actor_cry_skill_i    = {}
      @actor_cry_skill_r_i  = {}
    @actor_cry_item         = {}
      @actor_cry_item_r     = {} 
      @actor_cry_item_i     = {}
      @actor_cry_item_r_i   = {}
    @actor_cry_block        = {}
      @actor_cry_block_r    = {}
    @actor_cry_escape       = {}
      @actor_cry_escape_r   = {}
    @actor_cry_struck       = {}
      @actor_cry_struck_r   = {}
    @actor_cry_critical     = {}
      @actor_cry_critical_r = {}
    @actor_cry_defeat       = {}
      @actor_cry_defeat_r   = {}
 
    # Enemy battle cries
    @enemy_cry_attack       = {}
      @enemy_cry_attack_r   = { 6 => ["Mimi-01", "Mimi-03", "Mimi-07", "eya"] }
      @enemy_cry_attack_i   = {}
      @enemy_cry_attack_r_i = {}
    @enemy_cry_skill        = { 6 => "Mimi-08" }
      @enemy_cry_skill_r    = {}
      @enemy_cry_skill_i    = {}
      @enemy_cry_skill_r_i  = {}
    @enemy_cry_item         = {}
      @enemy_cry_item_r     = {}
      @enemy_cry_item_i     = {}
      @enemy_cry_item_r_i   = {}
    @enemy_cry_block        = {}
      @enemy_cry_block_r    = {}
    @enemy_cry_escape       = {}
      @enemy_cry_escape_r   = {}
    @enemy_cry_struck       = {}
      @enemy_cry_struck_r   = { 6 => ["Mimi-02", "Mimi-05"] }
    @enemy_cry_critical     = { 6 => "Mimi-04" }
      @enemy_cry_critical_r = {}
    @enemy_cry_defeat       = { 6 =>"Mimi-06" }
      @enemy_cry_defeat_r   = {}

    # Chance of occuring
    @occur_cry_chance   = 100

  end  
end



#==============================================================================
# ** Dalissa's Collapse
#------------------------------------------------------------------------------
#  This module performs routines for choosing the collapse SE played during combat.
#==============================================================================

module Dalissa_Collapse
  #--------------------------------------------------------------------------
  # * Collapse Changing Call
  #--------------------------------------------------------------------------   
  def call_collapse_change
    # Create temporary hash
    bcry_temp = {}
    # Retrieve Cry Based on Battler
    if self.is_a?(Game_Enemy)
      battlecollapse = $game_system.default_ese
      battlecollapse = $game_system.enemy_cry_defeat[self.id] if $game_system.enemy_cry_defeat.include?(self.id)
      bcry_temp      = $game_system.enemy_cry_defeat_r[self.id] if $game_system.enemy_cry_defeat_r.include?(self.id)
      bcry_rand      = rand(bcry_temp.size) if bcry_temp != nil
      battlecollapse = bcry_temp[bcry_rand] if bcry_temp[bcry_rand] != nil
    else
      battlecollapse = $game_system.default_ase
      battlecollapse = $game_system.actor_cry_defeat[self.id] if $game_system.actor_cry_defeat.include?(self.id)
      bcry_temp      = $game_system.actor_cry_defeat_r[self.id] if $game_system.actor_cry_defeat_r.include?(self.id)
      bcry_rand      = rand(bcry_temp.size) if bcry_temp != nil
      battlecollapse = bcry_temp[bcry_rand] if bcry_temp[bcry_rand] != nil
    end
    # If the battle cry isn't nil
    if battlecollapse != nil
      begin
        @trd = RPG::AudioFile.new(battlecollapse)
        Audio.se_play("Audio/SE/" + @trd.name, 0, 100)
        # Sound file is true
      rescue Errno::ENOENT
        # Sound file is invalid (restore default)
        battlecollapse = nil
      end 
      # Set the cry
      if battlecollapse != nil 
        # Branch based on battler type
        if self.is_a?(Game_Enemy)
          $data_system.enemy_collapse_se.name = battlecollapse   
        else
          $data_system.actor_collapse_se.name = battlecollapse   
        end
      # Else reset the default  
      else
        # Branch based on battler type
        if self.is_a?(Game_Enemy)
          $data_system.enemy_collapse_se.name = $game_system.default_ese
        else
          $data_system.actor_collapse_se.name = $game_system.default_ase
        end        
      end
    end
  end
end



#==============================================================================
# ** Dalissa's Cry
#------------------------------------------------------------------------------
#  This module performs routines for playing the selected battlecry itself
#==============================================================================

module Dalissa_Cry
  #--------------------------------------------------------------------------
  # * Play the Cry
  #--------------------------------------------------------------------------
  def play_cry(battlecry)
    # Error checking.  Makes sure that even the default sound file is available.
    # If it is missing, then the system will set the battle cry to >none<.
    #
    # If the chance of the battle cry is true
    if rand(100) <= $game_system.occur_cry_chance
      # If the battle cry isn't nil
      if battlecry != nil
        begin
          @trd = RPG::AudioFile.new(battlecry)
          Audio.se_play("Audio/SE/" + @trd.name, 0, 100)
          # Sound file is true
        rescue Errno::ENOENT
          # Sound file is invalid (restore default)
          battlecry = nil
        end 
        # Play the cry
        if battlecry != nil 
          Audio.se_play("Audio/SE/" + @trd.name, 80, 100)
        end
      end
    end
  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
  include Dalissa_Collapse
  include Dalissa_Cry
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------  
  attr_accessor :dbc_b_dmg
  #--------------------------------------------------------------------------
  # * Applying Normal Attack Effects
  #     attacker : battler
  #--------------------------------------------------------------------------
  alias dbc_ae attack_effect
  def attack_effect(attacker)
    # Perform the Original call
    dbc_ae(attacker)
    # The Included module (Collapse Changing Call)
    call_collapse_change
  end
  #--------------------------------------------------------------------------
  # * Apply Skill Effects
  #     user  : the one using skills (battler)
  #     skill : skill
  #--------------------------------------------------------------------------
  alias dbc_se skill_effect
  def skill_effect(user, skill)
    # Perform the Original call  
    dbc_se(user, skill)
    # The Included module (Collapse Changing Call)
    call_collapse_change    
  end
  #--------------------------------------------------------------------------
  # * Application of Item Effects
  #     item : item
  #--------------------------------------------------------------------------
  alias dbc_ie item_effect
  def item_effect(item, battler = @active_battler)
    # Perform the Original call  
    if $game_system.rtab_cry_detect
      dbc_ie(item, battler)
    else
      dbc_ie(item)
    end
    # The Included module (Collapse Changing Call)
    call_collapse_change     
  end
end



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

class Scene_Battle
  include Dalissa_Collapse
  include Dalissa_Cry
  attr_accessor :dbc_ase                   # Stores the Actor's Collapse SE
  attr_accessor :dbc_ese                   # Stores the Enemy's Collapse SE
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias dbc_main main
  def main
    # Store original 'collapse' SE
    $game_system.default_ase = $data_system.actor_collapse_se.name
    $game_system.default_ese = $data_system.enemy_collapse_se.name
    # Perform the original call
    dbc_main
    # Restore original 'collapse' SE
    $data_system.actor_collapse_se.name = $game_system.default_ase
    $data_system.enemy_collapse_se.name = $game_system.default_ese
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 2 : start action)
  #--------------------------------------------------------------------------
  alias update_phase4_step2_scream update_phase4_step2
  def update_phase4_step2(battler = @active_battler)
    # Do not perform here if Animated Battlers is detected
	  unless $game_system.anim_cry_detect == true
      # Obtain & Play Battle Cries
      perform_cry(battler)
    end  
    # Perform original routine	
    if $game_system.rtab_cry_detect == true
      update_phase4_step2_scream(battler)
    else
      update_phase4_step2_scream
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 3 : animation for action performer)
  #--------------------------------------------------------------------------  
  alias dbc_update_phase4_step3 update_phase4_step3
  def update_phase4_step3(battler = @active_battler)
    # Perform original routine	
    if $game_system.rtab_cry_detect == true
      dbc_update_phase4_step3(battler)
    else
      dbc_update_phase4_step3
    end
    # Only perform if using Animated Battlers
    if $game_system.anim_cry_detect == true
      if $battle_charge == true
        # Obtain & Play Battle Cries
        perform_cry(battler)
        # Reset Flag
        $battle_charge = false
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 3 : animation for action performer)
  #--------------------------------------------------------------------------  
  alias dbc_up4s4 update_phase4_step4
  def update_phase4_step4(battler = @active_battler)
    # Loop through all targetted battlers
    for target in ($game_system.rtab_cry_detect ? battler.target : @target_battlers)
      # Calculate for successful hit
      dbc_damage = ($game_system.rtab_cry_detect ? target.damage[battler] : target.damage)
      dbc_critical = ($game_system.rtab_cry_detect ? target.critical[battler] : target.critical)
      # If damage DID occur
      if dbc_damage.is_a?(Numeric) and dbc_damage > 0
        bcry_temp = {}
        battlecry = nil
        # Obtain Battle Cries for Enemies
        if target.is_a?(Game_Enemy)
          battlecry = choosecry2(target.id, $game_system.enemy_cry_struck, $game_system.enemy_cry_struck_r)
          if dbc_critical
            battlecry = choosecry2(target.id, $game_system.enemy_cry_critical, $game_system.enemy_cry_critical_r)
          end
        else
          battlecry = choosecry2(target.id, $game_system.actor_cry_struck, $game_system.actor_cry_struck_r)
          if dbc_critical
            battlecry = choosecry2(target.id, $game_system.actor_cry_critical, $game_system.actor_cry_critical_r)
          end
        end
        # Perform the cry
        play_cry(battlecry)
        # Erase Battle Cry
        battlecry = nil
      end
    end
    # Perform the original call
    if $game_system.rtab_cry_detect
      dbc_up4s4(battler)
    else
      dbc_up4s4
    end
  end  
  #--------------------------------------------------------------------------
  # * Retrieve & Perform the Cry
  #--------------------------------------------------------------------------
  def perform_cry(battler)
    # Re-Set Battle Cry to empty
    battlecry = nil
    # Create temporary hash
    bcry_temp = {}
    # Obtain Battle Cries for Enemies
    if battler.is_a?(Game_Enemy)
      # Branch according to each action
      case battler.current_action.kind
      when 0  # basic
        battlecry = choosecry(battler.id, $game_system.enemy_cry_attack, $game_system.enemy_cry_attack_i, $game_system.enemy_cry_attack_r, $game_system.enemy_cry_attack_r_i, battler.weapon_id)
        # If blocking
        if battler.current_action.basic == 1
          battlecry = choosecry2(battler.id, $game_system.enemy_cry_block, $game_system.enemy_cry_block_r)
        end
        # If escaping
        if battler.current_action.basic == 2
          battlecry = choosecry2(battler.id, $game_system.enemy_cry_escape, $game_system.enemy_cry_escape_r)
        end
        # If resting
        if battler.current_action.basic == 3
          battlecry = nil
        end
      when 1  # skill
        battlecry = choosecry(battler.id, $game_system.enemy_cry_skill, $game_system.enemy_cry_skill_i, $game_system.enemy_cry_skill_r, $game_system.enemy_cry_skill_r_i, battler.current_action.skill_id)
      when 2  # item
        battlecry = choosecry(battler.id, $game_system.enemy_cry_item, $game_system.enemy_cry_item_i, $game_system.enemy_cry_item_r, $game_system.enemy_cry_item_r_i, battler.current_action.item_id)
      end
    # otherwise, Obtain Battle Cries for Actors
    else
      # Branch according to each action
      case battler.current_action.kind
      when 0  # basic
        battlecry = choosecry(battler.id, $game_system.actor_cry_attack, $game_system.actor_cry_attack_i, $game_system.actor_cry_attack_r, $game_system.actor_cry_attack_r_i, battler.weapon_id)
        # If blocking
        if battler.current_action.basic == 1
          battlecry = choosecry2(battler.id, $game_system.actor_cry_block, $game_system.actor_cry_block_r)
        end
        # If escaping
        if battler.current_action.basic == 2
          battlecry = choosecry2(battler.id, $game_system.actor_cry_escape, $game_system.actor_cry_escape_r)
          end
        # If resting
        if battler.current_action.basic == 3
          battlecry = nil
        end
      when 1  # skill
        battlecry = choosecry(battler.id, $game_system.actor_cry_skill, $game_system.actor_cry_skill_i, $game_system.actor_cry_skill_r, $game_system.actor_cry_skill_r_i, battler.current_action.skill_id)
      when 2  # item
        battlecry = choosecry(battler.id, $game_system.actor_cry_item, $game_system.actor_cry_item_i, $game_system.actor_cry_item_r, $game_system.actor_cry_item_r_i, battler.current_action.item_id)
      end
    end
    # Perform the cry
    play_cry(battlecry)
    # Erase Battle Cry
    battlecry = nil
  end
  #--------------------------------------------------------------------------
  # * Choose the cry
  #--------------------------------------------------------------------------
  def choosecry(dbc_battler, dbc_main, dbc_i, dbc_r, dbc_r_i, dbc_id)
    # Create empty hash for substitutions
    dbc_temp  = {}
    dbc_temp2 = {}
    # Set basic cry
    dbc_cry     = dbc_main[dbc_battler] if dbc_main.include?(dbc_battler)
    # Fill temp value & obtain battlecry (Individual)
    dbc_temp = dbc_i[dbc_battler] if dbc_i.include?(dbc_battler)
    dbc_cry = dbc_temp[dbc_id] if dbc_temp[dbc_id] != nil
    # Fill temp value & obtain battlecry (Random)
    dbc_temp = dbc_r[dbc_battler] if dbc_r.include?(dbc_battler)
    dbc_rand = rand(dbc_temp.size) if dbc_temp != nil
    dbc_cry = dbc_temp[dbc_rand] if dbc_temp[dbc_rand] != nil
    # Fill temp value & obtain battlecry (Individual Randoms)
    dbc_temp = dbc_r_i[dbc_battler] if dbc_r_i.include?(dbc_battler)
    dbc_temp2 = dbc_temp[dbc_id] if dbc_temp[dbc_id] != nil
    dbc_rand = rand(dbc_temp2.size) if dbc_temp != nil
    dbc_cry = dbc_temp2[dbc_rand] if dbc_temp2[dbc_rand] != nil
    # Return the cry
    return dbc_cry
  end  
  #--------------------------------------------------------------------------
  # * Choose the cry (smaller version)
  #--------------------------------------------------------------------------
  def choosecry2(dbc_battler, dbc_main, dbc_r)
    # Create empty hash for substitutions
    dbc_temp = {}
    # Set basic cry
    dbc_cry     = dbc_main[dbc_battler] if dbc_main.include?(dbc_battler)
    # Fill temp value & obtain battlecry (Random)
    dbc_temp    = dbc_r[dbc_battler]    if dbc_r.include?(dbc_battler)
    dbc_rand    = rand(dbc_temp.size)   if dbc_temp != nil
    dbc_cry     = dbc_temp[dbc_rand]    if dbc_temp[dbc_rand] != nil
    # Return the cry
    return dbc_cry
  end
end



#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
#  This class brings together battle screen sprites. It's used within
#  the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  # Special note:  When the normal method for detecting RTAB fails, I do this
  alias bcry_initialize initialize
  def initialize
    # Perform the original routine
    bcry_initialize
    # If RTAB's 'zoom' feature is present
    if @real_zoom != nil
      # Set the RTAB detector to 'true'
      $game_system.rtab_cry_detect = true
    end
  end
end



#==============================================================================
# ** 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
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias bcry_initialize initialize
  def initialize(viewport, battler = nil)
    # Perform the original routine
    bcry_initialize(viewport,battler)
    # If Animated Battler's 'battler offset' feature is present
    if @battler_offset != nil
      # Set the Animated Battlers detector to 'true'
      $game_system.anim_cry_detect = true
    end
  end
end

Basically what I'm trying to do is add my vocal cues in a string, just like the example was shown.  I'm pretty sure I did nothing wrong, since I followed his example directly, but as soon as I put more than one audio file in the stiring it freaks out and gives me this error:

"Script 'Dalissa's Battle Cry' line 383: TypeError occurred.  Cannot convert Fixnum into String."

I haven't tried any other hashes but the actor attack one.  Could it have something to do with the r's or i's after some of the some subsections? I didn't really understand what those did either, didn't really think it was a big deal, but maybe it is?

And I know it isn't a clash with other scripts because I put it into a fresh project to see how it would work and alas I got the same error.

I just can't seem to figure this out alone so any help on this would be appreciated.

Best regards,

King Matthew
 

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