设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 111|回复: 0

[转载发布] FG7 - Easy Volume Control

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-2 19:06:01 | 显示全部楼层 |阅读模式
    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:       
    1. #==============================================================================
    2. # Title: Easy Volume Control
    3. # Author: FamilyGamer7 (FG7)
    4. # Version: 1.0
    5. # Engine: RPG Maker VX Ace
    6. #==============================================================================
    7. # ** Change Log |
    8. # ---------------
    9. # 1.0 => Created Script
    10. #==============================================================================
    11. # ** Description |
    12. # ----------------
    13. # The easiest way to implement a game volume control to control via script calls.
    14. #==============================================================================
    15. # ** Terms of Use |
    16. # -----------------
    17. # * Free to use in non-commercial projects and commercial projects
    18. # * Feel free to modify and improve the script. Credit is still required.
    19. # * Credit FamilyGamer7
    20. #==============================================================================
    21. # ** Usage |
    22. # ---------
    23. # By default the game volume will be set at value of "100", which is normal
    24. # game sound volume.  Below are script calls to easily change the volume.
    25. #
    26. # Script calls:
    27. #
    28. #   To set the game volume at 100% - Normal
    29. #   Ex: $game_system.game_volume_control = 100
    30. #
    31. #   To set the game volume at 50% - Half Volume
    32. #   Ex: $game_system.game_volume_control = 50
    33. #
    34. #   To set the game volume at 0% - No Sound
    35. #   Ex: $game_system.game_volume_control = 0
    36. #
    37. #   You can also set the game volume to an odd value number like 73 (73%)
    38. #   Ex: $game_system.game_volume_control = 73
    39. #
    40. # -----------------------------------------------------------------------------
    41. #
    42. # *Note: ALL of the game sound volume is changed together. There is no specific
    43. #        way to individually change Background vs Sound Effects for example,
    44. #        unless you modify the script itself.
    45. #==============================================================================
    46. #==============================================================================
    47. # ** Module: FG7::Easy_Volume_Control
    48. #------------------------------------------------------------------------------
    49. #  This modules creates a static variable to be used within the script.
    50. #==============================================================================
    51. module FG7
    52.   module Easy_Volume_Control
    53.     # Sets value on the $game_variable to control help control game volume
    54.     Game_Variable_EVC = 22
    55.   end
    56. end
    57. #==============================================================================
    58. # ** Game_System
    59. #------------------------------------------------------------------------------
    60. #  This class handles system data. It saves the disable state of saving and
    61. # menus. Instances of this class are referenced by $game_system.
    62. #==============================================================================
    63. class Game_System
    64.   #--------------------------------------------------------------------------
    65.   # New Method: game_volume_control (Used to control Game Volume)
    66.   #--------------------------------------------------------------------------
    67.   def game_volume_control=(value)
    68.     @game_volume_control = value
    69.     $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = @game_volume_control
    70.   end
    71. end
    72. #==============================================================================
    73. # ** RPG::BGM
    74. #------------------------------------------------------------------------------
    75. #  Default sound for BGM
    76. #==============================================================================
    77. class RPG::BGM < RPG::AudioFile
    78.   #--------------------------------------------------------------------------
    79.   # * Override Method: play
    80.   #--------------------------------------------------------------------------
    81.   def play(pos = 0)
    82.     $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = 100 if $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] == 0
    83.     Audio.bgm_play('Audio/BGM/' + @name, $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC], @pitch, pos) if !@name.empty?
    84.   end
    85. end
    86. #==============================================================================
    87. # ** RPG::ME
    88. #------------------------------------------------------------------------------
    89. #  Default sound for ME
    90. #==============================================================================
    91. class RPG::ME < RPG::AudioFile
    92.   #--------------------------------------------------------------------------
    93.   # * Override Method: play
    94.   #--------------------------------------------------------------------------
    95.   def play
    96.     $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = 100 if $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] == 0
    97.     Audio.me_play('Audio/ME/' + @name, $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC], @pitch) if !@name.empty?
    98.   end
    99. end
    100. #==============================================================================
    101. # ** RPG::BGS
    102. #------------------------------------------------------------------------------
    103. #  Default sound for BGS
    104. #==============================================================================
    105. class RPG::BGS < RPG::AudioFile
    106.   #--------------------------------------------------------------------------
    107.   # * Override Method: play
    108.   #--------------------------------------------------------------------------
    109.   def play(pos = 0)
    110.     $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = 100 if $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] == 0
    111.     Audio.bgs_play('Audio/BGS/' + @name, $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC], @pitch, pos) if !@name.empty?
    112.   end
    113. end
    114. #==============================================================================
    115. # ** RPG::SE
    116. #------------------------------------------------------------------------------
    117. #  Default sound for SE
    118. #==============================================================================
    119. class RPG::SE < RPG::AudioFile
    120.   #--------------------------------------------------------------------------
    121.   # * Override Method: play
    122.   #--------------------------------------------------------------------------
    123.   def play
    124.     $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] = 100 if $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC] == 0
    125.     Audio.se_play('Audio/SE/' + @name, $game_variables[FG7::Easy_Volume_Control::Game_Variable_EVC], @pitch) if !@name.empty?
    126.   end
    127. 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/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 09:25 , Processed in 0.123927 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表