Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # XaiL System - Battle Audio
- # Author: Nicke
- # Created: 03/04/2012
- # Edited: 03/04/2012
- # Version: 1.0
- #==============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- # This small scripts enables a randomized SE, BGM and ME to be played upon
- # entering battle.
- #
- # Note! Randomize will only work if you don't have a selected audio file in
- # the database for Battle, Battle Start or Battle End.
- #
- # Script can be enabled/disabled using a switch ingame.
- #
- # *** Only for RPG Maker VX Ace. ***
- #==============================================================================
- ($imported ||= {})["XAIL-BATTLE-AUDIO"] = true
- module XAIL
- module BATTLE_AUDIO
- #--------------------------------------------------------------------------#
- # * Settings
- #--------------------------------------------------------------------------#
- # Randomized switch enabler/disabler.
- # Use this ingame if you wish to disable this script. Can be useful if you
- # wish to select a specific audio for a battle.
- # RAND_SWITCH = switch_id
- RAND_SWITCH = 11
- # Battle start SE.
- # RAND_BATTLE_SND = [name, volume, pitch]
- RAND_BATTLE_SND = []
- RAND_BATTLE_SND[0] = ["Battle1", 80, 100]
- RAND_BATTLE_SND[1] = ["Battle2", 80, 100]
- RAND_BATTLE_SND[2] = ["Battle3", 80, 100]
- # Battle BGM.
- # RAND_BATTLE_BGM = [name, volume, pitch]
- RAND_BATTLE_BGM = []
- RAND_BATTLE_BGM[0] = ["Battle1", 80, 100]
- RAND_BATTLE_BGM[1] = ["Battle2", 80, 100]
- RAND_BATTLE_BGM[2] = ["Battle3", 80, 100]
- RAND_BATTLE_BGM[3] = ["Battle4", 80, 100]
- RAND_BATTLE_BGM[4] = ["Battle5", 80, 100]
- # Battle victory ME.
- # RAND_BATTLE_ME = [name, volume, pitch]
- RAND_BATTLE_ME = []
- RAND_BATTLE_ME[0] = ["Victory1", 80, 100]
- RAND_BATTLE_ME[1] = ["Victory2", 80, 100]
- end
- end
- # *** Don't edit below unless you know what you are doing. ***
- #==============================================================================#
- # ** Module Sound
- #==============================================================================#
- class << Sound
- alias xail_snd_battle_start play_battle_start
- def play_battle_start(*args, &block)
- # // Method self.play_battle_start.
- xail_snd_battle_start(*args, &block)
- rand_snd = rand(XAIL::BATTLE_AUDIO::RAND_BATTLE_SND.size)
- return play_system_sound(7) if $game_switches[XAIL::BATTLE_AUDIO::RAND_SWITCH]
- # If no audio is selected in database do randomize otherwise use default method.
- unless $data_system.sounds[7].name == ""
- play_system_sound(7)
- else
- play_random_battle_sound(rand_snd)
- end
- end
- def play_random_battle_sound(id)
- # // New method to play a random sound when entering battle.
- se = XAIL::BATTLE_AUDIO::RAND_BATTLE_SND
- RPG::SE.new(se[id][0], se[id][1], se[id][2]).play
- end
- end
- #==============================================================================#
- # ** Module BattleManager
- #==============================================================================#
- class << BattleManager
- alias xail_bgm_battle_start play_battle_bgm
- def play_battle_bgm(*args, &block)
- # // Method self.play_battle_bgm.
- xail_bgm_battle_start(*args, &block)
- rand_snd = rand(XAIL::BATTLE_AUDIO::RAND_BATTLE_BGM.size)
- return $game_system.battle_bgm.play if $game_switches[XAIL::BATTLE_AUDIO::RAND_SWITCH]
- # If no audio is selected in database do randomize otherwise use default method.
- unless $game_system.battle_bgm.name == ""
- $game_system.battle_bgm.play
- else
- play_random_battle_bgm(rand_snd)
- end
- RPG::BGS.stop
- end
- def play_random_battle_bgm(id)
- # // New method to play a random bgm.
- bgm = XAIL::BATTLE_AUDIO::RAND_BATTLE_BGM
- RPG::BGM.new(bgm[id][0], bgm[id][1], bgm[id][2]).play
- end
- alias xail_play_battle_end play_battle_end_me
- def play_battle_end_me(*args, &block)
- # // Method self.play_battle_end_me.
- xail_play_battle_end(*args, &block)
- rand_snd = rand(XAIL::BATTLE_AUDIO::RAND_BATTLE_ME.size)
- return $game_system.battle_end_me.play if $game_switches[XAIL::BATTLE_AUDIO::RAND_SWITCH]
- # If no audio is selected in database do randomize otherwise use default method.
- unless $game_system.battle_end_me.name == ""
- $game_system.battle_end_me.play
- else
- play_random_battle_me(rand_snd)
- end
- end
- def play_random_battle_me(id)
- # // New method to play a random me.
- me = XAIL::BATTLE_AUDIO::RAND_BATTLE_ME
- RPG::ME.new(me[id][0], me[id][1], me[id][2]).play
- end
- end # END OF FILE
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement