设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3501|回复: 10
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
57 小时
注册时间
2014-9-16
帖子
29
跳转到指定楼层
1
发表于 2014-9-22 21:34:52 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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



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

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



共通セーブファイル

RUBY 代码复制
  1. #******************************************************************************
  2. #
  3. #   * 共通セーブファイル *
  4. #
  5. #                       for RGSS3
  6. #
  7. #        Ver 1.01   2013.08.24
  8. #
  9. #   ◆使い方
  10. #     数字でも文字でも、お好きな名前(ID)への値の保存/読込が出来ます。
  11. #     1.True/Falseの値の場合
  12. #         例)保存:$savec.set("id", True)
  13. #             読込:$savec.check("id")
  14. #                   ※idが存在しない場合、Falseが返されます。
  15. #
  16. #     2.数字の場合
  17. #         例)保存:$savec.set_num("id", 100)
  18. #             読込:$savec.get_num("id")
  19. #                   ※idが存在しない場合、-1が返されます。
  20. #
  21. #   提供者:睡工房 [url]http://hime.be/[/url]
  22. #
  23. #******************************************************************************
  24.  
  25. #==============================================================================
  26. # コンフィグ項目
  27. #==============================================================================
  28. module SUI
  29. module COMMON_SAVE
  30.   # 共通セーブファイル名
  31.   COMMON_FILE = "savec.rvdata"
  32. end
  33. end
  34. #==============================================================================
  35. # 設定完了
  36. #==============================================================================
  37.  
  38.  
  39.  
  40. class Common_Save
  41.   #--------------------------------------------------------------------------
  42.   # ● オブジェクト初期化
  43.   #--------------------------------------------------------------------------
  44.   def initialize
  45.     @data = {}
  46.     load if FileTest.exist?(SUI::COMMON_SAVE::COMMON_FILE)
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● フラグチェック
  50.   #--------------------------------------------------------------------------
  51.   def check(id)
  52.     @data.include?(id)? @data[id] : false
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ● フラグセット
  56.   #--------------------------------------------------------------------------
  57.   def set(id, flg = false)
  58.     unless check(id) == flg
  59.       @data[id] = flg
  60.       save
  61.     end
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 数値取得
  65.   #--------------------------------------------------------------------------
  66.   def get_num(id)
  67.     @data.include?(id)? @data[id] : -1
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● 数値セット
  71.   #--------------------------------------------------------------------------
  72.   def set_num(id, num = -1)
  73.     unless get_num(id) == num
  74.       @data[id] = num
  75.       save
  76.     end
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● ファイルセーブ
  80.   #--------------------------------------------------------------------------
  81.   def save
  82.     save_data(@data, SUI::COMMON_SAVE::COMMON_FILE)
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● ファイルロード
  86.   #--------------------------------------------------------------------------
  87.   def load
  88.     @data = load_data(SUI::COMMON_SAVE::COMMON_FILE)
  89.   end
  90. end
  91.  
  92.  
  93. class << DataManager
  94.   #--------------------------------------------------------------------------
  95.   # ● モジュール初期化
  96.   #--------------------------------------------------------------------------
  97.   alias sui_init init
  98.   def init
  99.     $savec = Common_Save.new
  100.     sui_init
  101.   end
  102. end



メッセージ拡張機能

