Adjustable Audio Script + Menu
Version 1.1
by Akin
Introduction
Ever wanted to have an options menu that allows you to adjust the volumes of the various sounds in the game? Well, thats just what this script allows you to do. The script sets up variables to adjust volume of the sounds in game. You can set the variables to any integer from 0 to 100 and the volumes of the associated sounds will be lowered by the percentage of the value. You can also adjust the music to not change when entering a battle.
Features
Updates
1.0 - Initial release
1.1 - Added ability to maintain the currently playing BGM and BGS upon entering combat.
Screenshots
None
Demo
none
Scripts
This is the audio adjustment script
This is a simple audio options menu I made
Instructions
Put the scripts in the usual place above main
Use the following variables to change the sound in game. They can be any value from 0 to 100.
Use the following lines of code to adjust the volume of currently playing Background Music or sounds
Set these values to determine if you want the the currently playing BGM and BGS to stop playing upon entering a battle.
Compatibility
I don't know of any, but this does a total rewrite of the Sound Module and several rewrites to other game classes. Hopefully most conflicts can be resolved by placing this script higher.
Credits and Thanks
Thanks to Sleeping Leonhart, DerVVulfman, SephirothSpawn, and L.
I wouldn't have been able to write this without their help and previous work.
Author's Notes
This is my first script so any constructive feedback would be helpful.
Terms and Conditions
Use however you want just credit me. If you happen to put together a nice looking GUI send me a PM.
Version 1.1
by Akin
Introduction
Ever wanted to have an options menu that allows you to adjust the volumes of the various sounds in the game? Well, thats just what this script allows you to do. The script sets up variables to adjust volume of the sounds in game. You can set the variables to any integer from 0 to 100 and the volumes of the associated sounds will be lowered by the percentage of the value. You can also adjust the music to not change when entering a battle.
Features
- Background Music Volume adjustment
- Background Sounds Volume adjustment
- Musical Effects Volume adjustment
- Event Sounds Volume adjustment
- Sounds in battle adjusted
- Ability to maintain currently playing BGM and BGS upon entering combat
- The options menu and audio adjustment script are separate so you can customize how audio is adjusted.
Updates
1.0 - Initial release
1.1 - Added ability to maintain the currently playing BGM and BGS upon entering combat.
Screenshots
None
Demo
none
Scripts
This is the audio adjustment script
Code:
#################################################################
# Audio Adjustment Script version 1.1 #
#################################################################
# by Akin #
# Credit to The Sleeping Leonhart who's XP Options script #
# helped me learn and to DerVVulfman who helped me find #
# an easy location to change battle sounds #
#################################################################
# This script allows the the volumes of Background Music, #
# Background Sound, Sound Effects, and Music Effects #
# Though the use of the following variables from 0-100 #
# $game_system.bgm_volume #
# $game_system.bgs_volume #
# $game_system.se_volume #
# $game_system.me_volume #
#################################################################
# Simpley use my GUI or someone else's to set the volumes #
# with lines like this #
# "$game_system.se_volume = 90" #
# "$game_system.bgs_volume = 23" #
# Just keep the value between 0 and 100 #
# #
# To reset the volumes of currently playing BGM and #
# BGS use the following lines. #
# Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume) #
# Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume) #
# #
# To continue playing the currently playing BGM and BGS upon #
# entering combat. Use the following command. #
# "$game_system.battle_music_mode = 1" #
# #
# Use "$game_system.battle_music_mode = 0" to return to the #
# traditional method of changing BGM's and BGS upon battle #
#################################################################
# Release Notes #
# 1.0 - Initial Release #
# 1.1 - Added ability to continue music playing though combat #
#################################################################
# This adds on to the Audio module and adjusts playback volumes by the adjustment value
module Audio
def self.play_adjust(sound_file, adjustment) # accepts a sound file and an adjustment value from 0-100
original_volume = sound_file.volume # stores the original volume of the sound file
sound_file.volume = Integer(original_volume * adjustment / 100) # resets the sound volume to the adjustment %
sound_file.play # plays the sound file
sound_file.volume = original_volume # resets the volume of the orginal file
end
end
# Replaces the current sound module so that all sound effects that are called for in
# the game and in scripts that use "Sound.play_X" play at the correct volume
module Sound
# Cursor
def self.play_cursor
Audio.play_adjust($data_system.sounds[0], $game_system.se_volume)
end
# Decision
def self.play_decision
Audio.play_adjust($data_system.sounds[1], $game_system.se_volume)
end
# Cancel
def self.play_cancel
Audio.play_adjust($data_system.sounds[2], $game_system.se_volume)
end
# Buzzer
def self.play_buzzer
Audio.play_adjust($data_system.sounds[3], $game_system.se_volume)
end
# Equip
def self.play_equip
Audio.play_adjust($data_system.sounds[4], $game_system.se_volume)
end
# Save
def self.play_save
Audio.play_adjust($data_system.sounds[5], $game_system.se_volume)
end
# Load
def self.play_load
Audio.play_adjust($data_system.sounds[6], $game_system.se_volume)
end
# Battle Start
def self.play_battle_start
Audio.play_adjust($data_system.sounds[7], $game_system.se_volume)
end
# Escape
def self.play_escape
Audio.play_adjust($data_system.sounds[8], $game_system.se_volume)
end
# Enemy Attack
def self.play_enemy_attack
Audio.play_adjust($data_system.sounds[9], $game_system.se_volume)
end
# Enemy Damage
def self.play_enemy_damage
Audio.play_adjust($data_system.sounds[10], $game_system.se_volume)
end
# Enemy Collapse
def self.play_enemy_collapse
Audio.play_adjust($data_system.sounds[11], $game_system.se_volume)
end
# Actor Damage
def self.play_actor_damage
Audio.play_adjust($data_system.sounds[12], $game_system.se_volume)
end
# Actor Collapse
def self.play_actor_collapse
Audio.play_adjust($data_system.sounds[13], $game_system.se_volume)
end
# Recovery
def self.play_recovery
Audio.play_adjust($data_system.sounds[14], $game_system.se_volume)
end
# Miss
def self.play_miss
Audio.play_adjust($data_system.sounds[15], $game_system.se_volume)
end
# Evasion
def self.play_evasion
Audio.play_adjust($data_system.sounds[16], $game_system.se_volume)
end
# Shop
def self.play_shop
Audio.play_adjust($data_system.sounds[17], $game_system.se_volume)
end
# Use Item
def self.play_use_item
Audio.play_adjust($data_system.sounds[18], $game_system.se_volume)
end
# Use Skill
def self.play_use_skill
Audio.play_adjust($data_system.sounds[19], $game_system.se_volume)
end
end
# Modifies the game system to add in the optional volume adjustments
class Game_System
attr_accessor :bgm_volume
attr_accessor :se_volume
attr_accessor :bgs_volume
attr_accessor :me_volume
attr_accessor :battle_music_mode
alias akin_sound_ini_game_system initialize
def initialize
akin_sound_ini_game_system
# BGM, BGS, SE and ME Volume Values for storage
@bgm_volume = 100; @se_volume = 100; @bgs_volume = 100; @me_volume = 100; @battle_music_mode = 0;
end
end
# Edits the game_interpreter so that all event sounds are played at the correct volume
class Game_Interpreter
def command_241
Audio.play_adjust(@params[0], $game_system.bgm_volume) #BGM
return true
end
def command_245
Audio.play_adjust(@params[0], $game_system.bgs_volume) #BGS
return true
end
def command_249
Audio.play_adjust(@params[0], $game_system.me_volume) #ME
return true
end
def command_250
Audio.play_adjust(@params[0], $game_system.se_volume) #SE
return true
end
end
# Edits the game_map to play autoplayed BGS and BGM's at the correct volume
class Game_Map
def autoplay
Audio.play_adjust(@map.bgm, $game_system.bgm_volume) if @map.autoplay_bgm
Audio.play_adjust(@map.bgs, $game_system.bgs_volume) if @map.autoplay_bgs
end
end
# Edits game_vehicle to play the correct volume sound when mounting a vehicle
class Game_Vehicle < Game_Character
def get_on
@driving = true
@walk_anime = true
@step_anime = true
if @type == 2 # If airship
@priority_type = 2 # Change priority to "Above Characters"
end
Audio.play_adjust(@bgm, $game_system.bgm_volume) # Start BGM
end
end
# Edits game_player to play the correct volume sound after dismounting a vehicle
class Game_Player < Game_Character
def get_off_vehicle
if in_airship? # Airship
return unless airship_land_ok?(@x, @y) # Can't land?
else # Boat/ship
front_x = $game_map.x_with_direction(@x, @direction)
front_y = $game_map.y_with_direction(@y, @direction)
return unless can_walk?(front_x, front_y) # Can't touch land?
end
$game_map.vehicles[@vehicle_type].get_off # Get off processing
if in_airship? # Airship
@direction = 2 # Face down
else # Boat/ship
force_move_forward # Move one step forward
@transparent = false # Remove transparency
end
@vehicle_getting_off = true # Start getting off operation
@move_speed = 4 # Return move speed
@through = false # Passage OFF
Audio.play_adjust(@walking_bgm, $game_system.bgm_volume) # Restore walking BGM
make_encounter_count # Initialize encounter
end
end
# Edits sprite_base to play sound effects from battle animations at the correct volume
class Sprite_Base < Sprite
def animation_process_timing(timing)
Audio.play_adjust(timing.se, $game_system.se_volume)
case timing.flash_scope
when 1
self.flash(timing.flash_color, timing.flash_duration * 4)
when 2
if viewport != nil
viewport.flash(timing.flash_color, timing.flash_duration * 4)
end
when 3
self.flash(nil, timing.flash_duration * 4)
end
end
end
# Edits scene_map to play the battle BGM at the correct volume
class Scene_Map < Scene_Base
def call_battle
@spriteset.update
Graphics.update
$game_player.make_encounter_count
$game_player.straighten
$game_temp.map_bgm = RPG::BGM.last
$game_temp.map_bgs = RPG::BGS.last
unless $game_system.battle_music_mode == 1 # Does not stop current must if battle_music mode is 1
RPG::BGM.stop
RPG::BGS.stop
end
Sound.play_battle_start
unless $game_system.battle_music_mode == 1
Audio.play_adjust($game_system.battle_bgm, $game_system.bgm_volume) # Does not play battle music if battle mode is 1
end
$game_temp.next_scene = nil
$scene = Scene_Battle.new
end
end
# Edits the scene_battle class to play the BGM and BGS of the returning map and
# the victory ME at the correct volumes
class Scene_Battle < Scene_Base
def battle_end(result)
if result == 2 and not $game_troop.can_lose
call_gameover
else
$game_party.clear_actions
$game_party.remove_states_battle
$game_troop.clear
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
unless $BTEST or $game_system.battle_music_mode == 1 #does not restore BGM if battle music mode 1 is enabled
Audio.play_adjust($game_temp.map_bgm, $game_system.bgm_volume)
Audio.play_adjust($game_temp.map_bgs, $game_system.bgs_volume)
end
$scene = Scene_Map.new
@message_window.clear
Graphics.fadeout(30)
end
$game_temp.in_battle = false
end
def process_victory
@info_viewport.visible = false
@message_window.visible = true
unless $game_system.battle_music_mode == 1 #does not play victory ME if battle music mode 1 is enabled
RPG::BGM.stop
Audio.play_adjust($game_system.battle_end_me, $game_system.me_volume)
end
unless $BTEST or $game_system.battle_music_mode == 1 #does not restore BGM if battle music mode 1 is enabled
Audio.play_adjust($game_temp.map_bgm, $game_system.bgm_volume)
Audio.play_adjust($game_temp.map_bgs, $game_system.bgs_volume)
end
display_exp_and_gold
display_drop_items
display_level_up
battle_end(0)
end
end
# Edits the scene_gameover to play the gameover ME at the correct volume
class Scene_Gameover < Scene_Base
def start
super
RPG::BGM.stop
RPG::BGS.stop
Audio.play_adjust($data_system.gameover_me, $game_system.me_volume)
Graphics.transition(120)
Graphics.freeze
create_gameover_graphic
end
end
# Edits the scene_file so that music plays at the correct volume upon loading
class Scene_File < Scene_Base
def do_load
file = File.open(@savefile_windows[@index].filename, "rb")
read_save_data(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
Audio.play_adjust(@last_bgm, $game_system.bgm_volume)
Audio.play_adjust(@last_bgs, $game_system.bgs_volume)
end
end
This is a simple audio options menu I made
Code:
####################################################
# Custom Options Menu #
####################################################
# by Akin #
# credit to 'L' who's custom menu helped #
# me figure out what to do #
####################################################
# This script calls an audio options menu. #
# #
# Call using "$scene = Scene_Options.new" #
# #
####################################################
module OptionCommand
#Main Option Commands
Audio = 'Audio'
Controls = 'Controls'
Exit_Options = 'Back'
#Audio Option commands
Audiobgm = 'Music Volume'
Audiobgs = 'Background Effects Volume'
Audiome = 'Musical Effects Volume'
Audiose = 'Sound Effects volume'
#BGM Options
Audiobgm0 = '0'
Audiobgm1 = '1'
Audiobgm2 = '2'
Audiobgm3 = '3'
Audiobgm4 = '4'
Audiobgm5 = '5'
Audiobgm6 = '6'
Audiobgm7 = '7'
Audiobgm8 = '8'
Audiobgm9 = '9'
Audiobgm10 = '10'
#BGS Options
Audiobgs0 = '0'
Audiobgs1 = '1'
Audiobgs2 = '2'
Audiobgs3 = '3'
Audiobgs4 = '4'
Audiobgs5 = '5'
Audiobgs6 = '6'
Audiobgs7 = '7'
Audiobgs8 = '8'
Audiobgs9 = '9'
Audiobgs10 = '10'
#SE Options
Audiose0 = '0'
Audiose1 = '1'
Audiose2 = '2'
Audiose3 = '3'
Audiose4 = '4'
Audiose5 = '5'
Audiose6 = '6'
Audiose7 = '7'
Audiose8 = '8'
Audiose9 = '9'
Audiose10 = '10'
#ME Options
Audiome0 = '0'
Audiome1 = '1'
Audiome2 = '2'
Audiome3 = '3'
Audiome4 = '4'
Audiome5 = '5'
Audiome6 = '6'
Audiome7 = '7'
Audiome8 = '8'
Audiome9 = '9'
Audiome10 = '10'
end
#==============================================================================
# ** Scene_Options
#------------------------------------------------------------------------------
# This class performs the Options screen processing.
#==============================================================================
class Scene_Options < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(options_index = 0)
@options_index = options_index
options_init
end
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def options_init
@options = []
op1 = OptionCommand::Audio
op2 = OptionCommand::Controls
op3 = OptionCommand::Exit_Options
@options.push(op1, op2, op3).flatten!
@audio_options = []
aud1 = OptionCommand::Audiobgm
aud2 = OptionCommand::Audiobgs
aud3 = OptionCommand::Audiome
aud4 = OptionCommand::Audiose
@audio_options.push(aud1, aud2, aud3, aud4).flatten!
@bgm_options = []
bgm0 = OptionCommand::Audiobgm0
bgm1 = OptionCommand::Audiobgm1
bgm2 = OptionCommand::Audiobgm2
bgm3 = OptionCommand::Audiobgm3
bgm4 = OptionCommand::Audiobgm4
bgm5 = OptionCommand::Audiobgm5
bgm6 = OptionCommand::Audiobgm6
bgm7 = OptionCommand::Audiobgm7
bgm8 = OptionCommand::Audiobgm8
bgm9 = OptionCommand::Audiobgm9
bgm10 = OptionCommand::Audiobgm10
@bgm_options.push(bgm0, bgm1, bgm2, bgm3, bgm4, bgm5, bgm6, bgm7, bgm8, bgm9, bgm10).flatten!
@bgs_options = []
bgs0 = OptionCommand::Audiobgs0
bgs1 = OptionCommand::Audiobgs1
bgs2 = OptionCommand::Audiobgs2
bgs3 = OptionCommand::Audiobgs3
bgs4 = OptionCommand::Audiobgs4
bgs5 = OptionCommand::Audiobgs5
bgs6 = OptionCommand::Audiobgs6
bgs7 = OptionCommand::Audiobgs7
bgs8 = OptionCommand::Audiobgs8
bgs9 = OptionCommand::Audiobgs9
bgs10 = OptionCommand::Audiobgs10
@bgs_options.push(bgs0, bgs1, bgs2, bgs3, bgs4, bgs5, bgs6, bgs7, bgs8, bgs9, bgs10).flatten!
@se_options = []
se0 = OptionCommand::Audiose0
se1 = OptionCommand::Audiose1
se2 = OptionCommand::Audiose2
se3 = OptionCommand::Audiose3
se4 = OptionCommand::Audiose4
se5 = OptionCommand::Audiose5
se6 = OptionCommand::Audiose6
se7 = OptionCommand::Audiose7
se8 = OptionCommand::Audiose8
se9 = OptionCommand::Audiose9
se10 = OptionCommand::Audiose10
@se_options.push(se0, se1, se2, se3, se4, se5, se6, se7, se8, se9, se10).flatten!
@me_options = []
me0 = OptionCommand::Audiome0
me1 = OptionCommand::Audiome1
me2 = OptionCommand::Audiome2
me3 = OptionCommand::Audiome3
me4 = OptionCommand::Audiome4
me5 = OptionCommand::Audiome5
me6 = OptionCommand::Audiome6
me7 = OptionCommand::Audiome7
me8 = OptionCommand::Audiome8
me9 = OptionCommand::Audiome9
me10 = OptionCommand::Audiome10
@me_options.push(me0, me1, me2, me3, me4, me5, me6, me7, me8, me9, me10).flatten!
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_options_window
create_audio_window
create_bgm_window
create_bgs_window
create_se_window
create_me_window
create_controls_window
@help_window = Window_Help.new
@help_window.viewport = @viewport
@help_window.set_text("Options")
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@options_window.dispose
@audio_options_window.dispose
@bgm_options_window.dispose
@bgs_options_window.dispose
@se_options_window.dispose
@me_options_window.dispose
@controls_window.dispose
@help_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@options_window.update
@audio_options_window.update
@bgm_options_window.update
@bgs_options_window.update
@se_options_window.update
@me_options_window.update
@controls_window.update
@help_window.update
if @options_window.active
update_options_selection
elsif @audio_options_window.active
update_audio_options_selection
elsif @bgm_options_window.active
update_bgm_options_selection
elsif @bgs_options_window.active
update_bgs_options_selection
elsif @se_options_window.active
update_se_options_selection
elsif @me_options_window.active
update_me_options_selection
elsif @controls_window.active
update_controls_selection
end
end
#--------------------------------------------------------------------------
# * Create Main Option Selection
#--------------------------------------------------------------------------
def create_options_window
@options_window = Window_Command.new(160, @options)
@options_window.index = @options_index
@options_window.y = 56
end
#--------------------------------------------------------------------------
# * Create Audio Options Window
#--------------------------------------------------------------------------
def create_audio_window
@audio_options_window = Window_Command.new(277, @audio_options)
@audio_options_window.visible = false
@audio_options_window.active = false
@audio_options_window.x = 160
@audio_options_window.y = 56
end
#--------------------------------------------------------------------------
# * Create Audio-BGM Options Window
#--------------------------------------------------------------------------
def create_bgm_window
@bgm_options_window = Window_Command.new(62, @bgm_options)
@bgm_options_window.visible = false
@bgm_options_window.active = false
@bgm_options_window.x = 437
@bgm_options_window.y = 56
end
#--------------------------------------------------------------------------
# * Create Audio-BGS Options Window
#--------------------------------------------------------------------------
def create_bgs_window
@bgs_options_window = Window_Command.new(62, @bgs_options)
@bgs_options_window.visible = false
@bgs_options_window.active = false
@bgs_options_window.x = 437
@bgs_options_window.y = 56
end
#--------------------------------------------------------------------------
# * Create Audio-SE Options Window
#--------------------------------------------------------------------------
def create_se_window
@se_options_window = Window_Command.new(62, @se_options)
@se_options_window.visible = false
@se_options_window.active = false
@se_options_window.x = 437
@se_options_window.y = 56
end
#--------------------------------------------------------------------------
# * Create Audio-ME Options Window
#--------------------------------------------------------------------------
def create_me_window
@me_options_window = Window_Command.new(62, @me_options)
@me_options_window.visible = false
@me_options_window.active = false
@me_options_window.x = 437
@me_options_window.y = 56
end
#--------------------------------------------------------------------------
# * Create Controls Options Window
#--------------------------------------------------------------------------
def create_controls_window
@controls_window = Window_Base.new(161, 57, 292, 300)
@controls_window.contents.draw_text(0, -2, 100, 24, "Controls")
@controls_window.contents.draw_text(0, 24, 300, 24, "To Access the system controls")
@controls_window.contents.draw_text(0, 48, 300, 24, "Press F1 at any time")
@controls_window.contents.draw_text(40, 96, 300, 24, "A")
@controls_window.contents.draw_text(40, 120, 300, 24, "B")
@controls_window.contents.draw_text(40, 144, 300, 24, "C")
@controls_window.contents.draw_text(40, 168, 300, 24, "L")
@controls_window.contents.draw_text(40, 192, 300, 24, "R")
@controls_window.contents.draw_text(40, 216, 300, 24, "X")
@controls_window.contents.draw_text(40, 240, 300, 24, "Y")
@controls_window.contents.draw_text(60, 96, 300, 24, ":: Dash")
@controls_window.contents.draw_text(60, 120, 300, 24, ":: Cancel/Menu")
@controls_window.contents.draw_text(60, 144, 300, 24, ":: Confirm/Talk")
@controls_window.contents.draw_text(60, 168, 300, 24, ":: Menu Previous")
@controls_window.contents.draw_text(60, 192, 300, 24, ":: Menu Next")
@controls_window.contents.draw_text(60, 216, 300, 24, ":: Not Used")
@controls_window.contents.draw_text(60, 240, 300, 24, ":: Not Used")
@controls_window.visible = false
@controls_window.active = false
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(0) #-----------Change this number to the options spot -1 on main menu-----------------
end
#--------------------------------------------------------------------------
# * Update Options Selection
#--------------------------------------------------------------------------
def update_options_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
main_options_input
end
end
#--------------------------------------------------------------------------
# * Update Audio Options Selection
#--------------------------------------------------------------------------
def update_audio_options_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@options_window.active = true
@audio_options_window.active = false
@audio_options_window.visible = false
@audio_options_window.index = 0
return
elsif Input.trigger?(Input::C)
audio_options_input
end
end
#--------------------------------------------------------------------------
# * Update Audio-BGM Options Selection
#--------------------------------------------------------------------------
def update_bgm_options_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@audio_options_window.active = true
@bgm_options_window.active = false
@bgm_options_window.visible = false
@bgm_options_window.index = 0
return
elsif Input.trigger?(Input::C)
bgm_options_input
end
end
#--------------------------------------------------------------------------
# * Update Audio-BGS Options Selection
#--------------------------------------------------------------------------
def update_bgs_options_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@audio_options_window.active = true
@bgs_options_window.active = false
@bgs_options_window.visible = false
@bgs_options_window.index = 0
return
elsif Input.trigger?(Input::C)
bgs_options_input
end
end
#--------------------------------------------------------------------------
# * Update Audio-SE Options Selection
#--------------------------------------------------------------------------
def update_se_options_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@audio_options_window.active = true
@se_options_window.active = false
@se_options_window.visible = false
@se_options_window.index = 0
return
elsif Input.trigger?(Input::C)
se_options_input
end
end
#--------------------------------------------------------------------------
# * Update Audio-ME Options Selection
#--------------------------------------------------------------------------
def update_me_options_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@audio_options_window.active = true
@me_options_window.active = false
@me_options_window.visible = false
@me_options_window.index = 0
return
elsif Input.trigger?(Input::C)
me_options_input
end
end
#--------------------------------------------------------------------------
# * Update Controls Selection
#--------------------------------------------------------------------------
def update_controls_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@options_window.active = true
@controls_window.active = false
@controls_window.visible = false
end
end
#--------------------------------------------------------------------------
# * Update Main Options InputCheck
#--------------------------------------------------------------------------
def main_options_input
option = @options[@options_window.index]
Sound.play_decision
# Checks Options Commands
case option
when OptionCommand::Audio #calls Audio options subwindow
@audio_options_window.active = true
@audio_options_window.visible = true
@options_window.active = false
when OptionCommand::Controls #Controls
@controls_window.active = true
@controls_window.visible = true
@options_window.active = false
when OptionCommand::Exit_Options #Return to Main Menu
return_scene
end
end
#--------------------------------------------------------------------------
# * Update Audio Options InputCheck
#--------------------------------------------------------------------------
def audio_options_input
audio_option = @audio_options[@audio_options_window.index]
Sound.play_decision
# Checks Graphics Options Commands
case audio_option
when OptionCommand::Audiobgm #Adjust BGM
@bgm_options_window.index = Integer($game_system.bgm_volume / 10)
@bgm_options_window.active = true
@bgm_options_window.visible = true
@audio_options_window.active = false
when OptionCommand::Audiobgs #Adjust BGS
@bgs_options_window.index = Integer($game_system.bgs_volume / 10)
@bgs_options_window.active = true
@bgs_options_window.visible = true
@audio_options_window.active = false
when OptionCommand::Audiome #Adjust ME
@me_options_window.index = Integer($game_system.me_volume / 10)
@me_options_window.active = true
@me_options_window.visible = true
@audio_options_window.active = false
when OptionCommand::Audiose #Adjust SE
@se_options_window.index = Integer($game_system.se_volume / 10)
@se_options_window.active = true
@se_options_window.visible = true
@audio_options_window.active = false
end
end
#--------------------------------------------------------------------------
# * Update Audio-BGM Options InputCheck
#--------------------------------------------------------------------------
def bgm_options_input
bgm_option = @bgm_options[@bgm_options_window.index]
Sound.play_decision
# Checks BGM Options Commands
case bgm_option
when OptionCommand::Audiobgm0 #BGM Volume 0%
$game_system.bgm_volume = 0
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm1 #BGM Volume 10%
$game_system.bgm_volume = 10
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm2 #BGM Volume 20%
$game_system.bgm_volume = 20
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm3 #BGM Volume 30%
$game_system.bgm_volume = 30
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm4 #BGM Volume 40%
$game_system.bgm_volume = 40
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm5 #BGM Volume 50%
$game_system.bgm_volume = 50
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm6 #BGM Volume 60%
$game_system.bgm_volume = 60
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm7 #BGM Volume 70%
$game_system.bgm_volume = 70
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm8 #BGM Volume 80%
$game_system.bgm_volume = 80
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm9 #BGM Volume 90%
$game_system.bgm_volume = 90
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
when OptionCommand::Audiobgm10 #BGM Volume 100%
$game_system.bgm_volume = 100
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
end
end
#--------------------------------------------------------------------------
# * Update Audio-BGS Options InputCheck
#--------------------------------------------------------------------------
def bgs_options_input
bgs_option = @bgs_options[@bgs_options_window.index]
Sound.play_decision
# Checks BGM Options Commands
case bgs_option
when OptionCommand::Audiobgs0 #BGS Volume 0%
$game_system.bgs_volume = 0
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs1 #BGS Volume 10%
$game_system.bgs_volume = 10
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs2 #BGS Volume 20%
$game_system.bgs_volume = 20
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs3 #BGS Volume 30%
$game_system.bgs_volume = 30
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs4 #BGS Volume 40%
$game_system.bgs_volume = 40
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs5 #BGS Volume 50%
$game_system.bgs_volume = 50
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs6 #BGS Volume 60%
$game_system.bgs_volume = 60
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs7 #BGS Volume 70%
$game_system.bgs_volume = 70
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs8 #BGS Volume 80%
$game_system.bgs_volume = 80
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs9 #BGS Volume 90%
$game_system.bgs_volume = 90
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
when OptionCommand::Audiobgs10 #BGS Volume 100%
$game_system.bgs_volume = 100
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
end
end
#--------------------------------------------------------------------------
# * Update Audio-SE Options InputCheck
#--------------------------------------------------------------------------
def se_options_input
se_option = @se_options[@se_options_window.index]
Sound.play_decision
# Checks BGM Options Commands
case se_option
when OptionCommand::Audiose0 #SE Volume 0%
$game_system.se_volume = 0
when OptionCommand::Audiose1 #SE Volume 10%
$game_system.se_volume = 10
when OptionCommand::Audiose2 #SE Volume 20%
$game_system.se_volume = 20
when OptionCommand::Audiose3 #SE Volume 30%
$game_system.se_volume = 30
when OptionCommand::Audiose4 #SE Volume 40%
$game_system.se_volume = 40
when OptionCommand::Audiose5 #SE Volume 50%
$game_system.se_volume = 50
when OptionCommand::Audiose6 #SE Volume 60%
$game_system.se_volume = 60
when OptionCommand::Audiose7 #SE Volume 70%
$game_system.se_volume = 70
when OptionCommand::Audiose8 #SE Volume 80%
$game_system.se_volume = 80
when OptionCommand::Audiose9 #SE Volume 90%
$game_system.se_volume = 90
when OptionCommand::Audiose10 #SE Volume 100%
$game_system.se_volume = 100
end
end
#--------------------------------------------------------------------------
# * Update Audio-ME Options InputCheck
#--------------------------------------------------------------------------
def me_options_input
me_option = @me_options[@me_options_window.index]
Sound.play_decision
# Checks BGM Options Commands
case me_option
when OptionCommand::Audiome0 #ME Volume 0%
$game_system.me_volume = 0
when OptionCommand::Audiome1 #ME Volume 10%
$game_system.me_volume = 10
when OptionCommand::Audiome2 #ME Volume 20%
$game_system.me_volume = 20
when OptionCommand::Audiome3 #ME Volume 30%
$game_system.me_volume = 30
when OptionCommand::Audiome4 #ME Volume 40%
$game_system.me_volume = 40
when OptionCommand::Audiome5 #ME Volume 50%
$game_system.me_volume = 50
when OptionCommand::Audiome6 #ME Volume 60%
$game_system.me_volume = 60
when OptionCommand::Audiome7 #ME Volume 70%
$game_system.me_volume = 70
when OptionCommand::Audiome8 #ME Volume 80%
$game_system.me_volume = 80
when OptionCommand::Audiome9 #ME Volume 90%
$game_system.me_volume = 90
when OptionCommand::Audiome10 #ME Volume 100%
$game_system.me_volume = 100
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text("Options")
end
end
Instructions
Put the scripts in the usual place above main
Use the following variables to change the sound in game. They can be any value from 0 to 100.
Code:
$game_system.bgm_volume
$game_system.bgs_volume
$game_system.se_volume
$game_system.me_volume
# Example.
$game_system.se_volume = 50
Use the following lines of code to adjust the volume of currently playing Background Music or sounds
Code:
Audio.play_adjust(RPG::BGM.last, $game_system.bgm_volume)
#for BGM
Audio.play_adjust(RPG::BGS.last, $game_system.bgs_volume)
# for BGS
Set these values to determine if you want the the currently playing BGM and BGS to stop playing upon entering a battle.
Code:
$game_system.battle_music_mode = 1
# To not change BGM/BGS
$game_system.battle_music_mode = 0
# To change BGM/BGS upon battle entry (default)
Compatibility
I don't know of any, but this does a total rewrite of the Sound Module and several rewrites to other game classes. Hopefully most conflicts can be resolved by placing this script higher.
Credits and Thanks
Thanks to Sleeping Leonhart, DerVVulfman, SephirothSpawn, and L.
I wouldn't have been able to write this without their help and previous work.
Author's Notes
This is my first script so any constructive feedback would be helpful.
Terms and Conditions
Use however you want just credit me. If you happen to put together a nice looking GUI send me a PM.