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

Project1

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

[已经解决] 66加强对话框出错了,强人来!

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2008-6-5
帖子
312
跳转到指定楼层
1
发表于 2009-8-15 09:24:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
使用了这个脚本后,老是提示if $game_system.soundname_on_speak == nil then错误?怎么修改啊????
  1. =begin

  2. ============================================================================
  3. 66加强对话框--66rpg
  4. ============================================================================

  5. 默认为一个字一个字的方式,如果需要一次全部显示,
  6. 请在游戏中使用脚本:$game_system.typing = true
  7.   
  8. 默认对话字没有声音,如果需要声音,请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  9. 我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音

  10. 其他在对话中可以使用的功能:

  11. \n[1]:显示1号角色的姓名

  12. \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名

  13. \p[1]:对话框出现在1号事件的上方
  14. \p[0]:主人公上方出现对话框
  15. 使用\p功能后可以自动调整对话框大小

  16. \\:显示"\"这个符号

  17. \v[1] :显示变量1

  18. \v[a1] :显示防具1

  19. \v[w1] :显示武器1

  20. # \v[i1] :显示物品1

  21. # \v[s1] :显示特技1

  22. # \c[1-8]:更改颜色
  23. #1:深蓝色
  24. #2:浅红色
  25. #3:青色
  26. #4:浅蓝色
  27. 5:紫色
  28. 6:黄色
  29. 7:灰色
  30. 0:白色

  31. \g:显示金钱窗口

  32. \a[SE文件名]:对话的时候播放SE

  33. \s[1-19]:更改弹字的速度

  34. \.   :停顿一刹那(1、2帧)
  35. \|   :停顿片刻(20帧)

  36. \>   :文字不用打字方式
  37. \<   :文字使用打字方式

  38. \!   :等待玩家按回车再继续
  39. \~   :文字直接消失

  40. \I   :下一行从这个位置开始

  41. \o[123]:文字透明度改为123,模拟将死之人(汗)

  42. \h[12]:改用12号字

  43. \b[50]:空50象素

  44. \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  45. \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”

  46. \Lk:清除左边的图像
  47. \Rk:清除右边的图像

  48. =end

  49. #==============================================================================
  50. # ■ Window_Message
  51. #------------------------------------------------------------------------------
  52. class Window_Message < Window_Selectable
  53.   #--------------------------------------------------------------------------
  54.   # ● 初始化状态
  55.   #--------------------------------------------------------------------------
  56.   def initialize
  57.     super(80, 304, 480, 160)
  58.     self.contents = Bitmap.new(width - 32, height - 32)
  59.     self.visible = false
  60.     self.z = 9998
  61.     @fade_in = false
  62.     @fade_out = false
  63.     @contents_showing = false
  64.     @cursor_width = 0
  65.     self.active = false
  66.     self.index = -1
  67.     if $game_system.soundname_on_speak == nil then
  68.       $game_system.soundname_on_speak = ""
  69.     end
  70.     @opacity_text_buf = Bitmap.new(32, 32)
  71.   end
  72.   #--------------------------------------------------------------------------
  73.   # ● 释放
  74.   #--------------------------------------------------------------------------
  75.   def dispose
  76.     terminate_message
  77.     $game_temp.message_window_showing = false
  78.     if @input_number_window != nil
  79.       @input_number_window.dispose
  80.     end
  81.     super
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 处理信息结束
  85.   #--------------------------------------------------------------------------
  86.   def terminate_message
  87.     self.active = false
  88.     self.pause = false
  89.     self.index = -1
  90.     self.contents.clear
  91.     # 清除显示中标志
  92.     @contents_showing = false
  93.     # 呼叫信息调用
  94.     if $game_temp.message_proc != nil
  95.       $game_temp.message_proc.call
  96.     end
  97.     # 清除文章、选择项、输入数值的相关变量
  98.     $game_temp.message_text = nil
  99.     $game_temp.message_proc = nil
  100.     $game_temp.choice_start = 99
  101.     $game_temp.choice_max = 0
  102.     $game_temp.choice_cancel_type = 0
  103.     $game_temp.choice_proc = nil
  104.     $game_temp.num_input_start = 99
  105.     $game_temp.num_input_variable_id = 0
  106.     $game_temp.num_input_digits_max = 0
  107.     # 开放金钱窗口
  108.     if @gold_window != nil
  109.       @gold_window.dispose
  110.       @gold_window = nil
  111.     end
  112.     if @name_window_frame != nil
  113.       @name_window_frame.dispose
  114.       @name_window_frame = nil
  115.     end
  116.     if @name_window_text != nil
  117.       @name_window_text.dispose
  118.       @name_window_text = nil
  119.     end
  120.     if @right_picture != nil and @right_keep == true
  121.       @right_picture.dispose
  122.     end   
  123.     if @left_picture != nil and @left_keep == true
  124.       @left_picture.dispose
  125.     end
  126.   end
  127.   def refresh
  128.     # 初期化
  129.     self.contents.clear
  130.     self.contents.font.color = normal_color
  131.     self.contents.font.size = Font.default_size
  132.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  133.     @left_keep = @right_keep = false
  134.     @face_indent = 0
  135.     @opacity = 255
  136.     @cursor_width = 0
  137.     @write_speed = 0
  138.     @write_wait = 0
  139.     @mid_stop = false
  140.     @face_file = nil
  141.     @popchar = -2
  142.     if $game_temp.choice_start == 0
  143.       @x = 8
  144.     end
  145.     if $game_temp.message_text != nil
  146.       @now_text = $game_temp.message_text
  147.       #——头像设置
  148.       if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  149.         @face_file = $1 + ".png"
  150.         @x = @face_indent = 128
  151.         if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  152.           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  153.         end
  154.         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  155.       end
  156.       #——左半身像设置
  157.       if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  158.         @face = "66rpg_" + $1 + "_h.png"
  159.         if $加密 == true
  160.           if @left_picture != nil
  161.             @left_picture.dispose
  162.           end
  163.           @left_picture = Sprite.new
  164.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  165.           @left_picture.y = 480-@left_picture.bitmap.height
  166.           @left_picture.x = 0
  167.           @left_picture.mirror = true
  168.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  169.         else         
  170.           if FileTest.exist?("Graphics/battlers/#{@face}")
  171.             if @left_picture != nil
  172.               @left_picture.dispose
  173.             end
  174.             @left_picture = Sprite.new
  175.             @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  176.             @left_picture.y = 480-@left_picture.bitmap.height
  177.             @left_picture.x = 0
  178.             @left_picture.mirror = true
  179.             @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  180.           end
  181.         end        
  182.       end
  183.       #——右半身像设置
  184.       if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  185.         @face = "66rpg_" + $1 + "_h.png"
  186.         if $加密 == true
  187.           if @right_picture != nil
  188.             @right_picture.dispose
  189.           end
  190.           @right_picture = Sprite.new
  191.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  192.           @right_picture.y = 480-@right_picture.bitmap.height
  193.           @right_picture.x = 640-@right_picture.bitmap.width
  194.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  195.         else
  196.           if FileTest.exist?("Graphics/battlers/#{@face}")
  197.             if @right_picture != nil
  198.               @right_picture.dispose
  199.             end
  200.             @right_picture = Sprite.new
  201.             @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  202.             @right_picture.y = 480-@right_picture.bitmap.height
  203.             @right_picture.x = 640-@right_picture.bitmap.width
  204.             @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  205.           end
  206.         end
  207.       end
  208.       if (/\\[Rr]k/.match(@now_text)) != nil
  209.         @right_keep = true
  210.         @now_text.sub!(/\\[Rr]k/) { "" }
  211.       end
  212.       if (/\\[Ll]k/.match(@now_text)) != nil
  213.         @left_keep = true
  214.         @now_text.sub!(/\\[Ll]k/) { "" }
  215.       end
  216.       # 显示人物姓名
  217.       name_window_set = false
  218.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  219.         name_window_set = true
  220.         name_text = $1
  221.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  222.       end
  223.       
  224.       # 文字位置的判定
  225.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  226.         @popchar = $1.to_i
  227.         if @popchar == -1
  228.           @x = @indent = 48
  229.           @y = 4
  230.         end
  231.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  232.       end
  233.       
  234.       # 开始
  235.       begin
  236.         last_text = @now_text.clone
  237.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  238.       end until @now_text == last_text
  239.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  240.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  241.     end
  242.     @now_text.gsub!(/\\\\/) { "\000" }
  243.     @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  244.     @now_text.gsub!(/\\[Gg]/) { "\002" }
  245.     @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  246.     @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  247.     @now_text.gsub!(/\\[.]/) { "\005" }
  248.     @now_text.gsub!(/\\[|]/) { "\006" }

  249.     @now_text.gsub!(/\\[>]/) { "\016" }
  250.     @now_text.gsub!(/\\[<]/) { "\017" }
  251.     @now_text.gsub!(/\\[!]/) { "\020" }
  252.     @now_text.gsub!(/\\[~]/) { "\021" }
  253.    
  254.     @now_text.gsub!(/\\[Ii]/) { "\023" }
  255.     @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  256.     @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  257.     @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  258.     @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  259.     if @popchar >= 0
  260.       @text_save = @now_text.clone
  261.       @max_x = 0
  262.       @max_y = 4
  263.       for i in 0..3
  264.         line = @now_text.split(/\n/)[3-i]
  265.         @max_y -= 1 if line == nil and @max_y <= 4-i
  266.         next if line == nil
  267.         cx = contents.text_size(line).width
  268.         @max_x = cx if cx > @max_x
  269.       end
  270.       self.width = @max_x + 48 + @face_indent
  271.       self.height = (@max_y - 1) * 32 + 64
  272.     else
  273.       @max_x = self.width - 32 - @face_indent
  274.     end
  275.     reset_window
  276.       if name_window_set
  277.         off_x = 0
  278.         off_y = -40
  279.         space = 2
  280.         x = self.x + off_x - space / 2
  281.         y = self.y + off_y - space / 2
  282.         w = self.contents.text_size(name_text).width + 26 + space
  283.         h = 40 + space
  284.         @name_window_frame = Window_Frame.new(x, y, w, h)
  285.         @name_window_frame.z = self.z + 1
  286.         x = self.x + off_x + 4
  287.         y = self.y + off_y
  288.         @name_window_text = Air_Text.new(x+4, y+6, name_text)
  289.         @name_window_text.z = self.z + 2
  290.       end
  291.     end
  292.     reset_window
  293.     if $game_temp.choice_max > 0
  294.       @item_max = $game_temp.choice_max
  295.       self.active = true
  296.       self.index = 0
  297.     end
  298.     if $game_temp.num_input_variable_id > 0
  299.       digits_max = $game_temp.num_input_digits_max
  300.       number = $game_variables[$game_temp.num_input_variable_id]
  301.       @input_number_window = Window_InputNumber.new(digits_max)
  302.       @input_number_window.number = number
  303.       @input_number_window.x = self.x + 8
  304.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  305.     end
  306.   end
  307.   #--------------------------------------------------------------------------
  308.   # ● 更新
  309.   #--------------------------------------------------------------------------
  310.   def update
  311.     super
  312.     if @fade_in
  313.       self.contents_opacity += 24
  314.       if @input_number_window != nil
  315.         @input_number_window.contents_opacity += 24
  316.       end
  317.       if self.contents_opacity == 255
  318.         @fade_in = false
  319.       end
  320.       return
  321.     end
  322.     @now_text = nil if @now_text == ""
  323.    
  324.     if @now_text != nil and @mid_stop == false
  325.       if @write_wait > 0
  326.         @write_wait -= 1
  327.         return
  328.       end
  329.       text_not_skip = $game_system.typing
  330.       while true
  331.         @max_x = @x if @max_x < @x
  332.         @max_y = @y if @max_y < @y
  333.         if (c = @now_text.slice!(/./m)) != nil
  334.           if c == "\000"
  335.             c = "\\"
  336.           end
  337.           if c == "\001"
  338.             @now_text.sub!(/\[([0-9]+)\]/, "")
  339.             color = $1.to_i
  340.             if color >= 0 and color <= 7
  341.               self.contents.font.color = text_color(color)
  342.             end
  343.             c = ""
  344.           end
  345.           if c == "\002"
  346.             if @gold_window == nil and @popchar <= 0
  347.               @gold_window = Window_Gold.new
  348.               @gold_window.x = 560 - @gold_window.width
  349.               if $game_temp.in_battle
  350.                 @gold_window.y = 192
  351.               else
  352.                 @gold_window.y = self.y >= 128 ? 32 : 384
  353.               end
  354.               @gold_window.opacity = self.opacity
  355.               @gold_window.back_opacity = self.back_opacity
  356.             end
  357.             c = ""
  358.           end
  359.           if c == "\003"
  360.             @now_text.sub!(/\[([0-9]+)\]/, "")
  361.             speed = $1.to_i
  362.             if speed >= 0 and speed <= 19
  363.               @write_speed = speed
  364.             end
  365.             c = ""
  366.           end
  367.           if c == "\004"
  368.             @now_text.sub!(/\[(.*?)\]/, "")
  369.             buftxt = $1.dup.to_s
  370.             if buftxt.match(/\//) == nil and buftxt != "" then
  371.               $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  372.             else
  373.               $game_system.soundname_on_speak = buftxt.dup
  374.             end
  375.             c = ""
  376.           elsif c == "\004"
  377.             c = ""
  378.           end
  379.           if c == "\005"
  380.             @write_wait += 5
  381.             c = ""
  382.           end
  383.           if c == "\006"
  384.             @write_wait += 20
  385.             c = ""
  386.           end
  387.           if c == "\016"
  388.             text_not_skip = false
  389.             c = ""
  390.           end
  391.           if c == "\017"
  392.             text_not_skip = true
  393.             c = ""
  394.           end
  395.           if c == "\020"
  396.             @mid_stop = true
  397.             c = ""
  398.           end
  399.           if c == "\021"
  400.             terminate_message
  401.             return
  402.           end
  403.           if c == "\023"
  404.             @indent = @x
  405.             c = ""
  406.           end
  407.           if c == "\024"
  408.             @now_text.sub!(/\[([0-9]+)\]/, "")
  409.             @opacity = $1.to_i
  410.             c = ""
  411.           end
  412.           if c == "\025"
  413.             @now_text.sub!(/\[([0-9]+)\]/, "")
  414.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  415.             c = ""
  416.           end
  417.           if c == "\026"
  418.             @now_text.sub!(/\[([0-9]+)\]/, "")
  419.             @x += $1.to_i
  420.             c = ""
  421.           end
  422.           if c == "\027"
  423.             @now_text.sub!(/\[(.*?)\]/, "")
  424.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  425.             if $game_system.soundname_on_speak != ""
  426.               Audio.se_play($game_system.soundname_on_speak)
  427.             end
  428.             c = ""
  429.           end
  430.           if c == "\030"
  431.             @now_text.sub!(/\[(.*?)\]/, "")
  432.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  433.            if $game_system.soundname_on_speak != ""
  434.               Audio.se_play($game_system.soundname_on_speak)
  435.             end
  436.             @x += 24
  437.             c = ""
  438.           end
  439.           if c == "\n"
  440.             if @lines >= $game_temp.choice_start
  441.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  442.             end
  443.             @lines += 1
  444.             @y += 1
  445.             @x = 0 + @indent + @face_indent
  446.             if @lines >= $game_temp.choice_start
  447.               @x = 8 + @indent + @face_indent
  448.             end
  449.             c = ""
  450.           end
  451.           if c != ""
  452.             # 文字描画
  453.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  454.             if $game_system.soundname_on_speak != "" then
  455.             Audio.se_play($game_system.soundname_on_speak)
  456.             end
  457.           end
  458.           if Input.press?(Input::B)
  459.             text_not_skip = false
  460.           end
  461.         else
  462.           text_not_skip = true
  463.           break
  464.         end
  465.         # 終了判定
  466.         if text_not_skip
  467.           break
  468.         end
  469.       end
  470.       @write_wait += @write_speed
  471.       return
  472.     end
  473.     if @input_number_window != nil
  474.       @input_number_window.update
  475.       # 決定
  476.       if Input.trigger?(Input::C)
  477.         $game_system.se_play($data_system.decision_se)
  478.         $game_variables[$game_temp.num_input_variable_id] =
  479.         @input_number_window.number
  480.         $game_map.need_refresh = true
  481.         @input_number_window.dispose
  482.         @input_number_window = nil
  483.         terminate_message
  484.       end
  485.       return
  486.     end
  487.     if @contents_showing
  488.       if $game_temp.choice_max == 0
  489.         self.pause = true
  490.       end
  491.       # 取消
  492.       if Input.trigger?(Input::B)
  493.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  494.           $game_system.se_play($data_system.cancel_se)
  495.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  496.           terminate_message
  497.         end
  498.       end
  499.       # 決定
  500.       if Input.trigger?(Input::C)
  501.         if $game_temp.choice_max > 0
  502.           $game_system.se_play($data_system.decision_se)
  503.           $game_temp.choice_proc.call(self.index)
  504.         end
  505.         if @mid_stop
  506.           @mid_stop = false
  507.           return
  508.         else
  509.           terminate_message
  510.         end
  511.       end
  512.       return
  513.     end
  514.     if @fade_out == false and $game_temp.message_text != nil
  515.       @contents_showing = true
  516.       $game_temp.message_window_showing = true
  517.       refresh
  518.       Graphics.frame_reset
  519.       self.visible = true
  520.       self.contents_opacity = 0
  521.     if @input_number_window != nil
  522.       @input_number_window.contents_opacity = 0
  523.     end
  524.       @fade_in = true
  525.       return
  526.     end
  527.     if self.visible
  528.       @fade_out = true
  529.       self.opacity -= 48
  530.       if self.opacity == 0
  531.         self.visible = false
  532.         @fade_out = false
  533.         $game_temp.message_window_showing = false
  534.       end
  535.       return
  536.     end
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 获得字符
  540.   #--------------------------------------------------------------------------
  541.   def get_character(parameter)
  542.     case parameter
  543.     when 0
  544.       return $game_player
  545.     else
  546.       events = $game_map.events
  547.       return events == nil ? nil : events[parameter]
  548.     end
  549.   end
  550.   #--------------------------------------------------------------------------
  551.   # ● ウィンドウの位置と不透明度の設定
  552.   #--------------------------------------------------------------------------
  553.   def reset_window
  554.     # 判定
  555.     if @popchar >= 0
  556.       events = $game_map.events
  557.       if events != nil
  558.         character = get_character(@popchar)
  559.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  560.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  561.         self.x = x
  562.         self.y = y
  563.       end
  564.     elsif @popchar == -1
  565.       self.x = -4
  566.       self.y = -4
  567.       self.width = 648
  568.       self.height = 488
  569.     else
  570.       if $game_temp.in_battle
  571.         self.y = 16
  572.       else
  573.         case $game_system.message_position
  574.         when 0 # 上
  575.           self.y = 16
  576.         when 1 # 中
  577.           self.y = 160
  578.         when 2 # 下
  579.           self.y = 304
  580.         end
  581.         self.x = 80
  582.         if @face_file == nil
  583.           self.width = 480
  584.         else
  585.           self.width = 600
  586.           self.x -= 60
  587.         end
  588.         self.height = 160
  589.       end
  590.     end
  591.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  592.     if @face_file != nil
  593.       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  594.     end
  595.     if @popchar == -1
  596.       self.opacity = 255
  597.       self.back_opacity = 0
  598.     elsif $game_system.message_frame == 0
  599.       self.opacity = 255
  600.       self.back_opacity = 200
  601.     else
  602.       self.opacity = 0
  603.       self.back_opacity = 200
  604.     end
  605.   end
  606.   #--------------------------------------------------------------------------
  607.   # ● line_height
  608.   #--------------------------------------------------------------------------
  609.   # 返回値:行高
  610.   #--------------------------------------------------------------------------
  611.   def line_height
  612.     return 32
  613.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  614.       return 32
  615.     else
  616.       return self.contents.font.size * 15 / 10
  617.     end
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # ● 透過文字描画
  621.   #--------------------------------------------------------------------------
  622.   # target :描画対象。Bitmapクラスを指定。
  623.   # x :x座標
  624.   # y :y座標
  625.   # str  :描画文字列
  626.   # opacity:透過率(0~255)
  627.   # 返回値 :文字幅(@x増加値)。
  628.   #--------------------------------------------------------------------------
  629.   def opacity_draw_text(target, x, y, str,opacity)
  630.     height = target.font.size
  631.     width = target.text_size(str).width
  632.     opacity = [[opacity, 0].max, 255].min
  633.     if opacity == 255
  634.       target.draw_text(x, y, width, height, str)
  635.       return width
  636.     else
  637.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  638.         @opacity_text_buf.dispose
  639.         @opacity_text_buf = Bitmap.new(width, height)
  640.       else
  641.         @opacity_text_buf.clear
  642.       end
  643.       @opacity_text_buf.font.size = target.font.size
  644.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  645.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  646.     return width
  647.     end
  648.   end
  649.   def ruby_draw_text(target, x, y, str,opacity)
  650.     sizeback = target.font.size
  651.     target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  652.     rubysize = [rubysize, 6].max
  653.    
  654.     opacity = [[opacity, 0].max, 255].min
  655.     split_s = str.split(/,/)
  656.    
  657.     split_s[0] == nil ? split_s[0] = "" : nil
  658.     split_s[1] == nil ? split_s[1] = "" : nil
  659.    
  660.     height = sizeback + rubysize
  661.     width = target.text_size(split_s[0]).width
  662.    
  663.     target.font.size = rubysize
  664.     ruby_width = target.text_size(split_s[1]).width
  665.     target.font.size = sizeback
  666.    
  667.     buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  668.    
  669.     width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  670.    
  671.     if opacity == 255
  672.       target.font.size = rubysize
  673.       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  674.       target.font.size = sizeback
  675.       target.draw_text(x, y, width, target.font.size, split_s[0])
  676.       return width
  677.     else
  678.       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  679.         @opacity_text_buf.dispose
  680.         @opacity_text_buf = Bitmap.new(buf_width, height)
  681.       else
  682.         @opacity_text_buf.clear
  683.       end
  684.       @opacity_text_buf.font.size = rubysize
  685.       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  686.       @opacity_text_buf.font.size = sizeback
  687.       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  688.       if sub_x >= 0
  689.         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  690.       else
  691.         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  692.       end
  693.       return width
  694.     end
  695.   end
  696.   #--------------------------------------------------------------------------
  697.   # ● \V 变换
  698.   #--------------------------------------------------------------------------
  699.   def convart_value(option, index)
  700.     option == nil ? option = "" : nil
  701.     option.downcase!
  702.     case option
  703.       when "i"
  704.         unless $data_items[index].name == nil
  705.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  706.         end
  707.       when "w"
  708.         unless $data_weapons[index].name == nil
  709.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  710.         end
  711.       when "a"
  712.         unless $data_armors[index].name == nil
  713.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  714.         end
  715.       when "s"
  716.         unless $data_skills[index].name == nil
  717.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  718.         end
  719.       else
  720.       r = $game_variables[index]
  721.     end
  722.     r == nil ? r = "" : nil
  723.     return r
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # ● 解放
  727.   #--------------------------------------------------------------------------
  728.   def dispose
  729.     terminate_message
  730.     if @gaiji_cache != nil
  731.       unless @gaiji_cache.disposed?
  732.         @gaiji_cache.dispose
  733.       end
  734.     end
  735.     unless @opacity_text_buf.disposed?
  736.       @opacity_text_buf.dispose
  737.     end
  738.     $game_temp.message_window_showing = false
  739.     if @input_number_window != nil
  740.       @input_number_window.dispose
  741.     end
  742.     super
  743.   end
  744.   #--------------------------------------------------------------------------
  745.   # ● 矩形更新
  746.   #--------------------------------------------------------------------------
  747.   def update_cursor_rect
  748.     if @index >= 0
  749.       n = $game_temp.choice_start + @index
  750.       self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  751.     else
  752.       self.cursor_rect.empty
  753.     end
  754.   end
  755. end
  756. #==============================================================================
  757. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  758. #==============================================================================
  759. class Window_Frame < Window_Base
  760.   #--------------------------------------------------------------------------
  761.   # ● オブジェクト初期化
  762.   #--------------------------------------------------------------------------
  763.   def initialize(x, y, width, height)
  764.     super(x, y, width, height)
  765.     self.contents = nil
  766.     self.back_opacity = 200
  767.   end
  768.   #--------------------------------------------------------------------------
  769.   # ● 解放
  770.   #--------------------------------------------------------------------------
  771.   def dispose
  772.     super
  773.     end
  774.   end
  775. #==============================================================================
  776. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  777. #==============================================================================
  778. class Air_Text < Window_Base
  779.   #--------------------------------------------------------------------------
  780.   # ● オブジェクト初期化
  781.   #--------------------------------------------------------------------------
  782.   def initialize(x, y, designate_text)
  783.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  784.     self.opacity = 0
  785.     self.back_opacity = 0
  786.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  787.     w = self.contents.width
  788.     h = self.contents.height
  789.     self.contents.draw_text(0, 0, w, h, designate_text)
  790.   end
  791.   #--------------------------------------------------------------------------
  792.   # ● 解放
  793.   #--------------------------------------------------------------------------
  794.   def dispose
  795.     self.contents.clear
  796.     super
  797.   end
  798. end
复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2008-6-5
帖子
312
2
 楼主| 发表于 2009-8-15 13:31:34 | 只看该作者
66加强对话框出错了,强人来!
回复 支持 反对

使用道具 举报

Lv3.寻梦者

小柯的徒弟

梦石
0
星屑
1440
在线时间
1157 小时
注册时间
2008-5-24
帖子
3085

贵宾

3
发表于 2009-8-15 14:15:42 | 只看该作者
  1. class Game_System
  2. def soundname_on_speak=(a)
  3.   @soundname_on_speak = a
  4. end
  5. def soundname_on_speak
  6.   return @soundname_on_speak
  7. end
  8. alias lv05_initialize initialize
  9. def initialize
  10.   lv05_initialize
  11.   @soundname_on_speak = false
  12. end
  13. end
复制代码
加上这句。
回复 支持 反对

使用道具 举报

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9345
在线时间
2745 小时
注册时间
2008-9-5
帖子
3540

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

4
发表于 2009-8-15 19:20:23 | 只看该作者
本帖最后由 cinderelmini 于 2009-8-15 19:28 编辑

既然被回答了,那就补充一些吧。。
首先出错的原因是没有写那句脚本的相应内容。。。
接着,LS的那段脚本就是内容。。。可以放在任何脚本末端,甚至新建一个脚本。。但是要在main前。。。
最后。没了。。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-16 07:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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