molegato

command_bgm

Feb 22nd, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.22 KB | None | 0 0
  1. #==============================================================================
  2. # COMMAND_BGM
  3. # Author Molegato
  4. # Version 1.0
  5. #------------------------------------------------------------------------------
  6. # Just different musics for command selection and the turn itself
  7. #------------------------------------------------------------------------------
  8. # INSTRUCTIONS
  9. #
  10. # You need to set a default command and action bgm
  11. # You can set 'preconfs', wich are couples of command and action bgms
  12. # You can use the next script calls for selecting your battle bgm:
  13. #   $game_system.set_command_bgm  *this one for using the default value*
  14. #   $game_system.set_command_bgm(file name)
  15. #   $game_system.set_action_bgm   *this one for using the default value*
  16. #   $game_system.set_action_bgm(file name)
  17. #   $game_system.set_battle_music_preconf(preconf name)
  18. # The normal battle music selected from the database will play until the
  19. # party command window appears, so you can select an introduction bgm there,
  20. # or select 'none'
  21. #==============================================================================
  22.  
  23. $imported = {} if $imported.nil?
  24. $imported['Molegato-Command_bgm'] = true
  25.  
  26. #==============================================================================
  27. # CONFIGURATION, YOU CAN TOUCH THIS
  28. #==============================================================================
  29. module COMMAND_BGM
  30.   DEFAULT_COMMAND_BGM = "reflection_tension"
  31.   DEFAULT_ACTION_BGM = "reflection_rage"
  32.   PRECONFS = {}
  33.     PRECONFS["Normal"]=["battle_command_1","battle_action_1"]
  34.     PRECONFS["Boss"]=["Battle4","Battle8"]
  35. end
  36. #==============================================================================
  37. # END OF CONFIGURATION. EVERYTHING UNDER HERE IS A HELLISH MESS OF DEFICIENT
  38. # AMATEUR SCRIPTING. BE AWARE THAT MESSING WITH IT CAN RESULT IN DISASTER
  39. #==============================================================================
  40.  
  41.  
  42.  
  43. #==============================================================================
  44. # ■ Game_System
  45. #==============================================================================
  46. class Game_System
  47.  
  48.   def set_command_bgm(bgm=COMMAND_BGM::DEFAULT_COMMAND_BGM)
  49.     @command_bgm=bgm
  50.     return @command_bgm
  51.   end
  52.  
  53.   def set_action_bgm(bgm=COMMAND_BGM::DEFAULT_ACTION_BGM)
  54.     @action_bgm=bgm
  55.     return @action_bgm
  56.   end
  57.  
  58.   def set_battle_music_preconf(name)
  59.     set_command_bgm(COMMAND_BGM::PRECONFS[name][0])
  60.     set_action_bgm(COMMAND_BGM::PRECONFS[name][1])
  61.   end
  62.  
  63.   def play_command_bgm
  64.     RPG:: BGM.new( command_bgm ).play
  65.   end
  66.  
  67.   def play_action_bgm
  68.     RPG:: BGM.new( action_bgm ).play
  69.   end
  70.  
  71.   def command_bgm
  72.     if @command_bgm
  73.       return @command_bgm
  74.     else
  75.       return set_command_bgm()
  76.     end
  77.   end
  78.  
  79.   def action_bgm
  80.     if @action_bgm
  81.       return @action_bgm
  82.     else
  83.       return set_action_bgm()
  84.     end
  85.   end
  86.  
  87. end
  88.  
  89. #==============================================================================
  90. # ■ Scene_Map
  91. #==============================================================================
  92.  
  93. class Scene_Map < Scene_Base
  94.  
  95.   def pre_battle_scene
  96.     Graphics.update
  97.     Graphics.freeze
  98.     @spriteset.dispose_characters
  99.     BattleManager.save_bgm_and_bgs
  100.     BattleManager.play_battle_bgm
  101.     Sound.play_battle_start
  102.   end
  103.  
  104. end
  105.  
  106. #==============================================================================
  107. # ■ Scene_Battle
  108. #==============================================================================
  109.  
  110. class Scene_Battle < Scene_Base
  111.  
  112.   #--------------------------------------------------------------------------
  113.   # ● start_party_command_selection
  114.   #--------------------------------------------------------------------------
  115.   alias commandbgm_start_party_command_selection start_party_command_selection
  116.   def start_party_command_selection
  117.     commandbgm_start_party_command_selection
  118.     $game_system.play_command_bgm
  119.   end
  120.  
  121.   #--------------------------------------------------------------------------
  122.   # ● turn_start
  123.   #--------------------------------------------------------------------------
  124.   alias commandbgm_turn_start turn_start
  125.   def turn_start
  126.     commandbgm_turn_start
  127.     $game_system.play_action_bgm
  128.   end
  129.  
  130.  
  131. end
Advertisement
Add Comment
Please, Sign In to add comment