Project1

标题: 可以更改特定的选项光标声音吗 [打印本页]

作者: river12    时间: 2023-3-6 14:41
标题: 可以更改特定的选项光标声音吗
在制作一个特定事件里面的选项,不想出现系统的确定和光标声音,请问如何更改
作者: 小秋橙    时间: 2023-3-6 17:13
SoundManager.playSystemSound = function (n) {
    if ($dataSystem) AudioManager.playStaticSe($dataSystem.sounds[n])
}
SoundManager.playCursor = function () { this.playSystemSound(0) }
SoundManager.playOk = function () { this.playSystemSound(1) }
SoundManager.playCancel = function () { this.playSystemSound(2) }
SoundManager.playBuzzer = function () { this.playSystemSound(3) }
这段代码位于rpg_managers.js第1550行左右,所有的系统音效都是通过类似的函数播放的(共24个)。
选择项界面用到的是其中前四个:0(光标)、1(确定)、2(取消)、3(无法选中)。
因此只要在里面对$gameVariables【变量】、$gameSwitches【开关】、$gameParty【队伍属性】等进行if判断,就可以在特定场合播放其他声效或者不播放任何声效。
播放其他任意声效的代码是 AudioManager.playSe({ name: 'xxx', volume: v, pitch: p })
其中xxx为不带后缀的文件名,v为0到100的音量,p为50到150的音调。

举个例子,当队伍金钱达到10000以上时光标移动的声效改为Blind。
SoundManager.playCursor = function () {
    if ($gameParty._gold >= 10000)
        AudioManager.playSe({ name: 'Blind', volume: 100, pitch: 100 })
    else
        this.playSystemSound(0)
}
作者: river12    时间: 2023-3-7 21:23
小秋橙 发表于 2023-3-6 17:13
SoundManager.playSystemSound = function (n) {
    if ($dataSystem) AudioManager.playStaticSe($dataSy ...

如果是不播放声效呢
作者: 小秋橙    时间: 2023-3-8 11:27
river12 发表于 2023-3-7 21:23
如果是不播放声效呢

SoundManager.playCursor = function () {
    if ($gameParty._gold >= 10000) {
        // AudioManager.playSe({ name: 'Blind', volume: 100, pitch: 100 })
    } else {
        this.playSystemSound(0)
    }
}
那可以像这样用花括号括起来,再用 // 注释掉就不会执行了。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1