Conversion: VX to VXA

I would really appreciate it if someone could convert these two scripts for use in RMVXAce.

Battler SE Spoiler
  1. #/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\|/
  2. #~ Battler SE (Default Battle System Version)
  3. #~ By: Rockleedude
  4. #~ Version: 3.0
  5. #~ Latest Update: 10/26/2009
  6. #~
  7. #~ This script allows you to add 13 different sound effects to play for
  8. #~ actors and enemies in battle.
  9. #~
  10. #===============================================================================
  11. #~                               Instructions
  12. #===============================================================================
  13. #~ To setup the sound effects played for a battler, use the following tag:
  14. #~ <battler se (type) (name) v(volume) p(pitch)>
  15. #~ (type): One of the 13 types. They are specified in the "For type" section.
  16. #~ (name): The name of the song file for the sound effect. Put playnothing to
  17. #~         mute the sound effects for that type.
  18. #~ (volume): The sound effect's volume.
  19. #~ (pitch): The sound effect's pitch.
  20. #~
  21. #~ The tags for enemies go into the notes box in the database.
  22. #~ The tags for actors go in the customization section below in this script.
  23. #~
  24. #~ For type:
  25. #~   Put the type corresponding to whichever type of sound effect this sound is.
  26. #~   i.e. If this is the sound effect for when the battler takes damage, put take.
  27. #~   The 13 types are the following:
  28. #~      1. Take - Played when the battler loses hp or mp as a result of the
  29. #~                action of another battler.
  30. #~      2. Recover - Played when the battler regains hp or mp, loses a negative
  31. #~                   state, or is revived from death.
  32. #~      3. Evade - Played when the battler dodges an attack.
  33. #~      4. Plus State - Played when the battler receives a positive, good state.
  34. #~                      Does not play if both a plus and minus state are received.
  35. #~      5. Minus State - Played when the battler receives a negative, bad state.
  36. #~                      Does not play if both a plus and minus state are received.
  37. #~      6. Attack - Played when the battler does a regular attack or uses a
  38. #~                  skill or item that has physical attack checked.
  39. #~      7. Target Foe - Played when the battler uses a skill or item that
  40. #~                      targets one or more foes.
  41. #~      8. Target Ally - Played when the battler uses a skill or item that
  42. #~                       targets one or more allies. Does not play if the only
  43. #~                       target is the battler itself.
  44. #~      9. Self - Played when the battler uses a skill or item that targets
  45. #~                iteself.
  46. #~      10. Critical Hit - Played when the battler delivers a critical hit.
  47. #~      11. Miss - Played when the battler misses with an attack.
  48. #~      12. Death - Played when the battler dies.
  49. #~      13. Low Health - Played when the battler's hp falls below a specified
  50. #~                       amount.
  51. #~ For name:
  52. #~   This should be the exact name of the file. So if the file name is "Scream"
  53. #~   you should put "Scream" and not "scream" (Notice the difference in first
  54. #~   letters). You can have quotation marks around the name of file if you
  55. #~   choose to. The file type of the sound effect is also optional.
  56. #~   Files for the sound effects should be located in the SE folder that
  57. #~   is inside the Audio folder of your project. You also have the choice of
  58. #~   creating a folder inside the SE folder to store the battler sound effects in.
  59. #~   The purpose of this is to avoid having a name conflict between a regular
  60. #~   sound effect and a sound effect for an battler. This could also help with
  61. #~   organization. This is all up to you. In the customization section below,
  62. #~   type in the exact name of the folder. If you are not using the custom
  63. #~   folder, then put nil instead. Note, if the custom folder exists, it
  64. #~   will be searched first before looking in the SE folder.
  65. #~   To completely mute the sound effects (even the default sound effects) for
  66. #~   particularly type for a battler, put playnothing into the name spot. This
  67. #~   will make it so no sound effect will play for that type for that battler.
  68. #~   Note that playnothing with quotation marks ("playnothing") will not mute
  69. #~   the se. Instead it would search for the sound effect named "playnothing".
  70. #~ For volume:
  71. #~   This is the volume for the sound effect. Be sure to include the "v" before
  72. #~   the volume. Use the sound test to help decide what you want this value to
  73. #~   be. The volume can be left out. If it is left out, then the default
  74. #~   volume will be used instead. You can set the default volume in the
  75. #~   customization section. Must be between 0 and 100.
  76. #~ For pitch:
  77. #~   This is the pitch for the sound effect. Be sure to include the "p" before
  78. #~   the pitch. Use the sound test to help decide what you want this value to
  79. #~   be. The pitch can also be left out. If it is left out, then the default
  80. #~   pitch will be used instead. You can set the default pitch in the
  81. #~   customization section. Must be between 50 and 150.
  82. #~ You can insert more than one sound effect for each type for a battler. Each
  83. #~ sound effect for each type must be in a separate tag. When there is more than
  84. #~ one sound effect for a particular type of a battler, a sound effect will
  85. #~ randomly be chosen to be played. Note, if playnothing is one of the choices,
  86. #~ it can be randomly chosen. Just because playnothing is one of the choices
  87. #~ does not mean it will automatically play nothing for that type. It has to be
  88. #~ chosen randomly.
  89. #~
  90. #~
  91. #~
  92. #~ Examples:
  93. #~
  94. #~ <battler se death Scream v85 p100>
  95. #~ - Will play the sound file "Scream" with the volume as 85 and pitch as 100
  96. #~   for the death sound effect.
  97. #~
  98. #~ <battler se target foe "Roar" p90>
  99. #~ - Will play the sound file "Roar" with the volume as the default and pitch as
  100. #~   90 for the target foe sound effect. Remember, the quotation marks are not
  101. #~   required.
  102. #~
  103. #~ <battler se minus state Groan>
  104. #~ - Will play the sound file "Groan" with the volume and pitch as the defaults
  105. #~   for the minus state damage sound effect.
  106. #~
  107. #~ <battler se evade playnothing>
  108. #~ - Will play no sound effect, not even the default sound effect chosen in the
  109. #~   database, when the battler evades.
  110. #~  
  111. #~
  112. #/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\/|\|/|\|/
  113.  
  114. $imported = {} if $imported == nil
  115. $imported["Battler_SE"] = true
  116.  
  117. module Rockleedude
  118.   module Battler_SE
  119. #===============================================================================
  120. #                               CUSTOMIZATION
  121. #===============================================================================
  122.                               # Setup for Actors #
  123.     # With the addition of the actor part of the script, comes an addition to
  124.     # the customization section. Since actors have no notes box like enemies
  125.     # do, another method had to be used for setup for actors. Basically, I
  126.     # created a notes box for actors in this script (note this "notes box" will
  127.     # only work for this script). The syntax for the tag is exactly the same
  128.     # as the syntax for enemies. Put ACTOR_SE_SETUP[x] = "  y  " where x is the
  129.     # id of the actor and y is the tags. You can have any number of lines of
  130.     # tag between the quotation marks. See the example below if confused.
  131.     #
  132.     # The following is an example:
  133.     #   ACTOR_SE_SETUP[1] =
  134.     #  "<battler se take Ouch>
  135.     #   <battler se take playnothing>
  136.     #   <battler se attack Yell>
  137.     #   <battler se death Scream p125>"
  138.     #
  139.     ACTOR_SE_SETUP = [] # Do not alter or remove!
  140.     #
  141.     #
  142.     #               --> Insert Tags for Actors Below Here <--
  143.  
  144.  
  145.    
  146.    
  147.     #               --> Insert Tags for Actors Above Here <--
  148.    
  149.    
  150.     BATTLER_SE_FOLDER_NAME = nil
  151.     # The name of the folder inside of the SE folder where the battler sound
  152.     # effects are stored. Include quotation marks around the name.
  153.     # For example: "Battler_SE"
  154.     # If the custom folder is not being used, put nil with no quotations.
  155.    
  156.     DEFAULT_VOLUME = 100
  157.     # The volume used whenever the volume is left out of the tag.
  158.     # Can be 0-100
  159.     DEFAULT_PITCH = 100
  160.     # The pitch used whenever the pitch is left out of the tag.
  161.     # Can be 50-150
  162.    
  163.     PLUS_STATES = [9, 10, 11, 12]
  164.     # The states that are considered positive, good states. When a battler
  165.     # receives one of these states, the specified plus state sound effect will
  166.     # play. Insert the id of the state in the above array.
  167.     MINUS_STATES = [1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 15, 16]
  168.     # The states that are considered negative, bad states. When a battler
  169.     # receives one of these states, the specified minus state sound effect will
  170.     # play. Insert the id of the state in the above array.
  171.     #
  172.     # States can be left out if they don't fall into either category of plus
  173.     # or negative.
  174.    
  175.     DEATH_STATE_ID = 1
  176.     # The id of the state that represents death, knock-out, incapacitated, etc.
  177.     # The default is id 1. There is really no reason to change the id of the
  178.     # death state but I had to include this just incase.
  179.    
  180.     LOW_HEALTH_PERCENTAGE = 25
  181.     # The percentage that determines when the low health sound effect is played.
  182.     # This number should be between 0 and 100 since it's a percentage. The color
  183.     # of the hp shown in the status changes to yellow when the hp is below 25%
  184.     # incase you want to make it as much as the game considers low health.
  185. #===============================================================================
  186. #                             END CUSTOMIZATION
  187. #===============================================================================
  188.  
  189.     BATTLER_SE = /<BATTLER[\s_]?SE[\s_]?(TAKE|RECOVER|EVADE|PLUSSTATE|PLUS[\s]STATE|PLUS_STATE|MINUSSTATE|MINUS[\s]STATE|MINUS_STATE|ATTACK|TARGETFOE|TARGET[\s]FOE|TARGET_FOE|TARGETALLY|TARGET[\s]ALLY|TARGET_ALLY|CRITICALHIT|CRITICAL[\s]HIT|CRITICAL_HIT|MISS|DEATH|LOWHEALTH|LOW[\s]HEALTH|LOW_HEALTH|SELF)[\s_]?(.*?)[\s_]?(v\d*?)?[\s_]?(p\d*?)?>/i
  190.     BATTLER_SE_PLAYNOTHING = /<BATTLER[\s_]?SE[\s_]?(TAKE|RECOVER|EVADE|PLUSSTATE|PLUS[\s]STATE|PLUS_STATE|MINUSSTATE|MINUS[\s]STATE|MINUS_STATE|ATTACK|TARGETFOE|TARGET[\s]FOE|TARGET_FOE|TARGETALLY|TARGET[\s]ALLY|TARGET_ALLY|CRITICALHIT|CRITICAL[\s]HIT|CRITICAL_HIT|MISS|DEATH|LOWHEALTH|LOW[\s]HEALTH|LOW_HEALTH|SELF)[\s_]?PLAYNOTHING>/i
  191.   end
  192. end
  193.  
  194. #
  195. # SE CLASS
  196. #
  197. class RPG::SE
  198.  
  199.     def battler_se_play
  200.       folder = Rockleedude::Battler_SE::BATTLER_SE_FOLDER_NAME
  201.       unless @name.empty?
  202.         unless folder == nil
  203.           begin
  204.             Audio.se_play("Audio/SE/" + folder + "/" + @name, @volume, @pitch)
  205.             #print @name + ": name" if $TEST
  206.           rescue
  207.             begin
  208.               play
  209.             rescue
  210.               print "The sound effect, " + @name + ", is not found in either folder." if $TEST
  211.               return false
  212.             end
  213.           end
  214.         else
  215.           begin
  216.             play
  217.           rescue
  218.             print "The sound effect, " + name + ", is not found in the SE folder.
  219.             If you created a Battler_SE folder be sure you put the name correctly
  220.             in the module as BATTLER_SE_FOLDER_NAME" if $TEST
  221.             return false
  222.           end
  223.         end
  224.       else
  225.         return false
  226.       end
  227.     end
  228.  
  229.     def play
  230.       unless @name.empty?
  231.         Audio.se_play("Audio/SE/" + @name, @volume, @pitch)
  232.       end
  233.     end
  234. end # class end
  235.  
  236. #
  237. # SOUND MODULE
  238. #
  239. module Sound
  240.  
  241.   def self.play_enemy_attack
  242.   end
  243.  
  244.   def self.play_enemy_damage
  245.   end
  246.  
  247.   def self.play_enemy_collapse
  248.   end
  249.  
  250.   def self.play_actor_damage
  251.   end
  252.  
  253.   def self.play_actor_collapse
  254.   end
  255.  
  256.   def self.play_recovery
  257.   end
  258.  
  259.   def self.play_miss
  260.   end
  261.  
  262.   def self.play_evasion
  263.   end
  264.  
  265.   def self.play_battler_se(battler_id, type, a_or_e, default)
  266.    # Type:   0: Take, 1: Recover, 2: Evade, 3: Plus State, 4: Minus State,
  267.    # Type:   5: Attack, 6: Target Foe, 7: Target Ally, 8: Critical Hit, 9: Miss,
  268.    # Type:   10: Death, 11: Low Health, 12: Self
  269.    # a_or_e: 1: Actor  2: Enemy
  270.                  
  271.     se = $data_actor_se[battler_id] if a_or_e == 1
  272.     se = $data_enemy_se[battler_id] if a_or_e == 2
  273.     unless se[type].empty?
  274.       chosen_se = se[type][rand(se[type].size)]
  275.     else
  276.       Sound.play_default_se(type, a_or_e)
  277.       return
  278.     end
  279.     #print chosen_se.inspect + ":chosen_se" if $TEST
  280.     return if chosen_se == "PLAYNOTHING"
  281.     t_or_f = chosen_se.battler_se_play
  282.     return if default == false
  283.     Sound.play_default_se(type, a_or_e) if t_or_f == false
  284.   end
  285.    
  286.   def self.play_default_se(type, a_or_e)
  287.     if a_or_e == 1
  288.       $data_system.sounds[12].play if type == 0
  289.       $data_system.sounds[13].play if type == 10
  290.     else
  291.       $data_system.sounds[9].play if type == 5
  292.       $data_system.sounds[10].play if type == 0
  293.       $data_system.sounds[11].play if type == 10
  294.     end
  295.     $data_system.sounds[14].play if type == 1
  296.     $data_system.sounds[15].play if type == 9
  297.     $data_system.sounds[16].play if type == 2
  298.   end
  299.  
  300. end
  301.  
  302. #
  303. # SCENE_BATTLE CLASS
  304. #
  305. class Scene_Battle < Scene_Base
  306.  
  307.   # HP: Take(0) and Recover(1)
  308.   alias display_hp_damage_orig_rld_battler_se display_hp_damage
  309.   def display_hp_damage(target, obj = nil)
  310.     if target.hp_damage > 0
  311.       if target.actor?
  312.         Sound.play_battler_se(target.actor_id, 0, 1, true)
  313.       else
  314.         Sound.play_battler_se(target.enemy_id, 0, 2, true)
  315.       end
  316.     elsif target.hp_damage < 0
  317.       if target.actor?
  318.         Sound.play_battler_se(target.actor_id, 1, 1, true)
  319.       else
  320.         Sound.play_battler_se(target.enemy_id, 1, 2, true)
  321.       end
  322.     end
  323.     display_hp_damage_orig_rld_battler_se(target, obj = nil)
  324.   end
  325.  
  326.   # MP: Take(0) and Recover(1)
  327.   alias display_mp_damage_orig_rld_battler_se display_mp_damage
  328.   def display_mp_damage(target, obj = nil)
  329.     if target.hp_damage == 0
  330.       if target.mp_damage > 0
  331.         if target.actor?
  332.           Sound.play_battler_se(target.actor_id, 0, 1, false)
  333.         else
  334.           Sound.play_battler_se(target.enemy_id, 0, 2, false)
  335.         end
  336.       elsif target.mp_damage < 0
  337.         if target.actor?
  338.           Sound.play_battler_se(target.actor_id, 1, 1, true)
  339.         else
  340.           Sound.play_battler_se(target.enemy_id, 1, 2, true)
  341.         end
  342.       end
  343.     end
  344.     display_mp_damage_orig_rld_battler_se(target, obj = nil)
  345.   end
  346.  
  347.   # Recover(1) for Removed Minus States
  348.   def play_if_minus_state_removed(target, obj = nil)
  349.     return unless (target.hp_damage == 0) and (target.mp_damage == 0)
  350.     plus_a = []
  351.     minus_a = []
  352.     plus_list = Rockleedude::Battler_SE::PLUS_STATES
  353.     minus_list = Rockleedude::Battler_SE::MINUS_STATES
  354.     for state in target.removed_states
  355.       plus_a.insert(0, state) if plus_list.include?(state.id)
  356.       minus_a.insert(0, state) if minus_list.include?(state.id)
  357.       if state.id == Rockleedude::Battler_SE::DEATH_STATE_ID
  358.         if target.actor?
  359.           Sound.play_battler_se(target.actor_id, 1, 1, false)
  360.         else
  361.           Sound.play_battler_se(target.enemy_id, 1, 2, false)
  362.         end
  363.         return
  364.       end
  365.     end
  366.     return if (plus_a.size != 0) and (minus_a.size != 0)
  367.     return if plus_a.empty? and minus_a.empty?
  368.     if plus_a.empty?
  369.       if target.actor?
  370.         Sound.play_battler_se(target.actor_id, 1, 1, false)
  371.       else
  372.         Sound.play_battler_se(target.enemy_id, 1, 2, false)
  373.       end
  374.     end
  375.   end
  376.  
  377.   # Evade(2)
  378.   alias display_evasion_orig_rld_battler_se display_evasion
  379.   def display_evasion(target, obj = nil)
  380.     if target.actor?
  381.       Sound.play_battler_se(target.actor_id, 2, 1, true)
  382.     else
  383.       Sound.play_battler_se(target.enemy_id, 2, 2, true)
  384.     end
  385.     display_evasion_orig_rld_battler_se(target, obj = nil)
  386.   end
  387.  
  388.   # Plus State(3) and Minus State(4)
  389.   def play_if_plus_or_minus_added(target, obj = nil)
  390.     plus_a = []
  391.     minus_a = []
  392.     plus_list = Rockleedude::Battler_SE::PLUS_STATES
  393.     minus_list = Rockleedude::Battler_SE::MINUS_STATES
  394.     for state in target.added_states
  395.       plus_a.insert(0, state) if plus_list.include?(state.id)
  396.       minus_a.insert(0, state) if minus_list.include?(state.id)
  397.       return if state.id == Rockleedude::Battler_SE::DEATH_STATE_ID
  398.     end
  399.     return if (plus_a.size != 0) and (minus_a.size != 0)
  400.     return if plus_a.empty? and minus_a.empty?
  401.     return unless (target.hp_damage == 0) and (target.mp_damage == 0)
  402.     if minus_a.empty?
  403.       if target.actor?
  404.         Sound.play_battler_se(target.actor_id, 3, 1, false)
  405.       else
  406.         Sound.play_battler_se(target.enemy_id, 3, 2, false)
  407.       end
  408.     elsif plus_a.empty?
  409.       if target.actor?
  410.         Sound.play_battler_se(target.actor_id, 4, 1, false)
  411.       else
  412.         Sound.play_battler_se(target.enemy_id, 4, 2, false)
  413.       end
  414.     end
  415.   end
  416.   alias display_added_states_orig_rld_battler_se display_added_states
  417.   def display_added_states(target, obj = nil)
  418.     play_if_plus_or_minus_added(target, obj = nil)
  419.     play_if_minus_state_removed(target, obj = nil)
  420.     display_added_states_orig_rld_battler_se(target, obj = nil)
  421.   end
  422.  
  423.   # Attack(5)
  424.   alias display_attack_animation_orig_rld_battler_se display_attack_animation
  425.   def display_attack_animation(targets)
  426.     if @active_battler.actor?
  427.       Sound.play_battler_se(@active_battler.actor_id, 5, 1, false)
  428.       wait(15, true)
  429.     else
  430.       Sound.play_battler_se(@active_battler.enemy_id, 5, 2, true)
  431.     end
  432.     display_attack_animation_orig_rld_battler_se(targets)
  433.   end
  434.   def play_attack_if_ui_phy_atk
  435.     if @active_battler.action.skill?
  436.       if @active_battler.action.skill.physical_attack
  437.         if @active_battler.actor?
  438.           Sound.play_battler_se(@active_battler.actor_id, 5, 1, false)
  439.         else
  440.           Sound.play_battler_se(@active_battler.enemy_id, 5, 2, false)
  441.         end
  442.       end
  443.     end
  444.     if @active_battler.action.item?
  445.       if @active_battler.action.item.physical_attack
  446.         if @active_battler.actor?
  447.           Sound.play_battler_se(@active_battler.actor_id, 5, 1, false)
  448.         else
  449.           Sound.play_battler_se(@active_battler.enemy_id, 5, 2, false)
  450.         end
  451.       end
  452.     end
  453.   end
  454.  
  455.   # Target Foe(6) and Target Ally(7) and Self(12)
  456.   def play_if_target_foe_or_ally_or_self(targets)
  457.     if @active_battler.action.skill?
  458.       return if @active_battler.action.skill.physical_attack
  459.     elsif @active_battler.action.item?
  460.       return if @active_battler.action.item.physical_attack
  461.     end
  462.     if targets.compact.size == 1
  463.       if targets.compact[0] == @active_battler
  464.         if @active_battler.actor?
  465.           Sound.play_battler_se(@active_battler.actor_id, 12, 1, false)
  466.         else
  467.           Sound.play_battler_se(@active_battler.enemy_id, 12, 2, false)
  468.         end
  469.         return
  470.       end
  471.     end
  472.     return if targets.nitems == 0
  473.     unless targets.compact[0].actor?
  474.       if @active_battler.actor?
  475.         Sound.play_battler_se(@active_battler.actor_id, 6, 1, false)
  476.       else
  477.         Sound.play_battler_se(@active_battler.enemy_id, 7, 2, false)
  478.       end
  479.     else
  480.       if @active_battler.actor?
  481.         Sound.play_battler_se(@active_battler.actor_id, 7, 1, false)
  482.       else
  483.         Sound.play_battler_se(@active_battler.enemy_id, 6, 2, false)
  484.       end
  485.     end
  486.   end
  487.   alias display_animation_orig_rld_battler_se display_animation
  488.   def display_animation(targets, animation_id)
  489.     play_attack_if_ui_phy_atk
  490.     play_if_target_foe_or_ally_or_self(targets)
  491.     display_animation_orig_rld_battler_se(targets, animation_id)
  492.   end
  493.  
  494.   # Critical Hit(8)
  495.   alias display_critical_orig_rld_battler_se display_critical
  496.   def display_critical(target, obj = nil)
  497.     if target.critical
  498.       if @active_battler.actor?
  499.         Sound.play_battler_se(@active_battler.actor_id, 8, 1, false)
  500.       else
  501.         Sound.play_battler_se(@active_battler.enemy_id, 8, 2, false)
  502.       end
  503.     end
  504.     display_critical_orig_rld_battler_se(target, obj = nil)
  505.   end
  506.  
  507.   # Miss(9)
  508.   alias display_miss_orig_rld_battler_se display_miss
  509.   def display_miss(target, obj = nil)
  510.     if obj == nil or obj.physical_attack
  511.       if @active_battler.actor?
  512.         Sound.play_battler_se(@active_battler.actor_id, 9, 1, true)
  513.       else
  514.         Sound.play_battler_se(@active_battler.enemy_id, 9, 2, true)
  515.       end
  516.     end
  517.     display_miss_orig_rld_battler_se(target, obj = nil)
  518.   end
  519.  
  520. end # class end
  521.  
  522. #
  523. # GAME_BATTLER CLASS
  524. #
  525. class Game_Battler
  526.  
  527.   # Low Health(11)
  528.   alias execute_damage_orig_rld_battler_se execute_damage
  529.   def execute_damage(user)
  530.     max_hp_b = maxhp
  531.     hp_b = self.hp
  532.     execute_damage_orig_rld_battler_se(user)
  533.     max_hp_a = maxhp
  534.     hp_a = self.hp
  535.     ratio_b = hp_b.to_f / max_hp_b.to_f
  536.     ratio_a = hp_a.to_f / max_hp_a.to_f
  537.     #print ratio_b.inspect + ":ratio_b    " + ratio_a.inspect + ":ratio_a"
  538.     lowh_percent = Rockleedude::Battler_SE::LOW_HEALTH_PERCENTAGE
  539.     unless hp_a <= 0
  540.       if lowh_percent.between?(0.0, 100.0)
  541.         lowh_percent = lowh_percent.to_f / 100.0
  542.         if ratio_b > lowh_percent
  543.           if ratio_a < lowh_percent
  544.             if self.actor?
  545.               Sound.play_battler_se(self.actor_id, 11, 1, false)
  546.             else
  547.               Sound.play_battler_se(self.enemy_id, 11, 2, false)
  548.             end
  549.           end
  550.         end
  551.       end
  552.     end
  553.   end
  554.  
  555. end # class end
  556.  
  557. #
  558. # GAME_ACTOR CLASS
  559. #
  560.  
  561. class Game_Actor < Game_Battler
  562.   attr_accessor :battler_se_note
  563.  
  564.   alias perform_collapse_orig_rld_battler_se perform_collapse
  565.   def perform_collapse
  566.     Sound.play_battler_se(@actor_id, 10, 1, true) if $game_temp.in_battle and dead?
  567.     perform_collapse_orig_rld_battler_se
  568.   end
  569.  
  570.   def actor_id
  571.     return @actor_id
  572.   end
  573.  
  574.   alias setup_orig_battler_se setup
  575.   def setup(actor_id)
  576.     setup_orig_battler_se(actor_id)
  577.     @battler_se_note = Rockleedude::Battler_SE::ACTOR_SE_SETUP
  578.   end
  579.  
  580. end # class end
  581.  
  582. #
  583. # GAME_ENEMY CLASS
  584. #
  585. class Game_Enemy < Game_Battler
  586.   alias perform_collapse_orig_rld_battler_se perform_collapse
  587.   def perform_collapse
  588.     Sound.play_battler_se(@enemy_id, 10, 2, true) if $game_temp.in_battle and dead?
  589.     perform_collapse_orig_rld_battler_se
  590.   end
  591.  
  592. end # class end
  593.  
  594. #
  595. # ACTOR CLASS
  596. #
  597. class RPG::Actor
  598.   attr_accessor :battler_se_note
  599.  
  600.   # Battler Receiving
  601.   attr_accessor :take_damage_se
  602.   attr_accessor :recover_damage_se
  603.   attr_accessor :evade_se
  604.   attr_accessor :plus_state_se
  605.   attr_accessor :minus_state_se
  606.  
  607.   # Battler Delivering
  608.   attr_accessor :attack_se
  609.   attr_accessor :target_foe_se
  610.   attr_accessor :target_ally_se
  611.   attr_accessor :critical_hit_se
  612.   attr_accessor :miss_se
  613.  
  614.   # Random Conditions
  615.   attr_accessor :death_se
  616.   attr_accessor :low_health_se
  617.   attr_accessor :self_se
  618.  
  619.   def gsub_without_md(string)
  620.     string.gsub!(/ /i, "")
  621.     string.gsub!(/_/i, "")
  622.     return string
  623.   end
  624.  
  625.   def prepare_se_cache
  626.     # Battler Receiving
  627.     @take_damage_se = []
  628.     @recover_damage_se = []
  629.     @evade_se = []
  630.     @plus_state_se = []
  631.     @minus_state_se = []
  632.    
  633.     # Battler Delivering
  634.     @attack_se = []
  635.     @target_foe_se = []
  636.     @target_ally_se = []
  637.     @critical_hit_se = []
  638.     @miss_se = []
  639.    
  640.     # Random Conditions
  641.     @death_se = []
  642.     @low_health_se = []
  643.     @self_se = []
  644.  
  645.     a = Rockleedude::Battler_SE::ACTOR_SE_SETUP[@id]
  646.     @battler_se_note = ""
  647.     @battler_se_note = a if a != nil
  648.   end
  649.  
  650.   def create_se_cache
  651.     prepare_se_cache
  652.     dv = Rockleedude::Battler_SE::DEFAULT_VOLUME
  653.     dp = Rockleedude::Battler_SE::DEFAULT_PITCH
  654.     self.battler_se_note.split(/[\r\n]+/).each { |line|
  655.     case line
  656.     when Rockleedude::Battler_SE::BATTLER_SE
  657.       type = $1
  658.       type.upcase! unless $1 == nil
  659.       type = gsub_without_md(type) unless $1 == nil
  660.       case type
  661.       when "TAKE"
  662.         se = RPG::SE.new($2, dv, dp)
  663.         se.volume = $3 if $3 != nil
  664.         se.volume = se.volume[1,3].to_i if $3.class == String
  665.         se.pitch = $4 if $4 != nil
  666.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  667.         @take_damage_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  668.       when "RECOVER"
  669.         se = RPG::SE.new($2, dv, dp)
  670.         se.volume = $3 if $3 != nil
  671.         se.volume = se.volume[1,3].to_i if $3.class == String
  672.         se.pitch = $4 if $4 != nil
  673.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  674.         @recover_damage_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"  
  675.       when "EVADE"
  676.         se = RPG::SE.new($2, dv, dp)
  677.         se.volume = $3 if $3 != nil
  678.         se.volume = se.volume[1,3].to_i if $3.class == String
  679.         se.pitch = $4 if $4 != nil
  680.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  681.         @evade_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  682.       when "PLUSSTATE"
  683.         se = RPG::SE.new($2, dv, dp)
  684.         se.volume = $3 if $3 != nil
  685.         se.volume = se.volume[1,3].to_i if $3.class == String
  686.         se.pitch = $4 if $4 != nil
  687.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  688.         @plus_state_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  689.       when "MINUSSTATE"
  690.         se = RPG::SE.new($2, dv, dp)
  691.         se.volume = $3 if $3 != nil
  692.         se.volume = se.volume[1,3].to_i if $3.class == String
  693.         se.pitch = $4 if $4 != nil
  694.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  695.         @minus_state_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  696.       when "ATTACK"
  697.         se = RPG::SE.new($2, dv, dp)
  698.         se.volume = $3 if $3 != nil
  699.         se.volume = se.volume[1,3].to_i if $3.class == String
  700.         se.pitch = $4 if $4 != nil
  701.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  702.         @attack_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  703.       when "TARGETFOE"
  704.         se = RPG::SE.new($2, dv, dp)
  705.         se.volume = $3 if $3 != nil
  706.         se.volume = se.volume[1,3].to_i if $3.class == String
  707.         se.pitch = $4 if $4 != nil
  708.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  709.         @target_foe_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  710.       when "TARGETALLY"
  711.         se = RPG::SE.new($2, dv, dp)
  712.         se.volume = $3 if $3 != nil
  713.         se.volume = se.volume[1,3].to_i if $3.class == String
  714.         se.pitch = $4 if $4 != nil
  715.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  716.         @target_ally_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  717.       when "CRITICALHIT"
  718.         se = RPG::SE.new($2, dv, dp)
  719.         se.volume = $3 if $3 != nil
  720.         se.volume = se.volume[1,3].to_i if $3.class == String
  721.         se.pitch = $4 if $4 != nil
  722.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  723.         @critical_hit_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  724.       when "MISS"
  725.         se = RPG::SE.new($2, dv, dp)
  726.         se.volume = $3 if $3 != nil
  727.         se.volume = se.volume[1,3].to_i if $3.class == String
  728.         se.pitch = $4 if $4 != nil
  729.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  730.         @miss_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  731.       when "DEATH"
  732.         se = RPG::SE.new($2, dv, dp)
  733.         se.volume = $3 if $3 != nil
  734.         se.volume = se.volume[1,3].to_i if $3.class == String
  735.         se.pitch = $4 if $4 != nil
  736.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  737.         @death_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  738.       when "LOWHEALTH"
  739.         se = RPG::SE.new($2, dv, dp)
  740.         se.volume = $3 if $3 != nil
  741.         se.volume = se.volume[1,3].to_i if $3.class == String
  742.         se.pitch = $4 if $4 != nil
  743.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  744.         @low_health_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  745.       when "SELF"
  746.         se = RPG::SE.new($2, dv, dp)
  747.         se.volume = $3 if $3 != nil
  748.         se.volume = se.volume[1,3].to_i if $3.class == String
  749.         se.pitch = $4 if $4 != nil
  750.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  751.         @self_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  752.       end
  753.     end
  754.     case line
  755.     when Rockleedude::Battler_SE::BATTLER_SE_PLAYNOTHING
  756.       type = $1
  757.       type.upcase! unless $1 == nil
  758.       type.gsub!(/ /i, "") unless $1 == nil
  759.       case type
  760.       when "TAKE"
  761.         @take_damage_se.insert(0, "PLAYNOTHING")
  762.       when "RECOVER"
  763.         @recover_damage_se.insert(0, "PLAYNOTHING")  
  764.       when "EVADE"
  765.         @evade_se.insert(0, "PLAYNOTHING")
  766.       when "PLUSSTATE"
  767.         @plus_state_se.insert(0, "PLAYNOTHING")
  768.       when "MINUSSTATE"
  769.         @minus_state_se.insert(0, "PLAYNOTHING")
  770.       when "ATTACK"
  771.         @attack_se.insert(0, "PLAYNOTHING")
  772.       when "TARGETFOE"
  773.         @target_foe_se.insert(0, "PLAYNOTHING")
  774.       when "TARGETALLY"
  775.         @target_ally_se.insert(0, "PLAYNOTHING")
  776.       when "CRITICALHIT"
  777.         @critical_hit_se.insert(0, "PLAYNOTHING")
  778.       when "MISS"
  779.         @miss_se.insert(0, "PLAYNOTHING")
  780.       when "DEATH"
  781.         @death_se.insert(0, "PLAYNOTHING")
  782.       when "LOWHEALTH"
  783.         @low_health_se.insert(0, "PLAYNOTHING")
  784.       when "SELF"
  785.         @self_se.insert(0, "PLAYNOTHING")
  786.       end
  787.     end
  788.     }
  789.   end
  790.  
  791. end # class end
  792.  
  793. #
  794. # ENEMY CLASS
  795. #
  796. class RPG::Enemy
  797.   # Battler Receiving
  798.   attr_accessor :take_damage_se
  799.   attr_accessor :recover_damage_se
  800.   attr_accessor :evade_se
  801.   attr_accessor :plus_state_se
  802.   attr_accessor :minus_state_se
  803.  
  804.   # Battler Delivering
  805.   attr_accessor :attack_se
  806.   attr_accessor :target_foe_se
  807.   attr_accessor :target_ally_se
  808.   attr_accessor :critical_hit_se
  809.   attr_accessor :miss_se
  810.  
  811.   # Random Conditions
  812.   attr_accessor :death_se
  813.   attr_accessor :low_health_se
  814.   attr_accessor :self_se
  815.  
  816.   def gsub_without_md(string)
  817.     string.gsub!(/ /i, "")
  818.     string.gsub!(/_/i, "")
  819.     return string
  820.   end
  821.  
  822.   def prepare_se_cache
  823.     # Battler Receiving
  824.     @take_damage_se = []
  825.     @recover_damage_se = []
  826.     @evade_se = []
  827.     @plus_state_se = []
  828.     @minus_state_se = []
  829.    
  830.     # Battler Delivering
  831.     @attack_se = []
  832.     @target_foe_se = []
  833.     @target_ally_se = []
  834.     @critical_hit_se = []
  835.     @miss_se = []
  836.    
  837.     # Random Conditions
  838.     @death_se = []
  839.     @low_health_se = []
  840.     @self_se = []
  841.   end
  842.  
  843.   def create_se_cache
  844.     prepare_se_cache
  845.     dv = Rockleedude::Battler_SE::DEFAULT_VOLUME
  846.     dp = Rockleedude::Battler_SE::DEFAULT_PITCH
  847.     self.note.split(/[\r\n]+/).each { |line|
  848.     case line
  849.     when Rockleedude::Battler_SE::BATTLER_SE
  850.       type = $1
  851.       type.upcase! unless $1 == nil
  852.       type = gsub_without_md(type) unless $1 == nil
  853.       case type
  854.       when "TAKE"
  855.         se = RPG::SE.new($2, dv, dp)
  856.         se.volume = $3 if $3 != nil
  857.         se.volume = se.volume[1,3].to_i if $3.class == String
  858.         se.pitch = $4 if $4 != nil
  859.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  860.         @take_damage_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  861.       when "RECOVER"
  862.         se = RPG::SE.new($2, dv, dp)
  863.         se.volume = $3 if $3 != nil
  864.         se.volume = se.volume[1,3].to_i if $3.class == String
  865.         se.pitch = $4 if $4 != nil
  866.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  867.         @recover_damage_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"  
  868.       when "EVADE"
  869.         se = RPG::SE.new($2, dv, dp)
  870.         se.volume = $3 if $3 != nil
  871.         se.volume = se.volume[1,3].to_i if $3.class == String
  872.         se.pitch = $4 if $4 != nil
  873.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  874.         @evade_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  875.       when "PLUSSTATE"
  876.         se = RPG::SE.new($2, dv, dp)
  877.         se.volume = $3 if $3 != nil
  878.         se.volume = se.volume[1,3].to_i if $3.class == String
  879.         se.pitch = $4 if $4 != nil
  880.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  881.         @plus_state_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  882.       when "MINUSSTATE"
  883.         se = RPG::SE.new($2, dv, dp)
  884.         se.volume = $3 if $3 != nil
  885.         se.volume = se.volume[1,3].to_i if $3.class == String
  886.         se.pitch = $4 if $4 != nil
  887.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  888.         @minus_state_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  889.       when "ATTACK"
  890.         se = RPG::SE.new($2, dv, dp)
  891.         se.volume = $3 if $3 != nil
  892.         se.volume = se.volume[1,3].to_i if $3.class == String
  893.         se.pitch = $4 if $4 != nil
  894.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  895.         @attack_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  896.       when "TARGETFOE"
  897.         se = RPG::SE.new($2, dv, dp)
  898.         se.volume = $3 if $3 != nil
  899.         se.volume = se.volume[1,3].to_i if $3.class == String
  900.         se.pitch = $4 if $4 != nil
  901.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  902.         @target_foe_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  903.       when "TARGETALLY"
  904.         se = RPG::SE.new($2, dv, dp)
  905.         se.volume = $3 if $3 != nil
  906.         se.volume = se.volume[1,3].to_i if $3.class == String
  907.         se.pitch = $4 if $4 != nil
  908.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  909.         @target_ally_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  910.       when "CRITICALHIT"
  911.         se = RPG::SE.new($2, dv, dp)
  912.         se.volume = $3 if $3 != nil
  913.         se.volume = se.volume[1,3].to_i if $3.class == String
  914.         se.pitch = $4 if $4 != nil
  915.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  916.         @critical_hit_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  917.       when "MISS"
  918.         se = RPG::SE.new($2, dv, dp)
  919.         se.volume = $3 if $3 != nil
  920.         se.volume = se.volume[1,3].to_i if $3.class == String
  921.         se.pitch = $4 if $4 != nil
  922.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  923.         @miss_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  924.       when "DEATH"
  925.         se = RPG::SE.new($2, dv, dp)
  926.         se.volume = $3 if $3 != nil
  927.         se.volume = se.volume[1,3].to_i if $3.class == String
  928.         se.pitch = $4 if $4 != nil
  929.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  930.         @death_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  931.       when "LOWHEALTH"
  932.         se = RPG::SE.new($2, dv, dp)
  933.         se.volume = $3 if $3 != nil
  934.         se.volume = se.volume[1,3].to_i if $3.class == String
  935.         se.pitch = $4 if $4 != nil
  936.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  937.         @low_health_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  938.       when "SELF"
  939.         se = RPG::SE.new($2, dv, dp)
  940.         se.volume = $3 if $3 != nil
  941.         se.volume = se.volume[1,3].to_i if $3.class == String
  942.         se.pitch = $4 if $4 != nil
  943.         se.pitch = se.pitch[1,3].to_i if $4.class == String
  944.         @self_se.insert(0, se) if se.name.upcase != "PLAYNOTHING"
  945.       end
  946.     end
  947.     case line
  948.     when Rockleedude::Battler_SE::BATTLER_SE_PLAYNOTHING
  949.       type = $1
  950.       type.upcase! unless $1 == nil
  951.       type.gsub!(/ /i, "") unless $1 == nil
  952.       case type
  953.       when "TAKE"
  954.         @take_damage_se.insert(0, "PLAYNOTHING")
  955.       when "RECOVER"
  956.         @recover_damage_se.insert(0, "PLAYNOTHING")  
  957.       when "EVADE"
  958.         @evade_se.insert(0, "PLAYNOTHING")
  959.       when "PLUSSTATE"
  960.         @plus_state_se.insert(0, "PLAYNOTHING")
  961.       when "MINUSSTATE"
  962.         @minus_state_se.insert(0, "PLAYNOTHING")
  963.       when "ATTACK"
  964.         @attack_se.insert(0, "PLAYNOTHING")
  965.       when "TARGETFOE"
  966.         @target_foe_se.insert(0, "PLAYNOTHING")
  967.       when "TARGETALLY"
  968.         @target_ally_se.insert(0, "PLAYNOTHING")
  969.       when "CRITICALHIT"
  970.         @critical_hit_se.insert(0, "PLAYNOTHING")
  971.       when "MISS"
  972.         @miss_se.insert(0, "PLAYNOTHING")
  973.       when "DEATH"
  974.         @death_se.insert(0, "PLAYNOTHING")
  975.       when "LOWHEALTH"
  976.         @low_health_se.insert(0, "PLAYNOTHING")
  977.       when "SELF"
  978.         @self_se.insert(0, "PLAYNOTHING")
  979.       end
  980.     end
  981.     }
  982.   end
  983.  
  984. end # class end
  985.  
  986. #
  987. # SCENE_TITLE CLASS
  988. #
  989. class Scene_Title < Scene_Base
  990.  
  991.   alias load_database_orig_rld_battler_se load_database
  992.   def load_database
  993.     load_database_orig_rld_battler_se
  994.     load_battler_se
  995.   end
  996.  
  997.   alias load_bt_database_orig_rld_battler_se load_bt_database
  998.   def load_bt_database
  999.     load_bt_database_orig_rld_battler_se
  1000.     load_battler_se
  1001.   end
  1002.  
  1003.   def load_battler_se
  1004.     n = 0
  1005.     $data_actor_se = []
  1006.     $data_enemy_se = []
  1007.    
  1008.  # Actor SE's  
  1009.     for actor in $data_actors
  1010.       next if actor == nil
  1011.       actor.create_se_cache
  1012.       take = actor.take_damage_se
  1013.       recover = actor.recover_damage_se
  1014.       evade = actor.evade_se
  1015.       plusstate = actor.plus_state_se
  1016.       minusstate = actor.minus_state_se
  1017.       attack = actor.attack_se
  1018.       targetfoe = actor.target_foe_se
  1019.       targetally = actor.target_ally_se
  1020.       criticalhit = actor.critical_hit_se
  1021.       miss = actor.miss_se
  1022.       death = actor.death_se
  1023.       lowhealth = actor.low_health_se
  1024.       selfse = actor.self_se
  1025.       $data_actor_se[actor.id] = [take, recover, evade, plusstate, minusstate, attack, targetfoe, targetally, criticalhit, miss, death, lowhealth, selfse] #deal,
  1026.     end
  1027.    
  1028.   # Enemy SE's
  1029.     for enemy in $data_enemies
  1030.       next if enemy == nil
  1031.       enemy.create_se_cache
  1032.       take = enemy.take_damage_se
  1033.       recover = enemy.recover_damage_se
  1034.       evade = enemy.evade_se
  1035.       plusstate = enemy.plus_state_se
  1036.       minusstate = enemy.minus_state_se
  1037.       attack = enemy.attack_se
  1038.       targetfoe = enemy.target_foe_se
  1039.       targetally = enemy.target_ally_se
  1040.       criticalhit = enemy.critical_hit_se
  1041.       miss = enemy.miss_se
  1042.       death = enemy.death_se
  1043.       lowhealth = enemy.low_health_se
  1044.       selfse = enemy.self_se
  1045.       $data_enemy_se[enemy.id] = [take, recover, evade, plusstate, minusstate, attack, targetfoe, targetally, criticalhit, miss, death, lowhealth, selfse] #deal,
  1046.     end
  1047.   end
  1048.  
  1049. end # class end
