| 赞 | 7 |
| VIP | |
| 好人卡 | |
| 积分 | 14 |
| 经验 | |
| 最后登录 | 2026-11-22 |
| 在线时间 | 1079 小时 |
- 梦石
- 0
- 星屑
- 1397
- 在线时间
- 1079 小时
- 注册时间
- 2011-3-26
- 回帖
- 121
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
#==============================================================================
# ■ 音量系统 RGSS1(RMXP) 修复版(自建记录BGM/BGS名称,无Audio.bgm_name报错)
# 调用:事件脚本 $scene = Scene_Volume.new
#==============================================================================
class Game_System
attr_accessor :bgm_vol
attr_accessor :bgs_vol
attr_accessor :se_vol
attr_accessor :me_vol
attr_accessor :current_bgm_name
attr_accessor :current_bgs_name
alias volume_initialize initialize
def initialize
volume_initialize
@bgm_vol = 100
@bgs_vol = 100
@se_vol = 100
@me_vol = 100
@current_bgm_name = ""
@current_bgs_name = ""
end
end
#==============================================================================
# ■ 全局挂钩Audio,自动套用音量 + 记录当前BGM/BGS名称
#==============================================================================
module Audio
class << self
alias vol_bgm_play bgm_play
def bgm_play(filename, volume = 100, pitch = 100)
$game_system.current_bgm_name = filename
vol_bgm_play(filename, $game_system.bgm_vol, pitch)
end
alias vol_bgs_play bgs_play
def bgs_play(filename, volume = 100, pitch = 100)
$game_system.current_bgs_name = filename
vol_bgs_play(filename, $game_system.bgs_vol, pitch)
end
alias vol_se_play se_play
def se_play(filename, volume = 100, pitch = 100)
vol_se_play(filename, $game_system.se_vol, pitch)
end
alias vol_me_play me_play
def me_play(filename, volume = 100, pitch = 100)
vol_me_play(filename, $game_system.me_vol, pitch)
end
end
end
#==============================================================================
# ■ Scene_Volume 音量调节画面
#==============================================================================
class Scene_Volume
def main
items = [
"BGM背景音乐:#{$game_system.bgm_vol}",
"BGS环境音效:#{$game_system.bgs_vol}",
"SE特效音效:#{$game_system.se_vol}",
"ME提示音乐:#{$game_system.me_vol}"
]
@command_window = Window_Command.new(360, items)
@command_window.x = 140
@command_window.y = 80
@index = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@command_window.dispose
end
def refresh
items = [
"BGM背景音乐:#{$game_system.bgm_vol}",
"BGS环境音效:#{$game_system.bgs_vol}",
"SE特效音效:#{$game_system.se_vol}",
"ME提示音乐:#{$game_system.me_vol}"
]
@command_window.dispose
@command_window = Window_Command.new(360, items)
@command_window.x = 140
@command_window.y = 80
@command_window.index = @index
end
def update
@command_window.update
# ↑ 上一项
if Input.trigger?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index -= 1
@index = 3 if @index < 0
@command_window.index = @index
end
# ↓ 下一项
if Input.trigger?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index = 0 if @index > 3
@command_window.index = @index
end
# ← 减小音量
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
case @index
when 0
$game_system.bgm_vol = [0, $game_system.bgm_vol - 5].max
# 如果存在BGM,重新播放,实时生效
if $game_system.current_bgm_name != ""
Audio.bgm_play($game_system.current_bgm_name, $game_system.bgm_vol, 100)
end
when 1
$game_system.bgs_vol = [0, $game_system.bgs_vol - 5].max
if $game_system.current_bgs_name != ""
Audio.bgs_play($game_system.current_bgs_name, $game_system.bgs_vol, 100)
end
when 2
$game_system.se_vol = [0, $game_system.se_vol - 5].max
when 3
$game_system.me_vol = [0, $game_system.me_vol - 5].max
end
refresh
end
# → 增大音量
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
case @index
when 0
$game_system.bgm_vol = [100, $game_system.bgm_vol + 5].min
if $game_system.current_bgm_name != ""
Audio.bgm_play($game_system.current_bgm_name, $game_system.bgm_vol, 100)
end
when 1
$game_system.bgs_vol = [100, $game_system.bgs_vol + 5].min
if $game_system.current_bgs_name != ""
Audio.bgs_play($game_system.current_bgs_name, $game_system.bgs_vol, 100)
end
when 2
$game_system.se_vol = [100, $game_system.se_vol + 5].min
when 3
$game_system.me_vol = [100, $game_system.me_vol + 5].min
end
refresh
end
# ESC 返回地图
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
end
脚本在此,按下f12第31行会出错,豆包写的脚本,我也不知道怎么改…… |
|