RUBY 代码复制
  1. #******************************************************************************
  2. #
  3. #   * メッセージ機能拡張 *
  4. #
  5. #                       for RGSS3
  6. #
  7. #        Ver 1.00   2012.09.16
  8. #        Ver 1.01   2014.01.06  自動モードの不具合修正
  9. #
  10. #   ◆注意事項
  11. #     ※この素材は「共通セーブファイル」スクリプトが必要になります。
  12. #
  13. #
  14. #   ◆機能説明
  15. #
  16. #     1.追加された制御文字で、立ち絵を左・中央・右に表示できます。
  17. #
  18. #     2.追加された制御文字で、音声を再生できます。
  19. #
  20. #     3.追加された制御文字で、SEを再生できます。
  21. #
  22. #     4.追加された制御文字でCGの表示ができます。
  23. #
  24. #     5.上記機能をスクリプトからも実行できます。
  25. #
  26. #     6.コンフィグ項目で指定したボタンで、メッセージ枠を一時消去できます。
  27. #
  28. #     7.コンフィグ項目で指定したボタンで、自動改ページモードに移行できます。
  29. #
  30. #     8.シーンスキップに設定したゲームスイッチをオンにすると、コンフィグ
  31. #         項目で設定したボタンを押すことでスキップ先ラベルまでスキップできます。
  32. #
  33. #
  34. #   ◆使い方
  35. #     [url]http://hime.be/rgss3/sozai/message_manual.txt[/url] をご覧ください。
  36. #
  37. #
  38. #   提供者:睡工房 [url]http://hime.be/[/url]
  39. #
  40. #******************************************************************************
  41.  
  42.  
  43. #==============================================================================
  44. # コンフィグ項目
  45. #==============================================================================
  46. module SUI
  47. module MESSAGE
  48.   # 左側・中央・右側に表示する立ち絵のX座標(絵の左上を基準とします)
  49.   LEFT_X    = 0      # 左側
  50.   CENTER_X  = 180    # 中央
  51.   RIGHT_X   = 360    # 右側
  52.  
  53.   # 立ち絵の表示に使用するピクチャ番号
  54.   LEFT_PIC    = 5    # 左側
  55.   CENTER_PIC  = 6    # 中央
  56.   RIGHT_PIC   = 7    # 右側
  57.  
  58.   # CGの表示に使用するピクチャ番号
  59.   CG_PIC      = 8
  60.  
  61.   # メッセージウィンドウの消去に割り当てるボタンを設定
  62.   # Input::A の形式で指定
  63.   BTN_HIDE = :A
  64.  
  65.   # シーンスキップのボタンを設定
  66.   # Input::X の形式で指定
  67.   BTN_RETURN = :X
  68.  
  69.   # 自動改ページのボタンを設定
  70.   # Input::Y の形式で指定
  71.   BTN_AUTO_MODE = :Y
  72.  
  73.   # 立ち絵の保存場所("Graphics/Pictures/"からの相対パスを指定")
  74.   #SURFACE_DIR = "Surface/"
  75.   SURFACE_DIR = ""
  76.  
  77.   # CGファイルの保存場所("Graphics/Pictures/"からの相対パスを指定")
  78.   #CG_DIR = "CG/"
  79.   CG_DIR = ""
  80.  
  81.   # ボイスファイルの保存場所
  82.   #VOICE_DIR = "Audio/SE/Voice/"
  83.   VOICE_DIR = "Audio/SE/"
  84.  
  85.   # イベントスキップのフラグ(ゲームスイッチの番号指定)
  86.   # このゲームスイッチがオンの時、直近のスキップ先ラベルまでスキップします。
  87.   SW_SKIP_ON = 51
  88.  
  89.   # イベントスキップ先として認識するラベル名
  90.   SKIP_LABEL = "イベントスキップ先"
  91.  
  92.   # 自動改ページの待ち時間(フレーム数を指定)
  93.   # 左から「遅い」,「普通」,「速い」の順に設定します。
  94.   # ※オプション画面スクリプトが未導入の場合、「普通」のみ有効になります。
  95.   AUTO_WAIT = [180, 120, 60]
  96. end
  97. end
  98. #==============================================================================
  99. # 設定完了
  100. #==============================================================================
  101.  
  102.  
  103.  
  104. class Window_Message < Window_Base
  105.   #--------------------------------------------------------------------------
  106.   # ● オブジェクト初期化
  107.   #--------------------------------------------------------------------------
  108.   alias sui_message_initialize initialize
  109.   def initialize
  110.     sui_message_initialize
  111.     @hide_mode = false          # ウィンドウ消去モード
  112.     @auto_mode = false          # 自動改ページモード
  113.     @auto_count = 0
  114.     create_auto_message
  115.     SUI::MESSAGE::SKIP["skip"] = false
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 解放
  119.   #--------------------------------------------------------------------------
  120.   alias sui_message_dispose dispose
  121.   def dispose
  122.     sui_message_dispose
  123.     @auto_message.bitmap.dispose
  124.     @auto_message.dispose
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● オートモードの通知メッセージ作成
  128.   #--------------------------------------------------------------------------
  129.   def create_auto_message
  130.     @auto_message = Sprite.new
  131.     @auto_message.x = Graphics.width
  132.     @auto_message.y = 3
  133.     @auto_message.bitmap = Bitmap.new(140, 15)
  134.     @auto_message.bitmap.font.size = 15
  135.     @auto_message.bitmap.gradient_fill_rect(0, 6, 140, 9, Color.new(128, 128, 128, 0), Color.new(128, 128, 128, 180), true)
  136.     @auto_message.bitmap.draw_text(0, 0, @auto_message.bitmap.width, 15, "自動改ページモード", 1)
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● フレーム更新
  140.   #--------------------------------------------------------------------------
  141.   alias sui_message_update update
  142.   def update
  143.     if @auto_mode and (Input::trigger?(SUI::MESSAGE::BTN_AUTO_MODE) || Input.trigger?(:B) || Input.trigger?(:C))
  144.       @auto_mode = false
  145.       Input.update
  146.     end
  147.     @auto_message.x += 10 if !@auto_mode and @auto_message.x < Graphics.width
  148.     sui_message_update unless update_hide_auto
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 入力処理
  152.   #--------------------------------------------------------------------------
  153.   def update_hide_auto
  154.     if $game_message.choice?
  155.       return update_hide([self, @choice_window])
  156.     elsif $game_message.num_input?
  157.       return update_hide([self, @number_window])
  158.     elsif $game_message.item_choice?
  159.       return update_hide([self, @item_window])
  160.     else
  161.       return update_hide([self]) unless @pause_skip
  162.     end
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● ウィンドウ消去モードの更新
  166.   #--------------------------------------------------------------------------
  167.   def update_hide(windows)
  168.     if @hide_mode
  169.       if Input.trigger?(:C) or Input.trigger?(SUI::MESSAGE::BTN_HIDE)
  170.         @hide_mode = false
  171.         windows.each do |window|
  172.           window.visible = true
  173.         end
  174.       end
  175.       return true
  176.     else
  177.       if Input.trigger?(SUI::MESSAGE::BTN_HIDE)
  178.         @hide_mode =true
  179.         windows.each do |window|
  180.           window.visible = false
  181.         end
  182.         return true
  183.       end
  184.     return false
  185.     end
  186.   end
  187.   #--------------------------------------------------------------------------
  188.   # ● 入力待ち処理 ※再定義
  189.   #--------------------------------------------------------------------------
  190.   def input_pause
  191.     self.pause = true
  192.     wait(10)
  193.     Fiber.yield until auto_mode || Input.trigger?(:B) || Input.trigger?(:C)
  194.     Input.update
  195.     self.pause = false
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● メッセージ自動送り&スキップ確認
  199.   #--------------------------------------------------------------------------
  200.   def auto_mode
  201.     if @auto_mode
  202.       @auto_count = SUI::MESSAGE::AUTO_WAIT[SUI::OPTION.auto_wait] if @auto_count == 0
  203.       @auto_count -= 1
  204.       @auto_message.x -= 10 if  @auto_message.x > Graphics.width - @auto_message.width
  205.       return true if Input::trigger?(SUI::MESSAGE::BTN_AUTO_MODE)
  206.       return true if @auto_count == 0
  207.       return false
  208.     else
  209.       @auto_mode = true if Input::trigger?(SUI::MESSAGE::BTN_AUTO_MODE)
  210.       if $game_switches[SUI::MESSAGE::SW_SKIP_ON] && Input.trigger?(SUI::MESSAGE::BTN_RETURN)
  211.         SUI::MESSAGE::SKIP["skip"] = true
  212.         return true
  213.       end
  214.       return false
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 一文字出力後のウェイト
  219.   #--------------------------------------------------------------------------
  220.   alias sui_message_wait_for_one_character wait_for_one_character
  221.   def wait_for_one_character
  222.     case SUI::OPTION.message_speed
  223.     when 0
  224.       wait(1) unless @show_fast or @line_show_fast
  225.       @spd = false
  226.     when 1
  227.       @spd = false
  228.     when 2
  229.       @spd = !@spd
  230.     end
  231.     return unless @show_fast or @line_show_fast or !@spd
  232.     sui_message_wait_for_one_character
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 制御文字の処理
  236.   #     code : 制御文字の本体部分(「\C[1]」なら「C」)
  237.   #--------------------------------------------------------------------------
  238.   alias sui_process_escape_character process_escape_character
  239.   def process_escape_character(code, text, pos)
  240.     sui_process_escape_character(code, text, pos)
  241.     case code
  242.     when 'l', 'c', 'r'
  243.       text.sub!(/\[(.{1,8})\]/, "")
  244.       if $1 == "off"
  245.         Message.set_tone(code, Tone.new(-40, -40, -40, 0))
  246.       elsif $1 == "on"
  247.         Message.set_tone(code, Tone.new(0, 0, 0, 0))
  248.         for i in Message.get_array(code)
  249.           Message.set_tone(i, Tone.new(-40, -40, -40, 0))
  250.         end
  251.       elsif $1 =="del"
  252.         Message.del_picture(code)
  253.       else
  254.         Message.set_picture(code, $1)
  255.         Message.set_tone(code, Tone.new(0, 0, 0, 0))
  256.         for i in Message.get_array(code)
  257.           Message.set_tone(i, Tone.new(-40, -40, -40, 0))
  258.         end
  259.       end
  260.       wait(16)
  261.     when 's'
  262.         text.sub!(/\[(\w+)(,(\d+))?(,(\d+))?\]/, "")
  263.         Audio.se_play("Audio/SE/#{$1}", ($3 ? $3.to_i : 100), ($5 ? $5.to_i : 100))
  264.     when 'v'
  265.         text.sub!(/\[([0-9a-zA-Z_\/]+)\]/, "")
  266.         Message.play_voice($1)
  267.     when 'p'
  268.       text.sub!(/\[(.+)\]/, "")
  269.       if $1 == "del"
  270.         Message.del_cg
  271.       else
  272.         Message.set_cg($1)
  273.       end
  274.     end
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● 指定の位置を除いた配列を取得
  278.   #--------------------------------------------------------------------------
  279.   def self.get_array(pos)
  280.     tmp = ["l", "c", "r"]
  281.     tmp.delete(pos)
  282.     return tmp
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ● CGの表示
  286.   #--------------------------------------------------------------------------
  287.   def self.set_cg(file)
  288.     name = SUI::MESSAGE::CG_DIR + file
  289.     zoom_x = 100.0
  290.     zoom_y = 100.0
  291.     opacity = 255.0
  292.     blend_type = 0
  293.     origin = 0
  294.     x = 0
  295.     y = 0
  296.     $game_map.screen.pictures[SUI::MESSAGE::CG_PIC].show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ● CGの消去
  300.   #--------------------------------------------------------------------------
  301.   def self.del_cg
  302.     $game_map.screen.pictures[SUI::MESSAGE::CG_PIC].erase
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 立ち絵の表示
  306.   #--------------------------------------------------------------------------
  307.   def self.set_picture(pos, file, flg = true)
  308.     name = SUI::MESSAGE::SURFACE_DIR + file
  309.     zoom_x = 100.0
  310.     zoom_y = 100.0
  311.     opacity = 255.0
  312.     blend_type = 0
  313.     origin = 0
  314.     y = 0
  315.     if pos == "l"
  316.       x = SUI::MESSAGE::LEFT_X
  317.       p = SUI::MESSAGE::LEFT_PIC
  318.     elsif pos == "c"
  319.       x = SUI::MESSAGE::CENTER_X
  320.       p = SUI::MESSAGE::CENTER_PIC
  321.     elsif pos == "r"
  322.       x = SUI::MESSAGE::RIGHT_X
  323.       p = SUI::MESSAGE::RIGHT_PIC
  324.     end
  325.     $game_map.screen.pictures[p].show(name, origin, x, y, zoom_x, zoom_y, opacity, blend_type)
  326.     set_tone(pos, Tone.new(-40, -40, -40, 0)) unless flg
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● 立ち絵の消去
  330.   #--------------------------------------------------------------------------
  331.   def self.del_picture(pos)
  332.     if pos == "l"
  333.       p = SUI::MESSAGE::LEFT_PIC
  334.     elsif pos == "c"
  335.       p = SUI::MESSAGE::CENTER_PIC
  336.     elsif pos == "r"
  337.       p = SUI::MESSAGE::RIGHT_PIC
  338.     end
  339.     $game_map.screen.pictures[p].erase
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● トーンの設定
  343.   #--------------------------------------------------------------------------
  344.   def self.set_tone(pos, tone)
  345.     if pos == "l"
  346.       p = SUI::MESSAGE::LEFT_PIC
  347.     elsif pos == "c"
  348.       p = SUI::MESSAGE::CENTER_PIC
  349.     elsif pos == "r"
  350.       p = SUI::MESSAGE::RIGHT_PIC
  351.     end
  352.     $game_map.screen.pictures[p].start_tone_change(tone, 0)
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● ボイスの再生
  356.   #--------------------------------------------------------------------------
  357.   def self.play_voice(file)
  358.     unless $savec.check("voice")
  359.       Audio.se_stop
  360.       vol = SUI::OPTION.voice_volume
  361.       Audio.se_play("#{SUI::MESSAGE::VOICE_DIR}#{file}", 100 * vol, 100)
  362.     end
  363.   end
  364. end
  365. Message = Window_Message
  366.  
  367.  
  368. module SuiScript
  369.   #--------------------------------------------------------------------------
  370.   # ● CGの表示
  371.   #--------------------------------------------------------------------------
  372.   def self.set_cg(file)
  373.     if file == "del"
  374.       Message.del_cg
  375.     else
  376.       Message.set_cg(file)
  377.     end
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 立ち絵の表示
  381.   #--------------------------------------------------------------------------
  382.   def self.set_picture(pos, file, flg = true)
  383.     if file == "off"
  384.       Message.set_tone(pos, Tone.new(-40, -40, -40, 0))
  385.     elsif file == "on"
  386.       Message.set_tone(pos, Tone.new(0, 0, 0, 0))
  387.       for i in Message.get_array(pos)
  388.         Message.set_tone(i, Tone.new(-40, -40, -40, 0))
  389.       end
  390.     elsif file =="del"
  391.       Message.del_picture(pos)
  392.     else
  393.       Message.set_picture(pos, file, flg)
  394.       return unless flg
  395.       Message.set_tone(pos, Tone.new(0, 0, 0, 0))
  396.       for i in Message.get_array(pos)
  397.         Message.set_tone(i, Tone.new(-40, -40, -40, 0))
  398.       end
  399.     end
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ● SEの再生
  403.   #--------------------------------------------------------------------------
  404.   def self.play_se(file, vol = 100, pitch = 100)
  405.     Audio.se_play("Audio/SE/#{file}", vol, pitch)
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● ボイスの再生
  409.   #--------------------------------------------------------------------------
  410.   def self.play_voice(file)
  411.     Message.play_voice(file)
  412.   end
  413. end
  414.  
  415.  
  416. class Game_Interpreter
  417.   #--------------------------------------------------------------------------
  418.   # ● イベントコマンドの実行
  419.   #--------------------------------------------------------------------------
  420.   alias sui_interpreter_execute_command execute_command
  421.   def execute_command
  422.     if SUI::MESSAGE::SKIP["skip"]
  423.       SUI::MESSAGE::SKIP["skip"] = false
  424.       $game_switches[SUI::MESSAGE::SW_SKIP_ON] = false
  425.       return if label_jump
  426.     end
  427.     sui_interpreter_execute_command
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ● ラベルジャンプ
  431.   #--------------------------------------------------------------------------
  432.   def label_jump
  433.     label_name = SUI::MESSAGE::SKIP_LABEL
  434.     @list.size.times do |i|
  435.       if @list[i].code == 118 && @list[i].parameters[0] == label_name
  436.         @index = i
  437.         return true
  438.       end
  439.     end
  440.     return false
  441.   end
  442. end
  443.  
  444.  
  445. module SUI::MESSAGE
  446.   SKIP = {}
  447. end
  448.  
  449.  
  450. module SUI::OPTION
  451.   def self.bgm_volume
  452.     vol = $savec.get_num("bgm_vol")
  453.     vol = 70 if vol < 10
  454.     vol /=  100.0
  455.     return vol
  456.   end
  457.   def self.se_volume
  458.     vol = $savec.get_num("se_vol")
  459.     vol = 70 if vol < 10
  460.     vol /=  100.0
  461.     return vol
  462.   end
  463.   def self.voice_volume
  464.     vol = $savec.get_num("voice_vol")
  465.     vol = 70 if vol < 10
  466.     vol /= 100.0
  467.     return vol
  468.   end
  469.   def self.message_speed
  470.     spd = $savec.get_num("speed")
  471.     spd = 1 if spd == -1
  472.     return spd
  473.   end
  474.   def self.auto_wait
  475.     spd = $savec.get_num("auto_wait")
  476.     spd = 1 if spd == -1
  477.     return spd
  478.   end
  479. end



