Advertisement
AngryPacman

[VXA] Ambush BGMs

Feb 23rd, 2012
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.69 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Ambush BGMs (1.0)
  4. # 23/02/2012
  5. # By Pacman (inspired by modern algebra)
  6. # This script allows you to assign special BGMs for when the party is surprised
  7. # by an enemy troop or preemptively attacks an enemy troop. You can also change
  8. # the assigned BGM through a script call.
  9. # Use the script calls:
  10. # $game_system.preemptive_bbgm = "Name"
  11. # $game_system.surprise_bbgm = "Name"
  12. # To change, respectively, the preemptive or surprise BGMs to the music file
  13. # (in the BGM folder) "Name". You may set the initial BGMs in the configuration
  14. # below.
  15. #
  16. #===============================================================================
  17. #
  18. # START CONFIGURATION
  19.  
  20. module AMB_BGM  # Don't touch this.
  21.   PREEMPTIVE = "Battle2"  # Preemptive battle music.
  22.   SURPRISE = "Battle3"    # Surprise battle music.
  23. end             # Don't touch this.
  24.  
  25. #
  26. # END CONFIGURATION
  27. #
  28. #===============================================================================
  29.  
  30. #==============================================================================
  31. # ■ BattleManager
  32. #------------------------------------------------------------------------------
  33. #  戦闘の進行を管理するモジュールです。
  34. #==============================================================================
  35.  
  36. module BattleManager
  37.   class << self
  38.     alias ambush_bgms init_members
  39.     attr_reader :preemptive
  40.     attr_reader :surprise
  41.   end
  42. end
  43.  
  44. #==============================================================================
  45. # ■ Game_System
  46. #------------------------------------------------------------------------------
  47. #  システム周りのデータを扱うクラスです。セーブやメニューの禁止状態などを保存
  48. # します。このクラスのインスタンスは $game_system で参照されます。
  49. #==============================================================================
  50.  
  51. class Game_System
  52.   attr_accessor :preemptive_bbgm
  53.   attr_accessor :surprise_bbgm
  54.   alias ambush_bgms_init initialize
  55.   def initialize(*a)
  56.     @preemptive_bbgm = AMB_BGM::PREEMPTIVE
  57.     @surprise_bbgm = AMB_BGM::SURPRISE
  58.     ambush_bgms_init(*a)
  59.   end
  60.   alias ambush_bgms_bbgm battle_bgm
  61.   def battle_bgm(*a)
  62.     if BattleManager.preemptive
  63.       RPG::BGM.new(@preemptive_bbgm)
  64.     elsif BattleManager.surprise
  65.       RPG::BGM.new(@surprise_bbgm)
  66.     else
  67.       ambush_bgms_bbgm(*a)
  68.     end
  69.   end
  70. end
  71.  
  72. $imported ||= {}
  73. $imported[:pac_ambush_bgms]
  74.  
  75. #===============================================================================
  76. #
  77. # END OF SCRIPT
  78. #
  79. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement