SHARE
TWEET

[RGSS] Blizz-ABS BattleCry

LiTTleDRAgo Oct 21st, 2011 (edited) 167 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Blizz ABS BattleCry
  3. # Version: 1.01
  4. # Author : LiTTleDRAgo
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  6.  
  7. module LiTTleDRAgo
  8.  
  9.   DISABLE_VOICE_SWITCH = 50  # Switch To Disable Actor Voice
  10.   VOLUME_VOICE         = 130 # Volume Actor Voice  
  11.  
  12.  
  13. #==============================================================================#
  14. #............................[ACTOR SOUND EFFECTS].............................#  
  15. #==============================================================================#
  16. # FORMAT: A=>["B","B","B","B"]                                                 #
  17. #                                                                              #
  18. # A = SKILL ID                                                                 #
  19. # B = Sound Effect played when actor uses that skill                           #
  20. #==============================================================================#
  21.   ACTOR_SKILL_VOICE = []
  22.  
  23.   ACTOR_SKILL_VOICE[1] = {
  24.   1=>["Z-Healing"],      
  25.   2=>["A_HealWall"],      
  26.   3=>["A_Renew"]
  27.   }
  28.    
  29.   ACTOR_SKILL_VOICE[2] = {}
  30.   ACTOR_SKILL_VOICE[3] = {}
  31.   ACTOR_SKILL_VOICE[4] = {}
  32.  
  33.   ACTOR_SKILL_VOICE[8] = {
  34.   1=>["S-Healing"]  
  35.   }
  36.  
  37.  
  38. #==============================================================================#
  39. # FORMAT: A=>["B","B","B","B"]                                                 #
  40. #                                                                              #
  41. # A = ACTOR ID (as listed in the ACTORS tab in the DATABASE)                   #
  42. # B = Sound Effect played when actors …                                        #
  43. #==============================================================================#
  44.   #.... attacks
  45.   ACTOR_ATTACK_VOICE = {
  46.   1=>["Z-Attack1","Z-Attack2","Z-Attack3"],
  47.   8=>["S-Attack1","S-Attack2","S-Attack3"]
  48.   }
  49.  
  50.   #.... injured
  51.   ACTOR_DAMAGE_VOICE = {
  52.   1=>["Z-Damage1","Z-Damage2","Z-Damage3"],
  53.   8=>["S-Damage01","S-Damage02","S-Damage03"]  
  54.   }
  55.  
  56.   #.... defeated / death
  57.   ACTOR_DEFEAT_VOICE = {
  58.   1=>["scream"],
  59.   8=>["screamF"]  
  60.   }
  61.  
  62. end
  63.  
  64.  
  65. ($imported ||= {})[:drg_blizz_abs_battlecry] = 1.01
  66.  
  67. #==============================================================================#
  68. #...............................[CONFIG END]...................................#
  69. #==============================================================================#
  70.  
  71.  
  72. if $BlizzABS && BlizzABS::VERSION >= 2.7
  73.   class Map_Battler
  74.     VOICE_SWITCH = LiTTleDRAgo::DISABLE_VOICE_SWITCH
  75.     DAMAGE_VOICE = LiTTleDRAgo::ACTOR_DAMAGE_VOICE
  76.     DEFEAT_VOICE = LiTTleDRAgo::ACTOR_DEFEAT_VOICE
  77.     ATTACK_VOICE = LiTTleDRAgo::ACTOR_ATTACK_VOICE
  78.     SKILL_VOICE  = LiTTleDRAgo::ACTOR_SKILL_VOICE
  79.  
  80.     alias use_skill_voice_earlier use_skill
  81.     def use_skill(skill,*args)
  82.       result = use_skill_voice_earlier(skill,*args)
  83.       check_voice(skill.id) if result && @battler.is_a?(Game_Actor)
  84.       return result
  85.     end
  86.    
  87.     alias use_attack_voice_earlier use_attack
  88.     def use_attack(*args)
  89.       result = use_attack_voice_earlier(*args)
  90.       check_voice if result && @battler.is_a?(Game_Actor)
  91.       return result
  92.     end
  93.  
  94.     alias action_voice_earlier action_effect
  95.     def action_effect(*args)
  96.       action_voice_earlier(*args)
  97.       voice_displayer(*args)
  98.     end
  99.    
  100.     def voice_displayer(*args)
  101.       if self.damage_done?
  102.         if @battler.is_a?(Game_Actor)
  103.           voice = (actor = @battler).hp > 0 ? DAMAGE_VOICE : DEFEAT_VOICE
  104.           if voice[actor.id] != nil
  105.             file = "#{voice[actor.id][rand(voice[actor.id].size)]}"
  106.             file && play_battlecry(file)
  107.           end
  108.         end
  109.       end
  110.     end
  111.    
  112.     def check_voice(v = nil)
  113.       if v && (voice = SKILL_VOICE)[(actor = @battler).id][v]
  114.         file = "#{voice[actor.id][v][rand(voice[actor.id][v].size)]}"
  115.       elsif v.nil? && (voice = ATTACK_VOICE)[(actor = @battler).id]
  116.         file = "#{voice[actor.id][rand(voice[actor.id].size)]}"
  117.       end
  118.       file && play_battlecry(file)
  119.     end
  120.    
  121.     def play_battlecry(filename)
  122.       return if $game_switches[VOICE_SWITCH]
  123.       file = RPG::AudioFile.new(filename,LiTTleDRAgo::VOLUME_VOICE ,100)
  124.       $game_system.se_stop
  125.       $game_system.se_play(file) rescue nil
  126.     end
  127.   end
  128. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top