オプション画面

RUBY 代码复制
  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. #     [url]http://hime.be/rgss3/option.html[/url]
  34. #
  35. #
  36. #   提供者:睡工房 [url]http://hime.be/[/url]
  37. #
  38. #******************************************************************************
  39.  
  40.  
  41. #==============================================================================
  42. # コンフィグ項目
  43. #==============================================================================
  44. module SUI
  45. module OPTION
  46.   # ボイス再生ボリューム変更時のサンプルボイス
  47.   # 指定したボイスからランダムで1つ、新しいボリュームで再生されます。
  48.   # サンプルボイスがいらない場合は空にしてください。
  49.   SAMPLE = [
  50.   #ファイル名
  51. #  "sample_voice01",
  52. #  "sample_voice02",
  53.    "Cat",
  54.    "Crow",
  55.    "Dog",
  56.   ]
  57.  
  58.   # ボイスファイルの保存場所
  59.   #VOICE_DIR = "Audio/SE/Voice/"
  60.   VOICE_DIR = "Audio/SE/"
  61. end
  62. end
  63. #==============================================================================
  64. # 設定完了
  65. #==============================================================================
  66.  
  67.  
  68.  
  69. class Window_Option < Window_Base
  70.   #--------------------------------------------------------------------------
  71.   # ● オブジェクト初期化
  72.   #--------------------------------------------------------------------------
  73.   def initialize
  74.     super(0, 0, 430, 330)
  75.     self.openness = 0
  76.     self.x = Graphics.width / 2 - self.width / 2
  77.     self.y = Graphics.height / 2 - self.height / 2 + line_height / 2 + padding
  78.     self.z = 160
  79.     [url=home.php?mod=space&uid=401263]@line[/url] = 0
  80.     set_index
  81.     refresh
  82.     update_cursor
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● リフレッシュ
  86.   #--------------------------------------------------------------------------
  87.   def refresh
  88.     self.contents.clear
  89.     contents.font.color = normal_color
  90.     contents.draw_text(0, 0 * rows_height, contents.width, line_height, "音樂")
  91.     contents.draw_text(0, 1 * rows_height, contents.width, line_height, "聲音")
  92.     contents.draw_text(0, 2 * rows_height, contents.width, line_height, "音效")
  93.     #contents.draw_text(0, 2 * rows_height, contents.width, line_height, "キャラクターボイス")
  94.     contents.draw_text(0, 3 * rows_height, contents.width, line_height, "文字")
  95.     contents.draw_text(0, 4 * rows_height, contents.width, line_height, "自動模式")
  96.     draw_command_10(0)
  97.     draw_command_10(1)
  98.     draw_command_10(2)
  99.     #draw_command_2(2)
  100.     draw_command_3(3)
  101.     draw_command_3(4)
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 行の高さ(2行分)
  105.   #--------------------------------------------------------------------------
  106.   def rows_height
  107.     60
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 文字の描画
  111.   #--------------------------------------------------------------------------
  112.   def draw_text2(x, y, w, text, blue = false)
  113.     contents.font.color = blue ? system_color : normal_color
  114.     contents.font.color.alpha = blue ? 255 : 128
  115.     draw_text(x, y, w, line_height, text)
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # ● 10コマンドの描画
  119.   #--------------------------------------------------------------------------
  120.   def draw_command_10(row)
  121.     y = rows_height * row + line_height
  122.     10.times do |i|
  123.       x = 30 + 36 * i - ((i == 9) ? 2 : 0)
  124.       draw_text2(x, y, 30, ((i + 1) * 10).to_s, (i == @index[row]))
  125.     end
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 10コマンドの矩形を取得
  129.   #--------------------------------------------------------------------------
  130.   def item_rect_10
  131.     rect = Rect.new
  132.     rect.x = 30 - 9 + 36 * @index[@line]
  133.     rect.y = rows_height * @line + line_height
  134.     rect.width = 30 + 8
  135.     rect.height = line_height
  136.     rect
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 2コマンドの描画
  140.   #--------------------------------------------------------------------------
  141.   def draw_command_2(row)
  142.     y = rows_height * row + line_height
  143.     list = ["オン", "オフ"]
  144.     2.times do |i|
  145.       x = 30 + 100 * i
  146.       draw_text2(x, y, 40, list[i], (i == @index[row]))
  147.     end
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 2コマンドの矩形を取得
  151.   #--------------------------------------------------------------------------
  152.   def item_rect_2
  153.     rect = Rect.new
  154.     rect.x = 30 - 11+ 100 * @index[@line]
  155.     rect.y = rows_height * @line + line_height
  156.     rect.width = 50 + 8
  157.     rect.height = line_height
  158.     rect
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 3コマンドの描画
  162.   #--------------------------------------------------------------------------
  163.   def draw_command_3(row)
  164.     y = rows_height * row + line_height
  165.     list = ["慢", "普通", "快"]
  166.     3.times do |i|
  167.       x = 30 + 80 * i
  168.       draw_text2(x, y, 40, list[i], (i == @index[row]))
  169.     end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 3コマンドの矩形を取得
  173.   #--------------------------------------------------------------------------
  174.   def item_rect_3
  175.     rect = Rect.new
  176.     rect.x = 30 - 11 + 80 * @index[@line]
  177.     rect.y = rows_height * @line + line_height
  178.     rect.width = 50 + 8
  179.     rect.height = line_height
  180.     rect
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● カーソルの更新
  184.   #--------------------------------------------------------------------------
  185.   def update_cursor
  186.     case @line
  187.       when 0, 1, 2
  188.         cursor_rect.set(item_rect_10)
  189.       #when 2
  190.         #cursor_rect.set(item_rect_2)
  191.       when 3, 4
  192.         cursor_rect.set(item_rect_3)
  193.       end
  194.       Sound.play_cursor
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 行の設定
  198.   #--------------------------------------------------------------------------
  199.   def line=(row)
  200.     old = @line
  201.     @line = [[@line + row, 0].max, 4].min
  202.     update_cursor if old != @line
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 行の設定
  206.   #--------------------------------------------------------------------------
  207.   def index=(i)
  208.     max = 9 if( @line == 0 || @line == 1 || @line == 2)
  209.     #max = 1 if( @line == 2)
  210.     max = 2 if( @line == 3 || @line == 4)
  211.     old = @index[@line]
  212.     @index[@line] = [[@index[@line] + i, 0].max, max].min
  213.     update_cursor if old != @index[@line]
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● フレーム更新
  217.   #--------------------------------------------------------------------------
  218.   def update
  219.     super
  220.     return unless self.openness == 255
  221.     self.line = +1 if Input.repeat?(:DOWN)
  222.     self.line = -1 if Input.repeat?(:UP)
  223.     self.index = +1 if Input.repeat?(:RIGHT)
  224.     self.index = -1 if Input.repeat?(:LEFT)
  225.     if Input.trigger?(:C)
  226.       Sound.play_use_item
  227.       case @line
  228.         when 0
  229.           $savec.set_num("bgm_vol", (@index[@line] + 1) * 10)
  230.           refresh
  231.           RPG::BGM::last.play
  232.         when 1
  233.           $savec.set_num("voice_vol", (@index[@line] + 1) * 10)
  234.           refresh
  235.           Audio.se_stop
  236.           vol = SUI::OPTION.voice_volume
  237.           return if SUI::OPTION::SAMPLE.length == 0
  238.           r = SUI::OPTION::SAMPLE[rand(SUI::OPTION::SAMPLE.length)]
  239.           Audio.se_play("#{SUI::OPTION::VOICE_DIR}#{r}", 100 * vol)
  240.         when 2
  241.           #$savec.set("voice", @index[@line] == 1)
  242.           #refresh
  243.           $savec.set_num("se_vol", (@index[@line] + 1) * 10)
  244.           refresh
  245.           Audio.se_stop
  246.           RPG::SE::last.play
  247.         when 3
  248.           $savec.set_num("speed", @index[@line])
  249.           refresh
  250.         when 4
  251.           $savec.set_num("auto_wait", @index[@line])
  252.           refresh
  253.         end
  254.     end
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # ● アクティブ設定
  258.   #--------------------------------------------------------------------------
  259.   def set_index
  260.     @index = []
  261.  
  262.     res = $savec.get_num("bgm_vol")
  263.     res = 70 if res < 10
  264.     @index[0] = (res / 10) - 1
  265.  
  266.     res = $savec.get_num("voice_vol")
  267.     res = 70 if res < 10
  268.     @index[1] = (res / 10) - 1
  269.  
  270.     res = $savec.get_num("se_vol")
  271.     res = 70 if res < 10
  272.     @index[2] = (res / 10) - 1
  273.     #@index[2] = $savec.check("voice") ? 1 : 0
  274.  
  275.     @index[3] = $savec.get_num("speed")
  276.     @index[3] = 1 if @index[3] == -1
  277.  
  278.     @index[4] = $savec.get_num("auto_wait")
  279.     @index[4] = 1 if @index[4] == -1
  280.   end
  281. end
  282.  
  283.  
  284. class Scene_Option < Scene_Base
  285.   #--------------------------------------------------------------------------
  286.   # ● クラス変数初期化
  287.   #--------------------------------------------------------------------------
  288.   @@start  = false         # オプション画面の開始フラグ
  289.   #--------------------------------------------------------------------------
  290.   # ● 開始処理
  291.   #--------------------------------------------------------------------------
  292.   def start
  293.     super
  294.     @@start = false
  295.     @config_seq = 0
  296.     create_background
  297.     create_option_window
  298.     @option_window.open
  299.     @option_title.open
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 終了処理
  303.   #--------------------------------------------------------------------------
  304.   def terminate
  305.     super
  306.     dispose_background
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● オプションウィンドウの作成
  310.   #--------------------------------------------------------------------------
  311.   def create_option_window
  312.     @option_window = Window_Option.new
  313.     @option_title = Window_Help.new(1)
  314.     @option_title.x = @option_window.x
  315.     @option_title.width = @option_window.width
  316.     @option_title.y = @option_window.y - @option_title.height
  317.     @option_title.z = @option_window.z
  318.     @option_title.create_contents
  319.     @option_title.openness = 0
  320.     @option_title.contents.draw_text(0, -2, @option_title.contents.width,@option_title.contents.height, "* 系統設定 *", 1)
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ● 背景の作成
  324.   #--------------------------------------------------------------------------
  325.   def create_background
  326.     @background_sprite = Sprite.new
  327.     @background_sprite.bitmap = SceneManager.background_bitmap
  328.     @background_sprite.color.set(16, 16, 16, 128)
  329.   end
  330.   #--------------------------------------------------------------------------
  331.   # ● 背景の解放
  332.   #--------------------------------------------------------------------------
  333.   def dispose_background
  334.     @background_sprite.dispose
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ● 更新処理
  338.   #--------------------------------------------------------------------------
  339.   def update
  340.     super
  341.     if Input.trigger?(:B)
  342.       Sound.play_cancel
  343.       @option_window.close
  344.       @option_title.close
  345.     end
  346.     if @option_window.openness == 0
  347.       SceneManager.return
  348.     end
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● オプション画面スタート処理
  352.   #--------------------------------------------------------------------------
  353.   def self.start
  354.     @@start = true
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # ● オプション画面が開始しているか?
  358.   #--------------------------------------------------------------------------
  359.   def self.start?
  360.     return @@start
  361.   end
  362. end
  363.  
  364.  
  365. module RPG
  366.   class BGM < AudioFile
  367.     #--------------------------------------------------------------------------
  368.     # ● BGMの再生 ※再定義
  369.     #--------------------------------------------------------------------------
  370.     def play(pos = 0)
  371.       if @name.empty?
  372.         Audio.bgm_stop
  373.         @@last = RPG::BGM.new
  374.       else
  375.         vol = SUI::OPTION::bgm_volume * 1.05
  376.         vol = [@volume * vol, 100].min                          # Ver 1.01
  377.         Audio.bgm_play("Audio/BGM/" + @name, vol, @pitch, pos)  # Ver 1.01
  378. #~         Audio.bgm_play("Audio/BGM/" + @name, @volume * vol, @pitch, pos)
  379.         @@last = self.clone
  380.       end
  381.     end
  382.   end
  383.     class SE < AudioFile
  384.     #--------------------------------------------------------------------------
  385.     # ● BGMの再生 ※再定義
  386.     #--------------------------------------------------------------------------
  387.     def play(pos = 0)
  388.       if @name.empty?
  389.         Audio.se_stop
  390.         @@last = RPG::SE.new
  391.       else
  392.         vol = SUI::OPTION::se_volume * 1.05
  393.         vol = [@volume * vol, 100].min                          # Ver 1.01
  394.         Audio.se_play("Audio/SE/" + name)
  395.         @@last = self.clone
  396.       end
  397.     end
  398.   end
  399. end
  400.  
  401.  
  402. class Scene_Map
  403.   #--------------------------------------------------------------------------
  404.   # ● オプション画面への移行
  405.   #--------------------------------------------------------------------------
  406.   alias sui_option_update_scene update_scene
  407.   def update_scene
  408.     sui_option_update_scene
  409.     SceneManager.call(Scene_Option) if !scene_changing? && Scene_Option.start?
  410.   end
  411. end
   

Lv1.梦旅人

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
帖子
267
2
发表于 2014-9-23 17:40:31 | 只看该作者
本帖最后由 蝉岭Cicada 于 2014-9-23 17:42 编辑

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

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

点评

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

使用道具 举报

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

3
发表于 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 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

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


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

RUBY 代码复制
  1. module RPG
  2. class SE < AudioFile
  3.   def play
  4.     unless @name.empty?
  5.       Audio.se_play('Audio/SE/' + @name, @volume, @pitch)
  6.     end
  7.   end
  8.   def self.stop
  9.     Audio.se_stop
  10.   end
  11. end
  12. end


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

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
帖子
267
5
发表于 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
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
57 小时
注册时间
2014-9-16
帖子
29
6
 楼主| 发表于 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了)

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
帖子
267
7
发表于 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 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
帖子
267
9
发表于 2014-9-23 23:45:04 | 只看该作者
按下有音效(确认音吗?  还是测试音?)
确认音用这个
Sound.play_cursor

测试音随你
也可以用上面那个
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
320 小时
注册时间
2014-9-2
帖子
267
10
发表于 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
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-10-6 04:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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