Help - Search - Members - Calendar
Full Version: Random Battle BGM
RPG RPG Revolution Forums > Scripting > Script Tutorials > RGSS2
breadlord
This script allows you to use a random battle bgm instead of the same one over and over again. Instructions in the script.

CODE

######################## Breadlords Random Battle BGM ##########################
## This allows the BGM in battles to be chosen randomly from the BGM's you ##
## set. You set a BGM like this : number => RPG::BGM.new("bgm name", volume, ##
## pitch)] *all on one line*, were number is the number 1 higher than the ##
## number of the previous one (starting at zero, 1 for the next bgm ect), bgm ##
## name is were you will put in the name of the BGM, volume is it's volume, I ##
## recomend that if you do not know what your doing you should just leave it ##
## at 100, the same for pitch - if you do not know what your doing leave this ##
## at 100. ##
## ##
## Finally, if you want to stop the random BGM use the command $stop_random = ##
## true, to set the random BGMs back on again use $stop_random = false ##
################################################################################
################################################################################
class Scene_Map < Scene_Base
alias add_music_battle call_battle unless $@
def call_battle
random_BGM ={ # Insert custom BGMs here
0 => RPG::BGM.new("Battle1", 100, 100), # BGM I've set up, you can remove
1 => RPG::BGM.new("Battle2", 100, 100), # BGM I've set up, you can remove
2 => RPG::BGM.new("Battle3", 100, 100), # BGM I've set up, you can remove
3 => RPG::BGM.new("Battle4", 100, 100), # BGM I've set up, you can remove
4 => RPG::BGM.new("Battle5", 100, 100), # BGM I've set up, you can remove
5 => RPG::BGM.new("Battle6", 100, 100), # BGM I've set up, you can remove
6 => RPG::BGM.new("Battle7", 100, 100), # BGM I've set up, you can remove
7 => RPG::BGM.new("Battle8", 100, 100), # BGM I've set up, you can remove
}
########################### Do not edit past here ##############################
i = random_BGM.keys
wich_one = rand(i.size - 1)
music = random_BGM[wich_one]
unless $stop_random
$game_system.battle_bgm = music
end
add_music_battle
end
end


thefuneralpyre666
Why on earth would this script go overlooked? It's so short, yet adds such an amazing feature, as many games have only one battle theme, making battles boring and monotonous before the first dungeon is finished. This alleviates that pain
Lennox55
Yeah, this is totally just what I needed!
Very good.
Thanks a lot biggrin.gif
Fonstw
I chose 18 different BGM's, so that took a while >.<

But thanks dude, really!!
TheBen
Beautiful script. Thanks for giving us something to elegant and useful! happy.gif
(Casual note to self: Yanfly already had this script, but with the BGM hash changing depending on which actors were in the party. I prefer this for its simplicity, though.)
thepurplearchmage
One problem with this masterpiece: this also cancel's out any Change Battle BGM event commands. Anyway to stop this?
oriceles
QUOTE (thepurplearchmage @ Oct 8 2011, 02:46 PM) *
One problem with this masterpiece: this also cancel's out any Change Battle BGM event commands. Anyway to stop this?


unsure.gif I've seen another script just like these one that have a similar problem. But in that case after the "change battle bgm" command the script function get lost and the event music get as default. Anyway here's the link for the other script

I'm not a ascripter at all but i must say that this scripts are almost perfect.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.