查看: 4620|回复: 10

[已经解决] 關於音量音效控制

[复制链接]
梦石
0
星屑
50
在线时间
57 小时
注册时间
2014-9-16
回帖
24
发表于 2014-9-22 21:34:52 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 月歌子 于 2015-11-11 21:48 编辑

關於音量音效的控制,網路上有找到不少VX的腳本,但是ACE卻比較少
這邊有在睡工房找到介面和功能比較符合需求的系統設定腳本

螢幕截圖 2014-09-22 21.29.35.png

目前的問題是,網站提供的腳本有五個:音量,聲音,聲音開關,文字,自動模式
想要將聲音開關用音效取代,但是最多只能做到介面OK,可是想要調整音量就出現錯誤了
一直無法順利調整音效

下面附上目前修改的腳本和出現的錯誤訊息
跪求各位幫幫忙,感激不盡>_<

213143zv26euo926x32nz6.png

共通セーブファイル

[pre lang="ruby" line="1"]#******************************************************************************
#
#   * 共通セーブファイル *
#
#                       for RGSS3
#
#        Ver 1.01   2013.08.24
#
#   ◆使い方
#     数字でも文字でも、お好きな名前(ID)への値の保存/読込が出来ます。
#     1.True/Falseの値の場合
#         例)保存:$savec.set("id", True)
#             読込:$savec.check("id")
#                   ※idが存在しない場合、Falseが返されます。
#
#     2.数字の場合
#         例)保存:$savec.set_num("id", 100)
#             読込:$savec.get_num("id")
#                   ※idが存在しない場合、-1が返されます。
#
#   提供者:睡工房 http://hime.be/
#
#******************************************************************************

#==============================================================================
# コンフィグ項目
#==============================================================================
module SUI
module COMMON_SAVE
  # 共通セーブファイル名
  COMMON_FILE = "savec.rvdata"
end
end
#==============================================================================
# 設定完了
#==============================================================================



class Common_Save
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    @data = {}
    load if FileTest.exist?(SUI::COMMON_SAVE::COMMON_FILE)
  end
  #--------------------------------------------------------------------------
  # ● フラグチェック
  #--------------------------------------------------------------------------
  def check(id)
    @data.include?(id)? @data[id] : false
  end
  #--------------------------------------------------------------------------
  # ● フラグセット
  #--------------------------------------------------------------------------
  def set(id, flg = false)
    unless check(id) == flg
      @data[id] = flg
      save
    end
  end
  #--------------------------------------------------------------------------
  # ● 数値取得
  #--------------------------------------------------------------------------
  def get_num(id)
    @data.include?(id)? @data[id] : -1
  end
  #--------------------------------------------------------------------------
  # ● 数値セット
  #--------------------------------------------------------------------------
  def set_num(id, num = -1)
    unless get_num(id) == num
      @data[id] = num
      save
    end
  end
  #--------------------------------------------------------------------------
  # ● ファイルセーブ
  #--------------------------------------------------------------------------
  def save
    save_data(@data, SUI::COMMON_SAVE::COMMON_FILE)
  end
  #--------------------------------------------------------------------------
  # ● ファイルロード
  #--------------------------------------------------------------------------
  def load
    @data = load_data(SUI::COMMON_SAVE::COMMON_FILE)
  end
end


class << DataManager
  #--------------------------------------------------------------------------
  # ● モジュール初期化
  #--------------------------------------------------------------------------
  alias sui_init init
  def init
    $savec = Common_Save.new
    sui_init
  end
end[/pre]


メッセージ拡張機能

[pre lang="ruby" line="1"]#******************************************************************************
#
#   * メッセージ機能拡張 *
#
#                       for RGSS3
#
#        Ver 1.00   2012.09.16
#        Ver 1.01   2014.01.06  自動モードの不具合修正
#
#   ◆注意事項
#     ※この素材は「共通セーブファイル」スクリプトが必要になります。
#
#
#   ◆機能説明
#
#     1.追加された制御文字で、立ち絵を左・中央・右に表示できます。
#
#     2.追加された制御文字で、音声を再生できます。
#
#     3.追加された制御文字で、SEを再生できます。
#
#     4.追加された制御文字でCGの表示ができます。
#
#     5.上記機能をスクリプトからも実行できます。
#
#     6.コンフィグ項目で指定したボタンで、メッセージ枠を一時消去できます。
#
#     7.コンフィグ項目で指定したボタンで、自動改ページモードに移行できます。
#
#     8.シーンスキップに設定したゲームスイッチをオンにすると、コンフィグ
#         項目で設定したボタンを押すことでスキップ先ラベルまでスキップできます。
#
#
#   ◆使い方
#     http://hime.be/rgss3/sozai/message_manual.txt をご覧ください。
#
#
#   提供者:睡工房 http://hime.be/
#
#******************************************************************************


#==============================================================================
# コンフィグ項目
#==============================================================================
module SUI
module MESSAGE
  # 左側・中央・右側に表示する立ち絵のX座標(絵の左上を基準とします)
  LEFT_X    = 0      # 左側
  CENTER_X  = 180    # 中央
  RIGHT_X   = 360    # 右側
  
  # 立ち絵の表示に使用するピクチャ番号
  LEFT_PIC    = 5    # 左側
  CENTER_PIC  = 6    # 中央
  RIGHT_PIC   = 7    # 右側
  
  # CGの表示に使用するピクチャ番号
  CG_PIC      = 8
  
  # メッセージウィンドウの消去に割り当てるボタンを設定
  # Input::A の形式で指定
  BTN_HIDE = :A
  
  # シーンスキップのボタンを設定
  # Input::X の形式で指定
  BTN_RETURN = :X
  
  # 自動改ページのボタンを設定
  # Input::Y の形式で指定
  BTN_AUTO_MODE = :Y
  
  # 立ち絵の保存場所("Graphics/Pictures/"からの相対パスを指定")
  #SURFACE_DIR = "Surface/"
  SURFACE_DIR = ""
  
  # CGファイルの保存場所("Graphics/Pictures/"からの相対パスを指定")
  #CG_DIR = "CG/"
  CG_DIR = ""
  
  # ボイスファイルの保存場所
  #VOICE_DIR = "Audio/SE/Voice/"
  VOICE_DIR = "Audio/SE/"
  
  # イベントスキップのフラグ(ゲームスイッチの番号指定)
  # このゲームスイッチがオンの時、直近のスキップ先ラベルまでスキップします。
  SW_SKIP_ON = 51
  
  # イベントスキップ先として認識するラベル名
  SKIP_LABEL = "イベントスキップ先"
  
  # 自動改ページの待ち時間(フレーム数を指定)
  # 左から「遅い」,「普通」,「速い」の順に設定します。
  # ※オプション画面スクリプトが未導入の場合、「普通」のみ有効になります。
  AUTO_WAIT = [180, 120, 60]
end
end
#==============================================================================
# 設定完了
#==============================================================================



class Window_Message < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias sui_message_initialize initialize
  def initialize
    sui_message_initialize
    @hide_mode = false          # ウィンドウ消去モード
    @auto_mode = false          # 自動改ページモード
    @auto_count = 0
    create_auto_message
    SUI::MESSAGE::SKIP["skip"] = false
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  alias sui_message_dispose dispose
  def dispose
    sui_message_dispose
    @auto_message.bitmap.dispose
    @auto_message.dispose
  end
  #--------------------------------------------------------------------------
  # ● オートモードの通知メッセージ作成
  #--------------------------------------------------------------------------
  def create_auto_message
    @auto_message = Sprite.new
    @auto_message.x = Graphics.width
    @auto_message.y = 3
    @auto_message.bitmap = Bitmap.new(140, 15)
    @auto_message.bitmap.font.size = 15
    @auto_message.bitmap.gradient_fill_rect(0, 6, 140, 9, Color.new(128, 128, 128, 0), Color.new(128, 128, 128, 180), true)
    @auto_message.bitmap.draw_text(0, 0, @auto_message.bitmap.width, 15, "自動改ページモード", 1)
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias sui_message_update update
  def update
    if @auto_mode and (Input::trigger?(SUI::MESSAGE::BTN_AUTO_MODE) || Input.trigger?(:B) || Input.trigger?(:C))
      @auto_mode = false
      Input.update
    end
    @auto_message.x += 10 if !@auto_mode and @auto_message.x < Graphics.width
    sui_message_update unless update_hide_auto
  end
  #--------------------------------------------------------------------------
  # ● 入力処理
  #--------------------------------------------------------------------------
  def update_hide_auto
    if $game_message.choice?
      return update_hide([self, @choice_window])
    elsif $game_message.num_input?
      return update_hide([self, @number_window])
    elsif $game_message.item_choice?
      return update_hide([self, @item_window])
    else
      return update_hide([self]) unless @pause_skip
    end
  end
  #--------------------------------------------------------------------------
  # ● ウィンドウ消去モードの更新
  #--------------------------------------------------------------------------
  def update_hide(windows)
    if @hide_mode
      if Input.trigger?(:C) or Input.trigger?(SUI::MESSAGE::BTN_HIDE)
        @hide_mode = false
        windows.each do |window|
          window.visible = true
        end
      end
      return true
    else
      if Input.trigger?(SUI::MESSAGE::BTN_HIDE)
        @hide_mode =true
        windows.each do |window|
          window.visible = false
        end
        return true
      end
    return false
    end
  end
  #--------------------------------------------------------------------------
  # ● 入力待ち処理 ※再定義
  #--------------------------------------------------------------------------
  def input_pause
    self.pause = true
    wait(10)
    Fiber.yield until auto_mode || Input.trigger?(:B) || Input.trigger?(:C)
    Input.update
    self.pause = false
  end
  #--------------------------------------------------------------------------
  # ● メッセージ自動送り&スキップ確認
  #--------------------------------------------------------------------------
  def auto_mode
    if @auto_mode
      @auto_count = SUI::MESSAGE::AUTO_WAIT[SUI::OPTION.auto_wait] if @auto_count == 0
      @auto_count -= 1
      @auto_message.x -= 10 if  @auto_message.x > Graphics.width - @auto_message.width
      return true if Input::trigger?(SUI::MESSAGE::BTN_AUTO_MODE)
      return true if @auto_count == 0
      return false
    else
      @auto_mode = true if Input::trigger?(SUI::MESSAGE::BTN_AUTO_MODE)
      if $game_switches[SUI::MESSAGE::SW_SKIP_ON] && Input.trigger?(SUI::MESSAGE::BTN_RETURN)
        SUI::MESSAGE::SKIP["skip"] = true
        return true
      end
      return false
    end
  end
  #--------------------------------------------------------------------------
  # ● 一文字出力後のウェイト
  #--------------------------------------------------------------------------
  alias sui_message_wait_for_one_character wait_for_one_character
  def wait_for_one_character
    case SUI::OPTION.message_speed
    when 0
      wait(1) unless @show_fast or @line_show_fast
      @spd = false
    when 1
      @spd = false
    when 2
      @spd = !@spd
    end
    return unless @show_fast or @line_show_fast or !@spd
    sui_message_wait_for_one_character
  end
  #--------------------------------------------------------------------------
  # ● 制御文字の処理
  #     code : 制御文字の本体部分(「\C[1]」なら「C」)
  #--------------------------------------------------------------------------
  alias sui_process_escape_character process_escape_character
  def process_escape_character(code, text, pos)
    sui_process_escape_character(code, text, pos)
    case code
    when 'l', 'c', 'r'
      text.sub!(/\[(.{1,8})\]/, "")
      if $1 == "off"
        Message.set_tone(code, Tone.new(-40, -40, -40, 0))
      elsif $1 == "on"
        Message.set_tone(code, Tone.new(0, 0, 0, 0))
        for i in Message.get_array(code)
          Message.set_tone(i, Tone.new(-40, -40, -40, 0))
        end
      elsif $1 =="del"
        Message.del_picture(code)
      else
        Message.set_picture(code, $1)
        Message.set_tone(code, Tone.new(0, 0, 0, 0))
        for i in Message.get_array(code)
          Message.set_tone(i, Tone.new(-40, -40, -40, 0))
        end
      end
      wait(16)
    when 's'
        text.sub!(/\[(\w+)(,(\d+))?(,(\d+))?\]/, "")
        Audio.se_play("Audio/SE/#{$1}", ($3 ? $3.to_i : 100), ($5 ? $5.to_i : 100))
    when 'v'
        text.sub!(/\[([0-9a-zA-Z_\/]+)\]/, "")
        Message.play_voice($1)
    when 'p'
      text.sub!(/\[(.+)\]/, "")
      if $1 == "del"
        Message.del_cg
      else
        Message.set_cg($1)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 指定の位置を除いた配列を取得
  #--------------------------------------------------------------------------
  def self.get_array(pos)
    tmp = ["l", "c", "r"]
    tmp.delete(pos)
    return tmp
  end
  #--------------------------------------------------------------------------
  # ● CGの表示
  #--------------------------------------------------------------------------
  def self.set_cg(file)
    name = SUI::MESSAGE::CG_DIR + file
    zoom_x = 100.0
    zoom_y = 100.0
    opacity = 255.0
    blend_type = 0
    origin = 0
    x = 0
    y = 0
    $game_map.screen.pictures[SUI::MESSAGE::CG_PIC].show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
  end
  #--------------------------------------------------------------------------
  # ● CGの消去
  #--------------------------------------------------------------------------
  def self.del_cg
    $game_map.screen.pictures[SUI::MESSAGE::CG_PIC].erase
  end
  #--------------------------------------------------------------------------
  # ● 立ち絵の表示
  #--------------------------------------------------------------------------
  def self.set_picture(pos, file, flg = true)
    name = SUI::MESSAGE::SURFACE_DIR + file
    zoom_x = 100.0
    zoom_y = 100.0
    opacity = 255.0
    blend_type = 0
    origin = 0
    y = 0
    if pos == "l"
      x = SUI::MESSAGE::LEFT_X
      p = SUI::MESSAGE::LEFT_PIC
    elsif pos == "c"
      x = SUI::MESSAGE::CENTER_X
      p = SUI::MESSAGE::CENTER_PIC
    elsif pos == "r"
      x = SUI::MESSAGE::RIGHT_X
      p = SUI::MESSAGE::RIGHT_PIC
    end
    $game_map.screen.pictures[p].show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
    set_tone(pos, Tone.new(-40, -40, -40, 0)) unless flg
  end
  #--------------------------------------------------------------------------
  # ● 立ち絵の消去
  #--------------------------------------------------------------------------
  def self.del_picture(pos)
    if pos == "l"
      p = SUI::MESSAGE::LEFT_PIC
    elsif pos == "c"
      p = SUI::MESSAGE::CENTER_PIC
    elsif pos == "r"
      p = SUI::MESSAGE::RIGHT_PIC
    end
    $game_map.screen.pictures[p].erase
  end
  #--------------------------------------------------------------------------
  # ● トーンの設定
  #--------------------------------------------------------------------------
  def self.set_tone(pos, tone)
    if pos == "l"
      p = SUI::MESSAGE::LEFT_PIC
    elsif pos == "c"
      p = SUI::MESSAGE::CENTER_PIC
    elsif pos == "r"
      p = SUI::MESSAGE::RIGHT_PIC
    end
    $game_map.screen.pictures[p].start_tone_change(tone, 0)
  end
  #--------------------------------------------------------------------------
  # ● ボイスの再生
  #--------------------------------------------------------------------------
  def self.play_voice(file)
    unless $savec.check("voice")
      Audio.se_stop
      vol = SUI::OPTION.voice_volume
      Audio.se_play("#{SUI::MESSAGE::VOICE_DIR}#{file}", 100 * vol, 100)
    end
  end
end
Message = Window_Message


module SuiScript
  #--------------------------------------------------------------------------
  # ● CGの表示
  #--------------------------------------------------------------------------
  def self.set_cg(file)
    if file == "del"
      Message.del_cg
    else
      Message.set_cg(file)
    end
  end
  #--------------------------------------------------------------------------
  # ● 立ち絵の表示
  #--------------------------------------------------------------------------
  def self.set_picture(pos, file, flg = true)
    if file == "off"
      Message.set_tone(pos, Tone.new(-40, -40, -40, 0))
    elsif file == "on"
      Message.set_tone(pos, Tone.new(0, 0, 0, 0))
      for i in Message.get_array(pos)
        Message.set_tone(i, Tone.new(-40, -40, -40, 0))
      end
    elsif file =="del"
      Message.del_picture(pos)
    else
      Message.set_picture(pos, file, flg)
      return unless flg
      Message.set_tone(pos, Tone.new(0, 0, 0, 0))
      for i in Message.get_array(pos)
        Message.set_tone(i, Tone.new(-40, -40, -40, 0))
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● SEの再生
  #--------------------------------------------------------------------------
  def self.play_se(file, vol = 100, pitch = 100)
    Audio.se_play("Audio/SE/#{file}", vol, pitch)
  end
  #--------------------------------------------------------------------------
  # ● ボイスの再生
  #--------------------------------------------------------------------------
  def self.play_voice(file)
    Message.play_voice(file)
  end
end


class Game_Interpreter
  #--------------------------------------------------------------------------
  # ● イベントコマンドの実行
  #--------------------------------------------------------------------------
  alias sui_interpreter_execute_command execute_command
  def execute_command
    if SUI::MESSAGE::SKIP["skip"]
      SUI::MESSAGE::SKIP["skip"] = false
      $game_switches[SUI::MESSAGE::SW_SKIP_ON] = false
      return if label_jump
    end
    sui_interpreter_execute_command
  end
  #--------------------------------------------------------------------------
  # ● ラベルジャンプ
  #--------------------------------------------------------------------------
  def label_jump
    label_name = SUI::MESSAGE::SKIP_LABEL
    @list.size.times do |i|
      if @list.code == 118 && @list.parameters[0] == label_name
        @index = i
        return true
      end
    end
    return false
  end
end


module SUI::MESSAGE
  SKIP = {}
end


module SUI::OPTION
  def self.bgm_volume
    vol = $savec.get_num("bgm_vol")
    vol = 70 if vol < 10
    vol /=  100.0
    return vol
  end
  def self.se_volume
    vol = $savec.get_num("se_vol")
    vol = 70 if vol < 10
    vol /=  100.0
    return vol
  end
  def self.voice_volume
    vol = $savec.get_num("voice_vol")
    vol = 70 if vol < 10
    vol /= 100.0
    return vol
  end
  def self.message_speed
    spd = $savec.get_num("speed")
    spd = 1 if spd == -1
    return spd
  end
  def self.auto_wait
    spd = $savec.get_num("auto_wait")
    spd = 1 if spd == -1
    return spd
  end
end[/pre]


オプション画面

[pre lang="ruby" line="1"]#******************************************************************************
#
#   * オプション画面 *
#
#                       for RGSS3
#
#        Ver 1.01   2014.07.13
#
#   ◆注意事項
#     ※この素材は「共通セーブファイル」スクリプトが必要になります。
#     ※この素材は睡工房の素材をカスタマイズするものです。
#      メッセージ機能拡張スクリプトを導入しない場合、機能2~5は無効となります。
#
#
#   ◆機能説明
#
#     1.BGMの再生ボリュームを変更できます。
#
#     2.ボイスの再生ボリュームを変更できます。
#
#     3.ボイス再生のオン/オフ切り替えができます。
#
#     4.文字表示速度の変更ができます。
#
#     5.自動改ページの待ち時間を変更できます。
#
#
#   ◆使い方
#     スクリプトで「Scene_Option.start」を実行すると、
#     オプション画面が開きます。
#
#     メニュー画面をカスタマイズしたい場合は、以下のURLを参考にしてください。
#     http://hime.be/rgss3/option.html
#
#
#   提供者:睡工房 http://hime.be/
#
#******************************************************************************


#==============================================================================
# コンフィグ項目
#==============================================================================
module SUI
module OPTION
  # ボイス再生ボリューム変更時のサンプルボイス
  # 指定したボイスからランダムで1つ、新しいボリュームで再生されます。
  # サンプルボイスがいらない場合は空にしてください。
  SAMPLE = [
  #ファイル名
#  "sample_voice01",
#  "sample_voice02",
   "Cat",
   "Crow",
   "Dog",
  ]
  
  # ボイスファイルの保存場所
  #VOICE_DIR = "Audio/SE/Voice/"
  VOICE_DIR = "Audio/SE/"
end
end
#==============================================================================
# 設定完了
#==============================================================================



class Window_Option < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 430, 330)
    self.openness = 0
    self.x = Graphics.width / 2 - self.width / 2
    self.y = Graphics.height / 2 - self.height / 2 + line_height / 2 + padding
    self.z = 160
    @line = 0
    set_index
    refresh
    update_cursor
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    contents.font.color = normal_color
    contents.draw_text(0, 0 * rows_height, contents.width, line_height, "音樂")
    contents.draw_text(0, 1 * rows_height, contents.width, line_height, "聲音")
    contents.draw_text(0, 2 * rows_height, contents.width, line_height, "音效")
    #contents.draw_text(0, 2 * rows_height, contents.width, line_height, "キャラクターボイス")
    contents.draw_text(0, 3 * rows_height, contents.width, line_height, "文字")
    contents.draw_text(0, 4 * rows_height, contents.width, line_height, "自動模式")
    draw_command_10(0)
    draw_command_10(1)
    draw_command_10(2)
    #draw_command_2(2)
    draw_command_3(3)
    draw_command_3(4)
  end
  #--------------------------------------------------------------------------
  # ● 行の高さ(2行分)
  #--------------------------------------------------------------------------
  def rows_height
    60
  end
  #--------------------------------------------------------------------------
  # ● 文字の描画
  #--------------------------------------------------------------------------
  def draw_text2(x, y, w, text, blue = false)
    contents.font.color = blue ? system_color : normal_color
    contents.font.color.alpha = blue ? 255 : 128
    draw_text(x, y, w, line_height, text)
  end
  #--------------------------------------------------------------------------
  # ● 10コマンドの描画
  #--------------------------------------------------------------------------
  def draw_command_10(row)
    y = rows_height * row + line_height
    10.times do |i|
      x = 30 + 36 * i - ((i == 9) ? 2 : 0)
      draw_text2(x, y, 30, ((i + 1) * 10).to_s, (i == @index[row]))
    end
  end
  #--------------------------------------------------------------------------
  # ● 10コマンドの矩形を取得
  #--------------------------------------------------------------------------
  def item_rect_10
    rect = Rect.new
    rect.x = 30 - 9 + 36 * @index[@line]
    rect.y = rows_height * @line + line_height
    rect.width = 30 + 8
    rect.height = line_height
    rect
  end
  #--------------------------------------------------------------------------
  # ● 2コマンドの描画
  #--------------------------------------------------------------------------
  def draw_command_2(row)
    y = rows_height * row + line_height
    list = ["オン", "オフ"]
    2.times do |i|
      x = 30 + 100 * i
      draw_text2(x, y, 40, list, (i == @index[row]))
    end
  end
  #--------------------------------------------------------------------------
  # ● 2コマンドの矩形を取得
  #--------------------------------------------------------------------------
  def item_rect_2
    rect = Rect.new
    rect.x = 30 - 11+ 100 * @index[@line]
    rect.y = rows_height * @line + line_height
    rect.width = 50 + 8
    rect.height = line_height
    rect
  end
  #--------------------------------------------------------------------------
  # ● 3コマンドの描画
  #--------------------------------------------------------------------------
  def draw_command_3(row)
    y = rows_height * row + line_height
    list = ["慢", "普通", "快"]
    3.times do |i|
      x = 30 + 80 * i
      draw_text2(x, y, 40, list, (i == @index[row]))
    end
  end
  #--------------------------------------------------------------------------
  # ● 3コマンドの矩形を取得
  #--------------------------------------------------------------------------
  def item_rect_3
    rect = Rect.new
    rect.x = 30 - 11 + 80 * @index[@line]
    rect.y = rows_height * @line + line_height
    rect.width = 50 + 8
    rect.height = line_height
    rect
  end
  #--------------------------------------------------------------------------
  # ● カーソルの更新
  #--------------------------------------------------------------------------
  def update_cursor
    case @line
      when 0, 1, 2
        cursor_rect.set(item_rect_10)
      #when 2
        #cursor_rect.set(item_rect_2)
      when 3, 4
        cursor_rect.set(item_rect_3)
      end
      Sound.play_cursor
  end
  #--------------------------------------------------------------------------
  # ● 行の設定
  #--------------------------------------------------------------------------
  def line=(row)
    old = @line
    @line = [[@line + row, 0].max, 4].min
    update_cursor if old != @line
  end
  #--------------------------------------------------------------------------
  # ● 行の設定
  #--------------------------------------------------------------------------
  def index=(i)
    max = 9 if( @line == 0 || @line == 1 || @line == 2)
    #max = 1 if( @line == 2)
    max = 2 if( @line == 3 || @line == 4)
    old = @index[@line]
    @index[@line] = [[@index[@line] + i, 0].max, max].min
    update_cursor if old != @index[@line]
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.openness == 255
    self.line = +1 if Input.repeat?(:DOWN)
    self.line = -1 if Input.repeat?(:UP)
    self.index = +1 if Input.repeat?(:RIGHT)
    self.index = -1 if Input.repeat?(:LEFT)
    if Input.trigger?(:C)
      Sound.play_use_item
      case @line
        when 0
          $savec.set_num("bgm_vol", (@index[@line] + 1) * 10)
          refresh
          RPG::BGM::last.play
        when 1
          $savec.set_num("voice_vol", (@index[@line] + 1) * 10)
          refresh
          Audio.se_stop
          vol = SUI::OPTION.voice_volume
          return if SUI::OPTION::SAMPLE.length == 0
          r = SUI::OPTION::SAMPLE[rand(SUI::OPTION::SAMPLE.length)]
          Audio.se_play("#{SUI::OPTION::VOICE_DIR}#{r}", 100 * vol)
        when 2
          #$savec.set("voice", @index[@line] == 1)
          #refresh
          $savec.set_num("se_vol", (@index[@line] + 1) * 10)
          refresh
          Audio.se_stop
          RPG::SE::last.play
        when 3
          $savec.set_num("speed", @index[@line])
          refresh
        when 4
          $savec.set_num("auto_wait", @index[@line])
          refresh
        end
    end
  end
  #--------------------------------------------------------------------------
  # ● アクティブ設定
  #--------------------------------------------------------------------------
  def set_index
    @index = []
   
    res = $savec.get_num("bgm_vol")
    res = 70 if res < 10
    @index[0] = (res / 10) - 1
   
    res = $savec.get_num("voice_vol")
    res = 70 if res < 10
    @index[1] = (res / 10) - 1
   
    res = $savec.get_num("se_vol")
    res = 70 if res < 10
    @index[2] = (res / 10) - 1
    #@index[2] = $savec.check("voice") ? 1 : 0
   
    @index[3] = $savec.get_num("speed")
    @index[3] = 1 if @index[3] == -1
   
    @index[4] = $savec.get_num("auto_wait")
    @index[4] = 1 if @index[4] == -1
  end
end


class Scene_Option < Scene_Base
  #--------------------------------------------------------------------------
  # ● クラス変数初期化
  #--------------------------------------------------------------------------
  @@start  = false         # オプション画面の開始フラグ
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  def start
    super
    @@start = false
    @config_seq = 0
    create_background
    create_option_window
    @option_window.open
    @option_title.open
  end
  #--------------------------------------------------------------------------
  # ● 終了処理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_background
  end
  #--------------------------------------------------------------------------
  # ● オプションウィンドウの作成
  #--------------------------------------------------------------------------
  def create_option_window
    @option_window = Window_Option.new
    @option_title = Window_Help.new(1)
    @option_title.x = @option_window.x
    @option_title.width = @option_window.width
    @option_title.y = @option_window.y - @option_title.height
    @option_title.z = @option_window.z
    @option_title.create_contents
    @option_title.openness = 0
    @option_title.contents.draw_text(0, -2, @option_title.contents.width,@option_title.contents.height, "* 系統設定 *", 1)
  end
  #--------------------------------------------------------------------------
  # ● 背景の作成
  #--------------------------------------------------------------------------
  def create_background
    @background_sprite = Sprite.new
    @background_sprite.bitmap = SceneManager.background_bitmap
    @background_sprite.color.set(16, 16, 16, 128)
  end
  #--------------------------------------------------------------------------
  # ● 背景の解放
  #--------------------------------------------------------------------------
  def dispose_background
    @background_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● 更新処理
  #--------------------------------------------------------------------------
  def update
    super
    if Input.trigger?(:B)
      Sound.play_cancel
      @option_window.close
      @option_title.close
    end
    if @option_window.openness == 0
      SceneManager.return
    end
  end
  #--------------------------------------------------------------------------
  # ● オプション画面スタート処理
  #--------------------------------------------------------------------------
  def self.start
    @@start = true
  end
  #--------------------------------------------------------------------------
  # ● オプション画面が開始しているか?
  #--------------------------------------------------------------------------
  def self.start?
    return @@start
  end
end


module RPG
  class BGM < AudioFile
    #--------------------------------------------------------------------------
    # ● BGMの再生 ※再定義
    #--------------------------------------------------------------------------
    def play(pos = 0)
      if @name.empty?
        Audio.bgm_stop
        @@last = RPG::BGM.new
      else
        vol = SUI::OPTION::bgm_volume * 1.05
        vol = [@volume * vol, 100].min                          # Ver 1.01
        Audio.bgm_play("Audio/BGM/" + @name, vol, @pitch, pos)  # Ver 1.01
#~         Audio.bgm_play("Audio/BGM/" + @name, @volume * vol, @pitch, pos)
        @@last = self.clone
      end
    end
  end
    class SE < AudioFile
    #--------------------------------------------------------------------------
    # ● BGMの再生 ※再定義
    #--------------------------------------------------------------------------
    def play(pos = 0)
      if @name.empty?
        Audio.se_stop
        @@last = RPG::SE.new
      else
        vol = SUI::OPTION::se_volume * 1.05
        vol = [@volume * vol, 100].min                          # Ver 1.01
        Audio.se_play("Audio/SE/" + name)
        @@last = self.clone
      end
    end
  end
end


class Scene_Map
  #--------------------------------------------------------------------------
  # ● オプション画面への移行
  #--------------------------------------------------------------------------
  alias sui_option_update_scene update_scene
  def update_scene
    sui_option_update_scene
    SceneManager.call(Scene_Option) if !scene_changing? && Scene_Option.start?
  end
end[/pre]   
梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
回帖
244
发表于 2014-9-23 17:40:31 | 显示全部楼层
本帖最后由 蝉岭Cicada 于 2014-9-23 17:42 编辑

你是要把声音那两行删掉吗?

还是留着把原本的音效改掉?

点评

如果可以將聲音控制改成全音效控制的話,對我來說是更理想的了!!  发表于 2014-9-23 22:07
原本的音效似乎只有控制聲音(修改時還會出現動物聲音供我確認大小),但系統音效不會被修改(比方說按鈕)  发表于 2014-9-23 22:06
回复

使用道具 举报

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-9-23 17:47:35 | 显示全部楼层
本帖最后由 taroxd 于 2014-9-23 17:52 编辑

因为RM自带的BGM有记忆的功能,但SE没有。因此问题确实就出在报错的那一行上。其他的我没仔细看,我相信应该没什么问题。

把那一行改成播放固定的一个音效吧。既然已经改好了这么多了,我相信这点事情应该不难吧。
当然,你自己仿照 RPG::BGM.last (见F1文档)定义一个自己的 RPG::SE.last 也同样是可以的。

评分

参与人数 1星屑 +150 收起 理由
VIPArcher + 150 我很赞同

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
57 小时
注册时间
2014-9-16
回帖
24
 楼主| 发表于 2014-9-23 22:07:55 | 显示全部楼层
本帖最后由 月歌子 于 2015-11-11 21:53 编辑
taroxd 发表于 2014-9-23 17:47
因为RM自带的BGM有记忆的功能,但SE没有。因此问题确实就出在报错的那一行上。其他的我没仔细看,我相信应 ...


你好,我參考F1文檔定義了一個

[pre lang="ruby" line="1"]module RPG
class SE < AudioFile
  def play
    unless @name.empty?
      Audio.se_play('Audio/SE/' + @name, @volume, @pitch)
    end
  end
  def self.stop
    Audio.se_stop
  end
end
end[/pre]

請問我要在要修改的那行要如何呼叫他呢?
這邊有點看不懂RPG::SE的解釋,寫RPG::SE.end,音效就理所當然停止了也沒有紀錄修改,RPG::SE.play會出現以下錯誤

220340afb2whbhd1fn2fpy.png
回复

使用道具 举报

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
回帖
244
发表于 2014-9-23 22:22:53 | 显示全部楼层
本帖最后由 蝉岭Cicada 于 2014-9-23 22:29 编辑

改成
class RPG::SE < RPG::AudioFile
  def self.play
      ...
   end
end


呼叫
RPG::SE.play


所以应该写成
RPG::SE.stop
RPG::SE.play
回复

使用道具 举报

梦石
0
星屑
50
在线时间
57 小时
注册时间
2014-9-16
回帖
24
 楼主| 发表于 2014-9-23 22:36:54 | 显示全部楼层
本帖最后由 月歌子 于 2015-11-11 21:55 编辑
蝉岭Cicada 发表于 2014-9-23 22:22
改成
class RPG::SE < RPG::AudioFile
  def self.play


你好,我試著修改上面的呼叫和下面的class內容
  1. #******************************************************************************
  2. #
  3. #   * オプション画面 *
  4. #
  5. #                       for RGSS3
  6. #
  7. #        Ver 1.01   2014.07.13
  8. #
  9. #   ◆注意事項
  10. #     ※この素材は「共通セーブファイル」スクリプトが必要になります。
  11. #     ※この素材は睡工房の素材をカスタマイズするものです。
  12. #      メッセージ機能拡張スクリプトを導入しない場合、機能2~5は無効となります。
  13. #
  14. #
  15. #   ◆機能説明
  16. #
  17. #     1.BGMの再生ボリュームを変更できます。
  18. #
  19. #     2.ボイスの再生ボリュームを変更できます。
  20. #
  21. #     3.ボイス再生のオン/オフ切り替えができます。
  22. #
  23. #     4.文字表示速度の変更ができます。
  24. #
  25. #     5.自動改ページの待ち時間を変更できます。
  26. #
  27. #
  28. #   ◆使い方
  29. #     スクリプトで「Scene_Option.start」を実行すると、
  30. #     オプション画面が開きます。
  31. #
  32. #     メニュー画面をカスタマイズしたい場合は、以下のURLを参考にしてください。
  33. #     http://hime.be/rgss3/option.html
  34. #
  35. #
  36. #   提供者:睡工房 http://hime.be/
  37. #
  38. #******************************************************************************


  39. #==============================================================================
  40. # コンフィグ項目
  41. #==============================================================================
  42. module SUI
  43. module OPTION
  44.   # ボイス再生ボリューム変更時のサンプルボイス
  45.   # 指定したボイスからランダムで1つ、新しいボリュームで再生されます。
  46.   # サンプルボイスがいらない場合は空にしてください。
  47.   SAMPLE = [
  48.   #ファイル名
  49. #  "sample_voice01",
  50. #  "sample_voice02",
  51.    "Cat",
  52.    "Crow",
  53.    "Dog",
  54.   ]
  55.   
  56.   # ボイスファイルの保存場所
  57.   #VOICE_DIR = "Audio/SE/Voice/"
  58.   VOICE_DIR = "Audio/SE/"
  59. end
  60. end
  61. #==============================================================================
  62. # 設定完了
  63. #==============================================================================



  64. class Window_Option < Window_Base
  65.   #--------------------------------------------------------------------------
  66.   # ● オブジェクト初期化
  67.   #--------------------------------------------------------------------------
  68.   def initialize
  69.     super(0, 0, 430, 330)
  70.     self.openness = 0
  71.     self.x = Graphics.width / 2 - self.width / 2
  72.     self.y = Graphics.height / 2 - self.height / 2 + line_height / 2 + padding
  73.     self.z = 160
  74.     [url=home.php?mod=space&uid=401263]@line[/url] = 0
  75.     set_index
  76.     refresh
  77.     update_cursor
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● リフレッシュ
  81.   #--------------------------------------------------------------------------
  82.   def refresh
  83.     self.contents.clear
  84.     contents.font.color = normal_color
  85.     contents.draw_text(0, 0 * rows_height, contents.width, line_height, "音樂")
  86.     contents.draw_text(0, 1 * rows_height, contents.width, line_height, "聲音")
  87.     contents.draw_text(0, 2 * rows_height, contents.width, line_height, "音效")
  88.     #contents.draw_text(0, 2 * rows_height, contents.width, line_height, "キャラクターボイス")
  89.     contents.draw_text(0, 3 * rows_height, contents.width, line_height, "文字")
  90.     contents.draw_text(0, 4 * rows_height, contents.width, line_height, "自動模式")
  91.     draw_command_10(0)
  92.     draw_command_10(1)
  93.     draw_command_10(2)
  94.     #draw_command_2(2)
  95.     draw_command_3(3)
  96.     draw_command_3(4)
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 行の高さ(2行分)
  100.   #--------------------------------------------------------------------------
  101.   def rows_height
  102.     60
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # ● 文字の描画
  106.   #--------------------------------------------------------------------------
  107.   def draw_text2(x, y, w, text, blue = false)
  108.     contents.font.color = blue ? system_color : normal_color
  109.     contents.font.color.alpha = blue ? 255 : 128
  110.     draw_text(x, y, w, line_height, text)
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● 10コマンドの描画
  114.   #--------------------------------------------------------------------------
  115.   def draw_command_10(row)
  116.     y = rows_height * row + line_height
  117.     10.times do |i|
  118.       x = 30 + 36 * i - ((i == 9) ? 2 : 0)
  119.       draw_text2(x, y, 30, ((i + 1) * 10).to_s, (i == @index[row]))
  120.     end
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 10コマンドの矩形を取得
  124.   #--------------------------------------------------------------------------
  125.   def item_rect_10
  126.     rect = Rect.new
  127.     rect.x = 30 - 9 + 36 * @index[@line]
  128.     rect.y = rows_height * @line + line_height
  129.     rect.width = 30 + 8
  130.     rect.height = line_height
  131.     rect
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 2コマンドの描画
  135.   #--------------------------------------------------------------------------
  136.   def draw_command_2(row)
  137.     y = rows_height * row + line_height
  138.     list = ["オン", "オフ"]
  139.     2.times do |i|
  140.       x = 30 + 100 * i
  141.       draw_text2(x, y, 40, list[i], (i == @index[row]))
  142.     end
  143.   end
  144.   #--------------------------------------------------------------------------
  145.   # ● 2コマンドの矩形を取得
  146.   #--------------------------------------------------------------------------
  147.   def item_rect_2
  148.     rect = Rect.new
  149.     rect.x = 30 - 11+ 100 * @index[@line]
  150.     rect.y = rows_height * @line + line_height
  151.     rect.width = 50 + 8
  152.     rect.height = line_height
  153.     rect
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 3コマンドの描画
  157.   #--------------------------------------------------------------------------
  158.   def draw_command_3(row)
  159.     y = rows_height * row + line_height
  160.     list = ["慢", "普通", "快"]
  161.     3.times do |i|
  162.       x = 30 + 80 * i
  163.       draw_text2(x, y, 40, list[i], (i == @index[row]))
  164.     end
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 3コマンドの矩形を取得
  168.   #--------------------------------------------------------------------------
  169.   def item_rect_3
  170.     rect = Rect.new
  171.     rect.x = 30 - 11 + 80 * @index[@line]
  172.     rect.y = rows_height * @line + line_height
  173.     rect.width = 50 + 8
  174.     rect.height = line_height
  175.     rect
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● カーソルの更新
  179.   #--------------------------------------------------------------------------
  180.   def update_cursor
  181.     case @line
  182.       when 0, 1, 2
  183.         cursor_rect.set(item_rect_10)
  184.       #when 2
  185.         #cursor_rect.set(item_rect_2)
  186.       when 3, 4
  187.         cursor_rect.set(item_rect_3)
  188.       end
  189.       Sound.play_cursor
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 行の設定
  193.   #--------------------------------------------------------------------------
  194.   def line=(row)
  195.     old = @line
  196.     @line = [[@line + row, 0].max, 4].min
  197.     update_cursor if old != @line
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ● 行の設定
  201.   #--------------------------------------------------------------------------
  202.   def index=(i)
  203.     max = 9 if( @line == 0 || @line == 1 || @line == 2)
  204.     #max = 1 if( @line == 2)
  205.     max = 2 if( @line == 3 || @line == 4)
  206.     old = @index[@line]
  207.     @index[@line] = [[@index[@line] + i, 0].max, max].min
  208.     update_cursor if old != @index[@line]
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● フレーム更新
  212.   #--------------------------------------------------------------------------
  213.   def update
  214.     super
  215.     return unless self.openness == 255
  216.     self.line = +1 if Input.repeat?(:DOWN)
  217.     self.line = -1 if Input.repeat?(:UP)
  218.     self.index = +1 if Input.repeat?(:RIGHT)
  219.     self.index = -1 if Input.repeat?(:LEFT)
  220.     if Input.trigger?(:C)
  221.       Sound.play_use_item
  222.       case @line
  223.         when 0
  224.           $savec.set_num("bgm_vol", (@index[@line] + 1) * 10)
  225.           refresh
  226.           RPG::BGM::last.play
  227.         when 1
  228.           $savec.set_num("voice_vol", (@index[@line] + 1) * 10)
  229.           refresh
  230.           Audio.se_stop
  231.           vol = SUI::OPTION.voice_volume
  232.           return if SUI::OPTION::SAMPLE.length == 0
  233.           r = SUI::OPTION::SAMPLE[rand(SUI::OPTION::SAMPLE.length)]
  234.           Audio.se_play("#{SUI::OPTION::VOICE_DIR}#{r}", 100 * vol)
  235.         when 2
  236.           #$savec.set("voice", @index[@line] == 1)
  237.           #refresh
  238.           $savec.set_num("se_vol", (@index[@line] + 1) * 10)
  239.           refresh
  240.           RPG::SE.stop
  241.           RPG::SE.play
  242.         when 3
  243.           $savec.set_num("speed", @index[@line])
  244.           refresh
  245.         when 4
  246.           $savec.set_num("auto_wait", @index[@line])
  247.           refresh
  248.         end
  249.     end
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● アクティブ設定
  253.   #--------------------------------------------------------------------------
  254.   def set_index
  255.     @index = []
  256.    
  257.     res = $savec.get_num("bgm_vol")
  258.     res = 70 if res < 10
  259.     @index[0] = (res / 10) - 1
  260.    
  261.     res = $savec.get_num("voice_vol")
  262.     res = 70 if res < 10
  263.     @index[1] = (res / 10) - 1
  264.    
  265.     res = $savec.get_num("se_vol")
  266.     res = 70 if res < 10
  267.     @index[2] = (res / 10) - 1
  268.     #@index[2] = $savec.check("voice") ? 1 : 0
  269.    
  270.     @index[3] = $savec.get_num("speed")
  271.     @index[3] = 1 if @index[3] == -1
  272.    
  273.     @index[4] = $savec.get_num("auto_wait")
  274.     @index[4] = 1 if @index[4] == -1
  275.   end
  276. end


  277. class Scene_Option < Scene_Base
  278.   #--------------------------------------------------------------------------
  279.   # ● クラス変数初期化
  280.   #--------------------------------------------------------------------------
  281.   @@start  = false         # オプション画面の開始フラグ
  282.   #--------------------------------------------------------------------------
  283.   # ● 開始処理
  284.   #--------------------------------------------------------------------------
  285.   def start
  286.     super
  287.     @@start = false
  288.     @config_seq = 0
  289.     create_background
  290.     create_option_window
  291.     @option_window.open
  292.     @option_title.open
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● 終了処理
  296.   #--------------------------------------------------------------------------
  297.   def terminate
  298.     super
  299.     dispose_background
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● オプションウィンドウの作成
  303.   #--------------------------------------------------------------------------
  304.   def create_option_window
  305.     @option_window = Window_Option.new
  306.     @option_title = Window_Help.new(1)
  307.     @option_title.x = @option_window.x
  308.     @option_title.width = @option_window.width
  309.     @option_title.y = @option_window.y - @option_title.height
  310.     @option_title.z = @option_window.z
  311.     @option_title.create_contents
  312.     @option_title.openness = 0
  313.     @option_title.contents.draw_text(0, -2, @option_title.contents.width,@option_title.contents.height, "* 系統設定 *", 1)
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ● 背景の作成
  317.   #--------------------------------------------------------------------------
  318.   def create_background
  319.     @background_sprite = Sprite.new
  320.     @background_sprite.bitmap = SceneManager.background_bitmap
  321.     @background_sprite.color.set(16, 16, 16, 128)
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● 背景の解放
  325.   #--------------------------------------------------------------------------
  326.   def dispose_background
  327.     @background_sprite.dispose
  328.   end
  329.   #--------------------------------------------------------------------------
  330.   # ● 更新処理
  331.   #--------------------------------------------------------------------------
  332.   def update
  333.     super
  334.     if Input.trigger?(:B)
  335.       Sound.play_cancel
  336.       @option_window.close
  337.       @option_title.close
  338.     end
  339.     if @option_window.openness == 0
  340.       SceneManager.return
  341.     end
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # ● オプション画面スタート処理
  345.   #--------------------------------------------------------------------------
  346.   def self.start
  347.     @@start = true
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # ● オプション画面が開始しているか?
  351.   #--------------------------------------------------------------------------
  352.   def self.start?
  353.     return @@start
  354.   end
  355. end

  356. module RPG
  357.   class BGM < AudioFile
  358.     #--------------------------------------------------------------------------
  359.     # ● BGMの再生 ※再定義
  360.     #--------------------------------------------------------------------------
  361.     def play(pos = 0)
  362.       if @name.empty?
  363.         Audio.bgm_stop
  364.         @@last = RPG::BGM.new
  365.       else
  366.         vol = SUI::OPTION::bgm_volume * 1.05
  367.         vol = [@volume * vol, 100].min                          # Ver 1.01
  368.         Audio.bgm_play("Audio/BGM/" + @name, vol, @pitch, pos)  # Ver 1.01
  369. #~         Audio.bgm_play("Audio/BGM/" + @name, @volume * vol, @pitch, pos)
  370.         @@last = self.clone
  371.       end
  372.     end
  373.   end
  374. end

  375. class RPG::SE < RPG::AudioFile
  376.   def self.play
  377.     unless @name.empty?
  378.     Audio.se_play('Audio/SE/' + @name, @volume, @pitch)
  379.     end
  380.   end
  381.   def self.stop
  382.     Audio.se_stop
  383.    end
  384. end

  385. class Scene_Map
  386.   #--------------------------------------------------------------------------
  387.   # ● オプション画面への移行
  388.   #--------------------------------------------------------------------------
  389.   alias sui_option_update_scene update_scene
  390.   def update_scene
  391.     sui_option_update_scene
  392.     SceneManager.call(Scene_Option) if !scene_changing? && Scene_Option.start?
  393.   end
  394. end
复制代码
產生問題如下(問題似乎從play變成empty了)

223604ik0ouskzbqqwkw7x.png
回复

使用道具 举报

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
回帖
244
发表于 2014-9-23 23:08:05 | 显示全部楼层
本帖最后由 蝉岭Cicada 于 2014-9-23 23:10 编辑

忘了new

再改
class RPG::SE < RPG::AudioFile
  @@last = RPG::SE.new
  def play
    unless @name.empty?
    Audio.se_play('Audio/SE/' + @name, @volume, @pitch)
    end
  end
  def self.stop
    Audio.se_stop
   end
  def self.last
    @@last
  end
end

这样就会变成
RPG::SE.stop
RPG::SE.last.play

评分

参与人数 1梦石 +1 收起 理由
VIPArcher + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
57 小时
注册时间
2014-9-16
回帖
24
 楼主| 发表于 2014-9-23 23:30:18 | 显示全部楼层
這樣修改已經沒有出現錯誤訊息了!!
但是不曉得為什麼改音效音量的時候,他不像調整音樂時會出現確認的聲音,然後畫面顯示有調整,可實際上音效卻沒有調整?
是我哪部分沒有寫好嗎?
回复

使用道具 举报

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
回帖
244
发表于 2014-9-23 23:45:04 | 显示全部楼层
按下有音效(确认音吗?  还是测试音?)
确认音用这个
Sound.play_cursor

测试音随你
也可以用上面那个
回复

使用道具 举报

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
回帖
244
发表于 2014-9-24 00:00:15 | 显示全部楼层
调整音效用
class RPG::SE < RPG::AudioFile
  def self.change_vol
    @@last.volume = SUI::OPTION.se_volume         
  end
end

改这样试试
RPG::SE.stop
RPG::SE.change_vol
RPG::SE.last.play


点评

嘗試的結果似乎也是不行,不過後來參考這位系統設定作者的腳本的BGM更新的寫法,增添一點內容後就可以了(在11樓),謝謝你的熱心指導!!!  发表于 2014-9-24 00:14
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部