Easy Volume Control
By: FamilyGamer7
Introduction
The easiest way to implement a game volume control to control via script calls.
Click to expand...
Features
This script is very straight forward with granting the ability to change the game volume whenever needed. It is done through a simple script call for ease of use. Will compliment a settings/options scene.
Click to expand...
Screenshot(s)
- Not Needed -
Click to expand...
Script
Spoiler: FG7 - Easy Volume Control
Ruby: #============================================================================== # Title: Easy Volume Control # Author: FamilyGamer7 (FG7) # Version: 1.0 # Engine: RPG Maker VX Ace #============================================================================== # ** Change Log | # --------------- # 1.0 => Created Script #============================================================================== # ** Description | # ---------------- # The easiest way to implement a game volume control to control via script calls. #============================================================================== # ** Terms of Use | # ----------------- # * Free to use in non-commercial projects and commercial projects # * Feel free to modify and improve the script. Credit is still required. # * Credit FamilyGamer7 #============================================================================== # ** Usage | # --------- # By default the game volume will be set at value of "100", which is normal # game sound volume. Below are script calls to easily change the volume. # # Script calls: # # To set the game volume at 100% - Normal # Ex: $game_system.game_volume_control = 100 # # To set the game volume at 50% - Half Volume # Ex: $game_system.game_volume_control = 50 # # To set the game volume at 0% - No Sound # Ex: $game_system.game_volume_control = 0 # # You can also set the game volume to an odd value number like 73 (73%) # Ex: $game_system.game_volume_control = 73 # # ----------------------------------------------------------------------------- # # *Note: ALL of the game sound volume is changed together. There is no specific # way to individually change Background vs Sound Effects for example, # unless you modify the script itself. #============================================================================== #============================================================================== # ** Module: FG7::Easy_Volume_Control #------------------------------------------------------------------------------ # This modules creates a static variable to be used within the script. #============================================================================== module FG7 module Easy_Volume_Control # Sets value on the $game_variable to control help control game volume Game_Variable_EVC = 22 end end #============================================================================== # ** Game_System #------------------------------------------------------------------------------ # This class handles system data. It saves the disable state of saving and # menus. Instances of this class are referenced by $game_system. #============================================================================== class Game_System #-------------------------------------------------------------------------- # New Method: game_volume_control (Used to control Game Volume) #-------------------------------------------------------------------------- def game_volume_control=(value) @game_volume_control = value $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = @game_volume_control end end #============================================================================== # ** RPG::BGM #------------------------------------------------------------------------------ # Default sound for BGM #============================================================================== class RPG::BGM < RPG::AudioFile #-------------------------------------------------------------------------- # * Override Method: play #-------------------------------------------------------------------------- def play(pos = 0) $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = 100 if $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] == 0 Audio.bgm_play('Audio/BGM/' + @name, $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC], @pitch, pos) if !@name.empty? end end #============================================================================== # ** RPG::ME #------------------------------------------------------------------------------ # Default sound for ME #============================================================================== class RPG::ME < RPG::AudioFile #-------------------------------------------------------------------------- # * Override Method: play #-------------------------------------------------------------------------- def play $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = 100 if $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] == 0 Audio.me_play('Audio/ME/' + @name, $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC], @pitch) if !@name.empty? end end #============================================================================== # ** RPG::BGS #------------------------------------------------------------------------------ # Default sound for BGS #============================================================================== class RPG::BGS < RPG::AudioFile #-------------------------------------------------------------------------- # * Override Method: play #-------------------------------------------------------------------------- def play(pos = 0) $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = 100 if $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] == 0 Audio.bgs_play('Audio/BGS/' + @name, $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC], @pitch, pos) if !@name.empty? end end #============================================================================== # ** RPG::SE #------------------------------------------------------------------------------ # Default sound for SE #============================================================================== class RPG::SE < RPG::AudioFile #-------------------------------------------------------------------------- # * Override Method: play #-------------------------------------------------------------------------- def play $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = 100 if $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] == 0 Audio.se_play('Audio/SE/' + @name, $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC], @pitch) if !@name.empty? end end 复制代码
How to Use
Add this script in the script editor under in the "Materials" section and above "Main Process".
The instructions and setup for the script are held within the script header itself. No need to repeat here.
Click to expand...
Terms of Use
- Free to use in non-commercial projects and commercial projects
- Feel free to modify and improve the script. Credit is still required.
- Credit FamilyGamer7
Click to expand...
本贴来自国际rpgmaker官方论坛作者:FG7处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/fg7-easy-volume-control.144717/