=begin #=============================================================================== Title: Music Mute Switch Author: Hime Date: Apr 24, 2015 URL: -------------------------------------------------------------------------------- ** Change log Apr 24, 2015 -initial release -------------------------------------------------------------------------------- ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Credits to Hime Works in your project * Preserve this header -------------------------------------------------------------------------------- ** Description This script allows you to mute certain pieces of music in the game using a switch. This is useful when your game contains copyright music that prohibits derivative works from using them, such as game streams. -------------------------------------------------------------------------------- ** Installation In the script editor, place this script below Materials and above Main -------------------------------------------------------------------------------- ** Usage In the configuration, set the ID of the switch that you wish to use to control the mute button. When the switch is turned ON, muting will occur. In the mute list, type in the names of the files that will be muted when the mute button is enabled. #=============================================================================== =end $imported = {} if $imported.nil? $imported[:TH_MusicMuteSwitch] = true #=============================================================================== # ** Configuration #=============================================================================== module TH module Music_Mute_Switch # Switch ID that determines whether muting should occur Mute_Switch = 2 # List of songs to mute when the mute switch is ON. # Applies to BGM, BGS, ME, and SE. Filenames are case-sensitive! Mute_List = [ "Battle1", "Gag", ] end end #=============================================================================== # ** Rest of Script #=============================================================================== class Game_System def mute_copyright? $game_switches[TH::Music_Mute_Switch::Mute_Switch] end end module RPG class RPG::BGM alias :th_music_mute_switch_play :play def play return if $game_system.mute_copyright? && TH::Music_Mute_Switch::Mute_List.include?(@name) th_music_mute_switch_play end end class RPG::BGS alias :th_music_mute_switch_play :play def play return if $game_system.mute_copyright? && TH::Music_Mute_Switch::Mute_List.include?(@name) th_music_mute_switch_play end end class RPG::ME alias :th_music_mute_switch_play :play def play return if $game_system.mute_copyright? && TH::Music_Mute_Switch::Mute_List.include?(@name) th_music_mute_switch_play end end class RPG::SE alias :th_music_mute_switch_play :play def play p @name return if $game_system.mute_copyright? && TH::Music_Mute_Switch::Mute_List.include?(@name) th_music_mute_switch_play end end end