Expand to see the code.

Battle Cry Spoiler
  1. #=======================================================================
  2. # Battle Cry VX         version 1.00
  3. #-----------------------------------------------------------------------
  4. # Function:
  5. #  Plays user configured battle cries for characters at the start
  6. #  of battle and at the end of battle.  
  7. #  Pre-battle cries are selected by the difficulty of the enemy
  8. #  troop, and post-battle cries are selected by the remaining
  9. #  hp percentage of the actor that scored the final blow.
  10. #
  11. # Compatibility:
  12. #  This script -should- be compatible with other custom battle scripts
  13. #  but compatibility has not as of yet been tested.
  14. #
  15. # Instructions:
  16. #  Simply configure the arrays of actor sounds in the case statements
  17. #  More detailed instructions will be given in the respective areas.
  18. #  Only skills truly needed are typing, copy, and paste.
  19. #-----------------------------------------------------------------------
  20. # Contact:
  21. #  Should you encounter a bug or incompatibility with this script,
  22. #  e-mail NAMKCOR at [email hidden], or message at
  23. #  http://www.rmrk.net or http://forum.chaos-project.com
  24. #
  25. # This script was designed for use and distribution only on
  26. # The RPG Maker Resource Kit (RMRK) and Chaos Project.
  27. # If this script is found posted on any other website, it is STOLEN
  28. # and it is advised to contact NAMKCOR at the above methods.
  29. #
  30. # This script is -strictly- for NON-commercial purposes.  Please
  31. # credit NAMKCOR for the creation of this script if you use it.
  32. #=======================================================================
  33.  
  34. module NAMKCOR
  35.  
  36.   #=======================================================================
  37.   # volume: simply set the return value to be equal to the volume
  38.   #         you want the battlecries to be played at
  39.   #=======================================================================
  40.   def self.volume
  41.     return 100
  42.   end
  43.  
  44.   #=======================================================================
  45.   # battle_range: set the return value to be how many levels above or
  46.   #               below the enemy for easy/difficult battles.
  47.   #=======================================================================
  48.   def self.battle_range
  49.     return 5
  50.   end
  51.  
  52.   #=======================================================================
  53.   # mid_hp: set the return value to be the percentage of hitpoints that
  54.   #         is the -minimum- value for being in 'middle' hp range.
  55.   #=======================================================================
  56.   def self.mid_hp
  57.     return 35
  58.   end
  59.  
  60.   #=======================================================================
  61.   # high_hp: set the return value to be the percentage of hitpoints that
  62.   #         is the -minimum- value for being in 'high' hp range.
  63.   #=======================================================================
  64.   def self.high_hp
  65.     return 75
  66.   end
  67.  
  68.   #=======================================================================
  69.   # bosses: to add a boss, simply create a "when" clause for the
  70.   #         troop id, and set the 'return' value to 'true'
  71.   #         do not touch the 'else' clause
  72.   # example:
  73.   #          when 5
  74.   #            return true
  75.   #=======================================================================
  76.   def self.bosses(id)
  77.     case id
  78.     when 3
  79.       return true
  80.     else
  81.       return false
  82.     end
  83.   end
  84.  
  85.   #=======================================================================
  86.   # troop_level: to set a troop level, create a "when" clause for the
  87.   #              troop id, and set the 'return' value to be the level
  88.   #              desired.  do not touch the 'else' clause.
  89.   #              THERE MUST BE AN ENTRY FOR EVERY TROOP IN THE DATABASE
  90.   # example:
  91.   #          when 5
  92.   #              return 3
  93.   #=======================================================================
  94.   def self.troop_level(id)
  95.     case id
  96.     when 1
  97.       return 1
  98.     when 2
  99.       return 5
  100.     when 3
  101.       return 10
  102.     else
  103.       return 0
  104.     end
  105.   end
  106.  
  107.   #=======================================================================
  108.   # start_battlecry: to add a new actor's set of battlecries to the
  109.   #                  listing, create a "when" clause for the actor's id
  110.   #                  and the return value to an array, configured as follows.
  111.   # array config: ["easy_battle_se", "normal_battle_se", "hard_battle_se",
  112.   #                "boss_battle_se"]
  113.   #                the values in "" are the names of the sound files.
  114.   #                ALL SOUND FILES MUST BE PLACED IN 'AUDIO/Battlecry'
  115.   #                
  116.   # Suggestion: for organization's sake, try naming the files by actor id
  117.   #                            
  118.   # example:
  119.   #          when 3
  120.   #              return ["easy","normal","hard","boss"]
  121.   #=======================================================================
  122.   def self.start_battlecry(id)
  123.     case id
  124.     when 1
  125.       return ["rebecca_battlestart_easy", "rebecca_battlestart_normal",
  126.               "rebecca_battlestart_hard", "rebecca_battlestart_boss"]
  127.     when 2
  128.       return ["oracle_battlestart_easy", "oracle_battlestart_normal",
  129.               "oracle_battlestart_hard", "oracle_battlestart_boss"]
  130.     when 3
  131.       return ["irial_battlestart_easy", "irial_battlestart_normal",
  132.               "irial_battlestart_hard", "irial_battlestart_boss"]
  133.     when 4
  134.       return ["jareth_battlestart_easy", "jareth_battlestart_normal",
  135.               "jareth_battlestart_hard", "jareth_battlestart_boss"]
  136.     else
  137.       return nil
  138.     end
  139.   end
  140.  
  141.   #=======================================================================
  142.   # victory_battlecry: to add a new actor's set of battlecries to the
  143.   #                  listing, create a "when" clause for the actor's id
  144.   #                  and the return value to an array, configured as follows.
  145.   # array config: ["highHP_win", "normalHP_win", "lowHP_win"]
  146.   #                the values in "" are the names of the sound files.
  147.   #                ALL SOUND FILES MUST BE PLACED IN 'AUDIO/Battlecry'
  148.   #                
  149.   # Suggestion: for organization's sake, try naming the files by actor id
  150.   #                            
  151.   # example:
  152.   #          when 3
  153.   #              return ["high","normal","hurting"]
  154.   #=======================================================================
  155.   def self.victory_battlecry(id)
  156.     case id
  157.     when 1
  158.       return ["rebecca_battleend_easy", "rebecca_battleend_normal",
  159.               "rebecca_battleend_hard"]
  160.     when 2
  161.       return ["oracle_battleend_easy", "oracle_battleend_normal",
  162.               "oracle_battleend_hard"]
  163.     when 3
  164.       return ["irial_battleend_easy", "irial_battleend_normal",
  165.               "irial_battleend_hard"]
  166.     when 4
  167.       return ["jareth_battleend_easy", "jareth_battleend_normal",
  168.               "jareth_battleend_hard"]
  169.     else
  170.       return nil
  171.     end
  172.   end
  173.  
  174. end
  175.  
  176. #=======================================================================
  177. # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
  178. #=======================================================================
  179. class Game_Troop < Game_Unit
  180.   def id
  181.     return @troop_id
  182.   end
  183. end
  184.  
  185. class Scene_Battle < Scene_Base
  186.  
  187.   alias :old_start :start
  188.   def start
  189.     old_start
  190.     @id = $game_party.members[rand($game_party.members.size)]
  191.     if NAMKCOR.bosses($game_troop.id) == true
  192.       @type = 3
  193.     else
  194.       if (@id.level + NAMKCOR.battle_range) <= NAMKCOR.troop_level($game_troop.id)
  195.         @type = 2
  196.       elsif (@id.level - NAMKCOR.battle_range) >= NAMKCOR.troop_level($game_troop.id)
  197.         @type = 0
  198.       else
  199.         @type = 1
  200.       end
  201.     end
  202.     @bcArray = NAMKCOR.start_battlecry(@id.id)
  203.     if @bcArray[@type] != nil
  204.       Audio.se_play("Audio/SE/" + @bcArray[@type], NAMKCOR.volume, 0)
  205.     end
  206.   end
  207.  
  208.   alias :old_victory :process_victory
  209.   def process_victory
  210.     @hp_percent = (@active_battler.hp / @active_battler.maxhp) * 100
  211.     if @hp_percent < NAMKCOR.mid_hp
  212.       @hp_state = 2
  213.     elsif @hp_percent > NAMKCOR.high_hp
  214.       @hp_state = 1
  215.     else
  216.       @hp_state = 0
  217.     end
  218.     @bcArray = NAMKCOR.victory_battlecry(@active_battler.id)
  219.     if @bcArray[@hp_state] != nil
  220.       Audio.se_play("Audio/SE/" + @bcArray[@hp_state], NAMKCOR.volume, 0)
  221.     end
  222.     old_victory
  223.   end
  224. end
Expand to see the code.


If this one can be done another way in VXA, then I would appreciate it if someone could let me know. Otherwise, I'd like this converted as well:

Wereform Spoiler
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - Wereforms
  4. # Last Date Updated: 2010.06.08
  5. # Level: Normal
  6. #
  7. # Lets actors temporarily "transform" into other forms. These new forms take on
  8. # the skillsets of enemies in the database. Actors will revert back to their
  9. # normal skillsets once outside of battle.
  10. #===============================================================================
  11. # Instructions
  12. # -----------------------------------------------------------------------------
  13. # To install this script, open up your script editor and copy/paste this script
  14. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  15. #
  16. # Place this in an item or skill notebox.
  17. #
  18. # <wereform: x>
  19. # This will transform the using actor's skillset into enemy x's skillset. Only
  20. # works in battle as the actor reverts outside of battle.
  21. #
  22. # <wereimage: string, x>
  23. # If this tag is used, then the actor's image will also change when the actor
  24. # transforms into its wereform. This will be reverted at the end of battle. In
  25. # order for this to work, the next tag must also be used.
  26. #
  27. # <wereface: string, x>
  28. # If this tag is used, then the actor's face will also change when the actor
  29. # transforms into its wereform. This will be reverted at the end of battle. In
  30. # order for this to work, the previous tag must also be used.
  31. #
  32. # <wereform revert>
  33. # If this tag is used and the actor is currently in a wereform, the actor will
  34. # revert back to its normal form.
  35. #===============================================================================
  36.  
  37. $imported = {} if $imported == nil
  38. $imported["Wereforms"] = true
  39.  
  40. #==============================================================================
  41. # RPG::UsableItem
  42. #==============================================================================
  43.  
  44. class RPG::UsableItem < RPG::BaseItem
  45.   #--------------------------------------------------------------------------
  46.   # # Wereform
  47.   #--------------------------------------------------------------------------
  48.   def wereform
  49.     return @wereform if @wereform != nil
  50.     @wereform = 0
  51.     self.note.split(/[\r\n]+/).each { |line|
  52.       case line
  53.       when /<(?:WEREFORM|metamorph):[ ](\d+)>/i
  54.         @wereform = $1.to_i
  55.       end
  56.     }
  57.     return @wereform
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # # Wereform Image
  61.   #--------------------------------------------------------------------------
  62.   def wereform_image
  63.     return @wereform_image if @wereform_image != nil
  64.     @wereform_image = [nil, 0]
  65.     self.note.split(/[\r\n]+/).each { |line|
  66.       case line
  67.       when /<(?:WEREIMAGE|morphimage):[ ](.*),[ ](\d+)>/i
  68.         @wereform_image[0] = $1.to_s
  69.         @wereform_image[1] = $2.to_i
  70.       end
  71.     }
  72.     return @wereform_image
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # # Wereform Face
  76.   #--------------------------------------------------------------------------
  77.   def wereform_face
  78.     return @wereform_face if @wereform_face != nil
  79.     @wereform_face = [nil, 0]
  80.     self.note.split(/[\r\n]+/).each { |line|
  81.       case line
  82.       when /<(?:WEREFACE|morphface):[ ](.*),[ ](\d+)>/i
  83.         @wereform_face[0] = $1.to_s
  84.         @wereform_face[1] = $2.to_i
  85.       end
  86.     }
  87.     return @wereform_face
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # # Wereform Revert
  91.   #--------------------------------------------------------------------------
  92.   def wereform_revert
  93.     return @wereform_revert if @wereform_revert != nil
  94.     @wereform_revert = false
  95.     self.note.split(/[\r\n]+/).each { |line|
  96.       case line
  97.       when /<(?:WEREFORM REVERT|metamorph revert)>/i
  98.         @wereform_revert = true
  99.       end
  100.     }
  101.     return @wereform_revert
  102.   end
  103. end
  104.  
  105. #==============================================================================
  106. # ** Game_Battler
  107. #==============================================================================
  108.  
  109. class Game_Battler
  110.   #--------------------------------------------------------------------------
  111.   # * Apply Skill Effects
  112.   #--------------------------------------------------------------------------
  113.   alias skill_effect_sss_wereform skill_effect unless $@
  114.   def skill_effect(user, skill)
  115.     skill_effect_sss_wereform(user, skill)
  116.     user.wereform_effect(skill)
  117.     user.clear_wereforms if skill.wereform_revert
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # * Apply Item Effects
  121.   #--------------------------------------------------------------------------
  122.   alias item_effect_sss_wereform item_effect unless $@
  123.   def item_effect(user, item)
  124.     item_effect_sss_wereform(user, item)
  125.     user.wereform_effect(item)
  126.     user.clear_wereforms if item.wereform_revert
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # * Wereform Effect
  130.   #--------------------------------------------------------------------------
  131.   def wereform_effect(obj)
  132.     return if obj.nil?
  133.     return unless actor?
  134.     return unless $game_temp.in_battle
  135.     return unless obj.wereform > 0
  136.     @wereform = obj.wereform
  137.     if @wereimage.nil?
  138.       @wereimage = @character_name
  139.       @wereindex = @character_index
  140.       @wereface  = @face_name
  141.       @werefndex = @face_index
  142.     end
  143.     if obj.wereform_image[0] != nil and obj.wereform_face[0] != nil
  144.       a1 = obj.wereform_image[0]
  145.       a2 = obj.wereform_image[1]
  146.       b1 = obj.wereform_face[0]
  147.       b2 = obj.wereform_face[1]
  148.       set_graphic(a1, a2, b1, b2)
  149.     end
  150.     if $imported["BattleEngineMelody"]
  151.       clear_battle_cache
  152.       clear_cooldowns
  153.       clear_limited_use
  154.     end
  155.   end
  156.   #--------------------------------------------------------------------------
  157.   # * Clear Wereforms
  158.   #--------------------------------------------------------------------------
  159.   def clear_wereforms
  160.     return if @wereform.nil?
  161.     @wereform = nil
  162.     unless @wereimage.nil?
  163.       set_graphic(@wereimage, @wereindex, @wereface, @werefndex)
  164.       @wereimage = nil
  165.       @wereindex = nil
  166.       @wereface  = nil
  167.       @werefndex = nil
  168.       $game_player.refresh
  169.     end
  170.     if $imported["BattleEngineMelody"]
  171.       clear_battle_cache
  172.       clear_cooldowns
  173.       clear_limited_use
  174.     end
  175.   end
  176. end
  177.  
  178. #==============================================================================
  179. # ** Game_Actor
  180. #==============================================================================
  181.  
  182. class Game_Actor < Game_Battler
  183.   #--------------------------------------------------------------------------
  184.   # * Get Skill Object Array
  185.   #--------------------------------------------------------------------------
  186.   alias skills_sss_wereform skills unless $@
  187.   def skills
  188.     if @wereform != nil and @wereform > 0
  189.       enemy = $data_enemies[@wereform]
  190.       return skills_sss_wereform if enemy.nil?
  191.       return enemy_skills(enemy)
  192.     else
  193.       return skills_sss_wereform
  194.     end
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # * Determine Usable Skills
  198.   #--------------------------------------------------------------------------
  199.   def skill_can_use?(skill)
  200.     return super(skill)
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # * Enemy Skills
  204.   #--------------------------------------------------------------------------
  205.   def enemy_skills(enemy)
  206.     result = []
  207.     for action in enemy.actions
  208.       next unless action.kind == 1
  209.       skill = $data_skills[action.skill_id]
  210.       result.push(skill) unless result.include?(skill)
  211.     end
  212.     result.sort! { |a,b| a.id <=> b.id }
  213.     return result.uniq
  214.   end
  215. end
  216.  
  217. #==============================================================================
  218. # ** Scene_Battle
  219. #==============================================================================
  220.  
  221. class Scene_Battle < Scene_Base
  222.   #--------------------------------------------------------------------------
  223.   # * Start processing
  224.   #--------------------------------------------------------------------------
  225.   alias start_sss_wereform start unless $@
  226.   def start
  227.     for member in $game_party.members do member.clear_wereforms end
  228.     start_sss_wereform
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # * End Battle
  232.   #--------------------------------------------------------------------------
  233.   alias battle_end_sss_wereform battle_end unless $@
  234.   def battle_end(result)
  235.     for member in $game_party.members do member.clear_wereforms end
  236.     battle_end_sss_wereform(result)
  237.   end
  238. end
  239.  
  240. #===============================================================================
  241. #
  242. # END OF FILE
  243. #
  244. #===============================================================================
Expand to see the code.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=76712