Want more features on Pastebin? Sign Up, it's FREE!

Random Battle Themes ~ RGSS3

By: diamondandplatinum3 on Jul 22nd, 2012  |  syntax: Ruby  |  size: 4.30 KB  |  views: 436  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #==============================================================================
  2. #  Random Battle Themes
  3. #  Version: 1.0
  4. #  Author: DiamondandPlatinum3
  5. #  Date: July 23, 2012
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. #  Description:
  8. #    This script allows you to play a random battle theme upon starting a
  9. #    battle, it can be turned off before a boss battle via switch so that
  10. #    the appropriate battle them still plays for them.
  11. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  12. #------------------------------------------------------------------------------
  13. #  Instructions:
  14. #  
  15. #     - Just take a look at the editable region and modify things
  16. #       appropriately.
  17. #
  18. #==============================================================================
  19. module DiamondandPlatinum3
  20.   module RandomBattleThemes
  21.  
  22. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  23. #                                                        -=
  24. #                 Editable Region        ////            ==
  25. #                                                        =-
  26. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27.  
  28.   # Turn this switch on before a boss battle so that the
  29.   # music you actually want to play will play.
  30.   EVENT_SWITCH_ID = 10
  31.  
  32.  
  33.   THEMES_ARRAY   = [    # Don't touch this line
  34.   #============================================================
  35.   # You can add more battle themes / change the current ones
  36.   # or remove any you don't need. I'd like to think you can
  37.   # figure out what to do by looking at this so I'm not going
  38.   # to write lines of comment explaining it.
  39.   #
  40.   # Simply copy one line of code and paste it under the last,
  41.   # then edit it to add more battle themes.
  42.   # Otherwise simply delete one line of code to remove that
  43.   # battle theme.
  44.   #
  45.   # Battle Theme has to be in quotation marks (" ")
  46.   # And it has to be EXACT Filename.
  47.   #===========================================================
  48.  
  49.   # Battle Theme, Volume, Pitch
  50.   [ "Battle1",    100,    100 ], # The Info for One of the Random Battle Themes
  51.   [ "Battle2",    100,    100 ], # The Info for One of the Random Battle Themes
  52.   [ "Battle3",    100,    100 ], # The Info for One of the Random Battle Themes
  53.   [ "Battle4",    100,    100 ], # The Info for One of the Random Battle Themes
  54.   [ "Battle5",    100,    100 ], # The Info for One of the Random Battle Themes
  55.   [ "Battle6",    100,    100 ], # The Info for One of the Random Battle Themes
  56.   [ "Battle7",    100,    100 ], # The Info for One of the Random Battle Themes
  57.   [ "Battle8",    100,    100 ], # The Info for One of the Random Battle Themes
  58.   [ "Battle9",    100,    100 ], # The Info for One of the Random Battle Themes
  59.   [ "Town2",      100,    100 ], # The Info for One of the Random Battle Themes
  60.  
  61.  
  62. #===========================================================
  63. #                                           \/
  64. #               End of Editable Region      /\
  65. ]#                                          \/
  66. #===========================================================
  67. #---------------------------------------------------------
  68. # No touchie past here unless you know what you are
  69. # doing. Failure to heed this warning could cause your
  70. # computer to yell and scream at you.
  71. #
  72. # Edit at your own risk.
  73. #--------------------------------------------------------
  74.   end
  75. end
  76.  
  77.  
  78.  
  79.  
  80.  
  81. #==============================================================================
  82. # ** BattleManager
  83. #------------------------------------------------------------------------------
  84. #  This module manages battle progress.
  85. #==============================================================================
  86.  
  87. module BattleManager
  88.   #--------------------------------------------------------------------------
  89.   # * Overwritten Method: Play Battle BGM
  90.   #--------------------------------------------------------------------------
  91.   def self.play_battle_bgm
  92.     unless $game_switches[DiamondandPlatinum3::RandomBattleThemes::EVENT_SWITCH_ID]
  93.       randbttlnum = rand(DiamondandPlatinum3::RandomBattleThemes::THEMES_ARRAY.size)
  94.       RPG::BGM.new(*DiamondandPlatinum3::RandomBattleThemes::THEMES_ARRAY[randbttlnum]).play
  95.     else
  96.       $game_system.battle_bgm.play
  97.     end
  98.     RPG::BGS.stop
  99.   end
  100. end
clone this paste RAW Paste Data