Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Script: Battle Music Control
- # By: Bgillisp, using code from DiamondandPlatium3's Ruby tutorials
- # Released: 10/21/2014
- # This code lets you turn off the battle music by turning a
- # switch off. Turn it on to return to the default.
- #
- # In addition, you can use the notetag:
- #
- # <Battle Theme: x>
- #
- # on a monster, and it will play that theme if the monster is in
- # the troop you are fighting. In the event of multiple tags,
- # the last found tag should be loaded
- # Make sure to spell the name of the theme exactly as it is in
- # the sound test and resource manager. Otherwise it will fail
- # to find it.
- # Terms of use: Since this script is mainly modified code
- # from DiamondandPlatium3's tutorial videos, I do not claim onwership
- # of the code, as all I did was put it all in one script to use.
- #
- # Therefore, the terms of use are the same as DiamondandPlatium3's
- # scripts, since it is based on his work. His terms of use can be
- # found here:
- #
- # http://www.diamondandplatinum3.net/rpg-maker-scripts/terms-of-use/
- #-----------------------------------------------------------------------
- #Editable Region
- module BGBattleMusic
- #Value of the switch to turn on when you want the battle music to play.
- BattleMusicSwitch = 101
- end
- #End of Editable Region
- #-----------------------------------------------------------------------
- #Do not edit anything below this line unless you know what you are doing.
- #Failure to ahead to this could result in unpreditable behavior in the game
- #or the game crashing on you.
- module BattleManager
- class << self
- #Overwritten Method, play_battle_bgm
- def play_battle_bgm
- #If the switch is on, play the battle bgm. If not, ignore and stay
- #with the map music.
- if($game_switches[BGBattleMusic::BattleMusicSwitch] == true)
- $game_system.battle_bgm.play
- RPG::BGS.stop
- #Check for notetags on the enemy to play a custom theme
- $game_troop.members.each do |enemy|
- $data_enemies[enemy.enemy_id].note[/<Battle Theme:\s*(\w+)>/im]
- if $1 && $1 != ""
- RPG::BGM.new($1, 100, 100).play
- end
- end
- end #End if statement
- end #End def play_battle_bgm
- end #End class
- end #End Module
Advertisement
Add Comment
Please, Sign In to add comment