查看: 2941|回复: 7

[已经解决] 一个关于跳过对话的问题

[复制链接]
梦石
0
星屑
3053
在线时间
441 小时
注册时间
2014-11-21
回帖
103
发表于 2017-6-11 11:46:44 | 显示全部楼层 |阅读模式

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

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

×
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #------------------------------------------------------------------------------
  4. # 原版:趙雲
  5. # 重制:RyanBern  2015.08.24
  6. #------------------------------------------------------------------------------
  7. # 更新记录:
  8. #     2015.09.06    少许BUG修复,附加战斗场景对话效果
  9. #     2015.11.05    修复临时更改字号功能
  10. #     2015.11.13    增加更改姓名颜色的功能,修复显示 BUG
  11. #     2016.01.19    增加大型半身像对话框设置,快捷方式设置
  12. #==============================================================================

  13. #——说明

  14. # 使用时,要在Graphics文件夹下新建一个名为Faces的文件夹,用于存储头像
  15. # 对话框的窗口素材可不必和系统窗口相同,请将对话框窗口素材放到
  16. # Graphics/Windowskins文件夹下,并附上两个气泡箭头素材,用于指向说话者,
  17. # 命名规则为“对话框窗口素材名-top”和“对话框窗口素材名-under”
  18. # 然后在本脚本的设置区域修改。

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

  25. # 其他在对话中可以使用的功能:
  26.   
  27. # \n[1]:显示1号角色的姓名

  28. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  29. # \nc[0-7]:更改姓名框颜色

  30. # 非战斗时,\p功能可以自动调整对话框位置
  31. # \p[1] :对话框出现在1号事件的上方
  32. # \p[0] :主人公上方出现对话框
  33. # \p[-1]:对话框出现在屏幕下方,这种特殊类型的对话框在有大型半身像时使用
  34. #——————————————————使用\p功能后可以自动调整对话框大小
  35. # 使用\p功能后,使用事件指令[更改文章选项]可更改对话框的位置
  36. #   [上] :对话框出现在说话者上方
  37. #   [下] :对话框出现在说话者下方
  38. #   [中] :对话框出现在屏幕正中
  39. # 战斗时,\p功能有所变化
  40. # \p[1]:对话框出现在ID为1的角色战斗图附近(这个角色必须是队伍中的成员)
  41. # \p[1001]:对话框出现在Index为1的敌人战斗图附近--也就是说敌人的位置从
  42. #           1001开始算起,1002则是代表Index为2的敌人。
  43. # 战斗时使用\p指令+[更改文章选项]依然是有效的,但是如果不使用\p指令,那么
  44. # 对话框则会一直出现在屏幕正上方。

  45. # \\:显示""这个符号

  46. # \v[1] :显示变量1

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

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

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

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

  51. # \ic[001-Weapon01] : 显示图标"001-Weapon01.png"

  52. # \c[0-7]:更改颜色

  53. # \g:显示金钱窗口

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

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

  56. # \.   :停顿一刹那(1、2帧)
  57. # \|   :停顿片刻(20帧)

  58. # \>   :文字不用打字方式
  59. # \<   :文字使用打字方式

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

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

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

  64. # \h[12]:改用12号字

  65. # \b[50]:空50象素

  66. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效

  67. # \L[001]:在左边显示图片“Graphics/Faces/001.png”,并左右镜像反转
  68. # \R[001]:在右边显示图片“Graphics/Faces/001.png”

  69. #==============================================================================
  70. # 设置区域
  71. #==============================================================================
  72. module RB
  73. end
  74. module RB::Mes_Config
  75.   # 主角名字字符缩写
  76.   Regex_Player_Name = /pn(\d+)/
  77.   # 字体大小
  78.   Size = 20
  79.   Mes_Windowskin = "01"
  80.   # 对话框窗口皮肤(不写为和系统皮肤相同)
  81.   # 最大行数(初值为 4,尽量不要修改,如果考虑合并选择项和文章,可以设置为 6 以上)
  82.   # 此最大行数仅在 \p 指令下有效,如果不使用 \p 指令那么对话框还是 4 行的高度
  83.   Max_Lines = 70
  84.   # 快捷指令,定义后,可以直接在文本框中输入快捷指令
  85.   # 定义方式为 快捷指令 => 完整指令 ,使用方式为 \sc[快捷指令]
  86.   # 注意,指令中通常包含反斜线'\',因此需要使用单引号的字符串,
  87.   # 或者用"\"进行转义。下面是一个例子:
  88.   # 这样定义后,输入\sc[pn1]就等效为 \name[pn1]\r[L1]\p[-1]
  89.   Shortcuts = {
  90.     'pn1' => '\name[pn1]\r[L1]\p[-1]'
  91.   }
  92. end

  93. #==============================================================================
  94. # ■ Game_System
  95. #------------------------------------------------------------------------------
  96. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  97. # $game_system 。
  98. #==============================================================================

  99. class Game_System
  100.   attr_accessor :typing
  101.   attr_accessor :soundname_on_speak
  102.   alias carol3_ini initialize
  103.   def initialize
  104.     carol3_ini
  105.     @typing = true
  106.     @soundname_on_speak = nil
  107.   end
  108. end
  109. $加密 = true
  110. $refresh = {}
  111. #==============================================================================
  112. # ■ Window_Message
  113. #------------------------------------------------------------------------------
  114. #   修改的对话框类。
  115. #==============================================================================
  116. class Window_Message < Window_Selectable
  117.   include RB::Mes_Config
  118.   #--------------------------------------------------------------------------
  119.   # ● 初始化状态
  120.   #--------------------------------------------------------------------------
  121.   def initialize
  122.     super(80, 304, 480, 160)
  123.     self.contents = Bitmap.new(width - 32, height - 32)
  124.     self.visible = false
  125.     self.z = 9998
  126.     @fade_in = false
  127.     @fade_out = false
  128.     @contents_showing = false
  129.     @cursor_width = 0
  130.     self.active = false
  131.     self.index = -1
  132.     if $game_system.soundname_on_speak == nil then
  133.       $game_system.soundname_on_speak = ""
  134.     end
  135.     self.windowskin = RPG::Cache.windowskin(Mes_Windowskin) if Mes_Windowskin != ""
  136.     @opacity_text_buf = Bitmap.new(32, 32)
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 释放
  140.   #--------------------------------------------------------------------------
  141.   def dispose
  142.     terminate_message
  143.     $game_temp.message_window_showing = false
  144.     if @input_number_window != nil
  145.       @input_number_window.dispose
  146.     end
  147.     super
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 处理信息结束
  151.   #--------------------------------------------------------------------------
  152.   def terminate_message
  153.     $refresh["mess"] = false
  154.     self.active = false
  155.     self.pause = false
  156.     self.index = -1
  157.     self.contents.clear
  158.     # 清除显示中标志
  159.     @contents_showing = false
  160.     # 呼叫信息调用
  161.     if $game_temp.message_proc != nil
  162.       $game_temp.message_proc.call
  163.     end
  164.     # 清除文章、选择项、输入数值的相关变量
  165.     $game_temp.message_text = nil
  166.     $game_temp.message_proc = nil
  167.     $game_temp.choice_start = 9999
  168.     $game_temp.choice_max = 0
  169.     $game_temp.choice_cancel_type = 0
  170.     $game_temp.choice_proc = nil
  171.     $game_temp.num_input_start = 9999
  172.     $game_temp.num_input_variable_id = 0
  173.     $game_temp.num_input_digits_max = 0
  174.     # 释放金钱窗口
  175.     if @gold_window != nil
  176.       @gold_window.dispose
  177.       @gold_window = nil
  178.     end
  179.     # 释放姓名窗口
  180.     if @name_window_text != nil
  181.       @name_window_text.dispose
  182.       @name_window_text = nil
  183.     end
  184.     # 释放右侧立绘
  185.     if @right_picture != nil
  186.       @right_picture.dispose
  187.       @right_picture = nil
  188.     end   
  189.     # 释放左侧立绘
  190.     if @left_picture != nil
  191.       @left_picture.dispose
  192.       @left_picture = nil
  193.     end
  194.     # 释放姓名蓝条
  195.     if @bar != nil
  196.       @bar.bitmap.dispose
  197.       @bar.dispose
  198.       @bar = nil
  199.     end
  200.     # 释放气泡图标
  201.     if @k_tale != nil
  202.       @k_tale.dispose
  203.       @k_tale = nil
  204.     end
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # ● 刷新
  208.   #--------------------------------------------------------------------------
  209.   def refresh
  210.     $refresh["mess"] = true
  211.     # 初期化
  212.     self.contents.clear
  213.     self.contents.font.color = normal_color
  214.     self.contents.font.size = Size
  215.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  216.     @face_indent = 0
  217.     @opacity = 255
  218.     @cursor_width = 0
  219.     @write_speed = 1
  220.     @write_wait = 0
  221.     @mid_stop = false
  222.     @popchar = -2
  223.     if $game_temp.choice_start == 0
  224.       @x = 8
  225.     end
  226.     if $game_temp.message_text != nil
  227.       @now_text = $game_temp.message_text
  228.       # Shortcuts 预处理
  229.       @now_text.gsub!(/\\sc\[(.*?)\]/) { Shortcuts[$1] || "" }
  230.       #——左半身像设置
  231.       if (/\\[Ll]\[(.+?)\]/.match(@now_text)) != nil then
  232.         [url=home.php?mod=space&uid=84331]@face[/url] = $1
  233.         if $加密 == true
  234.           if @left_picture != nil
  235.             @left_picture.dispose
  236.           end
  237.           @left_picture = Sprite.new
  238. @left_picture.bitmap = Bitmap.new(96,112)
  239.           @left_picture.bitmap.blt(0,0,Bitmap.new("Graphics/Faces/#{@face.split('?')[0]}"),
  240.           Rect.new(@face.split('?')[1].to_i%4 * 96, @face.split('?')[1].to_i/4 * 96, 96, 96))
  241.           @left_picture.y = 480 -96-24
  242.           @left_picture.x = 0
  243.           @left_picture.mirror = true
  244.           @x = @face_indent = @left_picture.bitmap.width
  245.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  246.         else         
  247.           if FileTest.exist?("Graphics/Faces/#{@face.split('?')[0]}")
  248.             if @left_picture != nil
  249.               @left_picture.dispose
  250.             end
  251.             @left_picture = Sprite.new
  252.             #@left_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face.split('?')[0]}")
  253.           @left_picture.bitmap = Bitmap.new(96,96)
  254.           @left_picture.bitmap.blt(0,0,Bitmap.new("Graphics/Faces/#{@face.split('?')[0]}"),
  255.           Rect.new(@face.split('?')[1].to_i%4 * 96, @face.split('?')[1].to_i/4 * 96, 96, 96))
  256.             #Rect.new(@face.split('?')[1].to_i%4 * 96, @face.split('?')[1].to_i/4 * 96, 96, 96))
  257.             @left_picture.y = 480 - @left_picture.bitmap.height-24
  258.             @left_picture.x = 0
  259.             @left_picture.mirror = true
  260.             @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  261.           end
  262.         end        
  263.       end
  264.       #——右半身像设置
  265.       if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  266.         @face = $1
  267.         if $加密 == true
  268.           if @right_picture != nil
  269.             @right_picture.dispose
  270.           end
  271.           @right_picture = Sprite.new
  272.          # @right_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face.split('?')[0]}")
  273.          @right_picture.bitmap = Bitmap.new(96,96)
  274.           @right_picture.bitmap.blt(0,0,Bitmap.new("Graphics/Faces/#{@face.split('?')[0]}"),
  275.           Rect.new(@face.split('?')[1].to_i%4 * 96, @face.split('?')[1].to_i/4 * 96, 96, 96))
  276.         #  @right_picture.y = 480 - @right_picture.bitmap.height
  277.         #  @right_picture.x = 640 - @right_picture.bitmap.width
  278.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  279.         else
  280.           if FileTest.exist?("Graphics/Faces/#{@face}")
  281.             if @right_picture != nil
  282.               @right_picture.dispose
  283.             end
  284.             @right_picture = Sprite.new
  285.             @right_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
  286.             @right_picture.y = 480 - @right_picture.bitmap.height
  287.             @right_picture.x = 640 - @right_picture.bitmap.width
  288.             @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  289.           end
  290.         end
  291.       end
  292.       # 显示人物姓名
  293.       name_window_set = false
  294.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  295.         name_window_set = true
  296.         name_text = $1
  297.         if Regex_Player_Name =~ name_text
  298.           name_text = $game_actors[$1.to_i].name
  299.         end
  300.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  301.       end
  302.       # 人物姓名颜色
  303.       name_color = text_color(0)
  304.       if (/\\[Nn]c\[(\d+)\]/.match(@now_text)) != nil
  305.         name_color = text_color($1.to_i)
  306.         @now_text.sub!(/\\[Nn]c\[(\d+)\]/) { "" }
  307.       end
  308.       # 文字位置的判定
  309.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text)) != nil then
  310.         @popchar = $1.to_i
  311.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  312.       end
  313.       # 开始替换文字(\v)
  314.       begin
  315.         last_text = @now_text.clone
  316.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  317.       end until @now_text == last_text
  318.       # 替换控制码
  319.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  320.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  321.       end
  322.       @now_text.gsub!(/\\\\/) { "\000" }
  323.       @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  324.       @now_text.gsub!(/\\[Gg]/) { "\002" }
  325.       @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  326.       @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  327.       @now_text.gsub!(/\\[.]/) { "\005" }
  328.       @now_text.gsub!(/\\[|]/) { "\006" }
  329.       @now_text.gsub!(/\\[Ii]c\[(.*?)\]/) { "\030[#{$1}] "}
  330.       @now_text.gsub!(/\\[>]/) { "\016" }
  331.       @now_text.gsub!(/\\[<]/) { "\017" }
  332.       @now_text.gsub!(/\\[!]/) { "\020" }
  333.       @now_text.gsub!(/\\[~]/) { "\021" }
  334.       @now_text.gsub!(/\\[Ii]/) { "\023" }
  335.       @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  336.       @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  337.       @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  338.       @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  339.       # \p 的情况下调整文字大小
  340.       if @popchar >= 0
  341.         @text_save = @now_text.clone
  342.         process_real_text
  343.         @max_x = name_window_set ? contents.text_size(name_text).width : 0
  344.         @max_y = Max_Lines
  345.         for i in 0...Max_Lines
  346.           line = @text_save.split(/\n/)[Max_Lines-i-1]
  347.           @max_y -= 1 if line == nil && @max_y <= Max_Lines - i
  348.           next if line == nil
  349.           contents.font.size = Size
  350.           cx = contents.text_size(line).width
  351.           @max_x = cx if cx > @max_x
  352.         end
  353.         if @right_picture != nil && !@right_picture.disposed?
  354.           self.width = @max_x + 48 + @face_indent + @right_picture.bitmap.width
  355.         else
  356.           self.width = @max_x + 48 + @face_indent
  357.         end
  358.         if $game_temp.num_input_variable_id > 0
  359.           self.height = (@max_y - 1) * line_height + 96
  360.         else
  361.           self.height = (@max_y - 1) * line_height + 64
  362.         end
  363.       else
  364.         @max_x = self.width - 32 - @face_indent
  365.       end
  366.       reset_window
  367.       # 如果设置了姓名框
  368.       if name_window_set
  369.         off_x = 0
  370.         off_y = -40
  371.         space = 2
  372.         x = self.x + off_x - space / 2
  373.         y = self.y + off_y - space / 2
  374.         w = self.contents.text_size(name_text).width + 26 + space
  375.         h = 40 + space
  376.         x = self.x + off_x + 4
  377.         y = self.y + off_y
  378.         @name_window_text = Air_Text.new(self.x + @face_indent+4+8, self.y+16, name_text, name_color)
  379.         @name_window_text.z = self.z + 2
  380.         @bar = Sprite.new
  381.         @bar.bitmap = Bitmap.new(self.width, 24)
  382.         @bar.x = self.x + 8+100
  383.         @bar.y = self.y + 16
  384.         @bar.z = self.z + 2
  385.         @bar.bitmap.fill_rect(0,0,self.width-16-100,24,Color.new(120,180,250,80))
  386.       end
  387.     end
  388.     reset_window
  389.     # 如果选择项被设置
  390.     if $game_temp.choice_max > 0
  391.       @item_max = $game_temp.choice_max
  392.       self.active = true
  393.       self.index = 0
  394.     end
  395.     # 如果数值输入被设置
  396.     if $game_temp.num_input_variable_id > 0
  397.       digits_max = $game_temp.num_input_digits_max
  398.       number = $game_variables[$game_temp.num_input_variable_id]
  399.       @input_number_window = Window_InputNumber.new(digits_max)
  400.       @input_number_window.number = number
  401.       @input_number_window.x = self.x + @face_indent
  402.       @input_number_window.y = self.y + 8 + $game_temp.num_input_start * line_height
  403.     end
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● 更新
  407.   #--------------------------------------------------------------------------
  408.   def update
  409.     super
  410.     # 使用默认窗口外观的情况下,如果窗口的外关被变更了、再设置
  411.     if $game_system.windowskin_name != @windowskin_name && Mes_Windowskin == ""
  412.       @windowskin_name = $game_system.windowskin_name
  413.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  414.     end
  415.     # 如果设置了气泡图标
  416.     if @k_tale != nil && @k_tale.visible && !$game_temp.in_battle
  417.       character = get_character(@popchar)
  418.       x = [[character.screen_x - self.width / 2, 4].max, 636 - self.width].min
  419.       if $game_system.message_position == 2
  420.         y = [[character.screen_y + 16, 4].max, 476 - self.height].min
  421.       elsif $game_system.message_position == 0
  422.         y = [[character.screen_y - process_y_shift(character) - self.height, 4].max, 476 - self.height].min
  423.       end
  424.       self.x = x
  425.       self.y = y
  426.       # 设置气泡图标坐标
  427.       @k_tale.x = ( character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  428.       if $game_system.message_position == 2
  429.         @k_tale.y = self.y - 16
  430.       elsif $game_system.message_position == 0
  431.         @k_tale.y = self.y + self.height - 16
  432.       end
  433.       # 设置左侧立绘坐标
  434.       if @left_picture != nil and !@left_picture.disposed?
  435.         @left_picture.x = x + 8
  436.         @left_picture.y = y - @left_picture.bitmap.height + self.height - 8
  437.       end
  438.       # 设置右侧立绘坐标
  439.       if @right_picture != nil and !@right_picture.disposed?
  440.         @right_picture.x = x+[email]self.width-@right_picture.bitmap.width[/email]-8
  441.         @right_picture.y = y - @right_picture.bitmap.height + self.height - 8
  442.       end
  443.       # 设置姓名空气文字坐标
  444.       if @name_window_text != nil
  445.         @name_window_text.x = self.x + @face_indent - 4
  446.         @name_window_text.y = self.y
  447.       end
  448.       # 设置姓名蓝条坐标
  449.       if @bar != nil
  450.         @bar.x = self.x + 8
  451.         @bar.y = self.y + 16
  452.       end
  453.     end
  454.     # 淡入中的情况下
  455.     if @fade_in
  456.       self.contents_opacity += 24
  457.       if @input_number_window != nil
  458.         @input_number_window.contents_opacity += 24
  459.       end
  460.       if self.contents_opacity == 255
  461.         @fade_in = false
  462.       end
  463.       if Input.press?(Input::CTRL)
  464.         self.contents_opacity = 255
  465.         @fade_in = false
  466.       end
  467.       return
  468.     end
  469.     @now_text = nil if @now_text == ""
  470.     # 逐个描绘文字
  471.     if @now_text != nil and @mid_stop == false
  472.       if @write_wait > 0
  473.         @write_wait -= 1
  474.         return
  475.       end
  476.       if Input.press?(Input::CTRL)
  477.         text_not_skip = false
  478.         else
  479.       text_not_skip = $game_system.typing
  480.       end
  481.       while true
  482.         @max_x = @x if @max_x < @x
  483.         @max_y = @y if @max_y < @y
  484.         # 处理字符
  485.         if (c = @now_text.slice!(/./m)) != nil
  486.           # \\的情况下
  487.           if c == "\000"
  488.             c = "\"
  489.           end
  490.           # \c的情况下
  491.           if c == "\001"
  492.             @now_text.sub!(/\[([0-9]+)\]/, "")
  493.             color = $1.to_i
  494.             if color >= 0 and color <= 7
  495.               self.contents.font.color = text_color(color)
  496.             end
  497.             c = ""
  498.           end
  499.           # \g的情况下
  500.           if c == "\002"
  501.             if @gold_window == nil && @popchar <= 0
  502.               @gold_window = Window_Gold.new
  503.               @gold_window.x = 560 - @gold_window.width
  504.               if $game_temp.in_battle
  505.                 @gold_window.y = 192
  506.               else
  507.                 @gold_window.y = self.y >= 128 ? 32 : 384
  508.               end
  509.               @gold_window.opacity = self.opacity
  510.               @gold_window.back_opacity = self.back_opacity
  511.             end
  512.             c = ""
  513.           end
  514.           # \s的情况下
  515.           if c == "\003"
  516.             @now_text.sub!(/\[([0-9]+)\]/, "")
  517.             speed = $1.to_i
  518.             if speed >= 0 and speed <= 19
  519.               @write_speed = speed
  520.             end
  521.             c = ""
  522.           end
  523.           # \a的情况下
  524.           if c == "\004"
  525.             @now_text.sub!(/\[(.*?)\]/, "")
  526.             buftxt = $1.dup.to_s
  527.             if buftxt.match(/\//) == nil && buftxt != "" then
  528.               $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  529.             else
  530.               $game_system.soundname_on_speak = buftxt.dup
  531.             end
  532.             c = ""
  533.           end
  534.           # \.的情况下
  535.           if c == "\005"
  536.             @write_wait += 5
  537.             c = ""
  538.           end
  539.           # \|的情况下
  540.           if c == "\006"
  541.             @write_wait += 20
  542.             c = ""
  543.           end
  544.           # \>的情况下
  545.           if c == "\016"
  546.             text_not_skip = false
  547.             c = ""
  548.           end
  549.           # \<的情况下
  550.           if c == "\017"
  551.             text_not_skip = true
  552.             c = ""
  553.           end
  554.           # \!的情况下
  555.           if c == "\020"
  556.             @mid_stop = true
  557.             c = ""
  558.           end
  559.           # \~的情况下
  560.           if c == "\021"
  561.             terminate_message
  562.             return
  563.           end
  564.           # \i的情况下
  565.           if c == "\023"
  566.             @indent = @x
  567.             c = ""
  568.           end
  569.           # \o的情况下
  570.           if c == "\024"
  571.             @now_text.sub!(/\[([0-9]+)\]/, "")
  572.             @opacity = $1.to_i
  573.             c = ""
  574.           end
  575.           # \h的情况下
  576.           if c == "\025"
  577.             @now_text.sub!(/\[([0-9]+)\]/, "")
  578.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  579.             c = ""
  580.           end
  581.           # \b的情况下
  582.           if c == "\026"
  583.             @now_text.sub!(/\[([0-9]+)\]/, "")
  584.             @x += $1.to_i
  585.             c = ""
  586.           end
  587.           # \k的情况下
  588.           if c == "\027"
  589.             @now_text.sub!(/\[(.*?)\]/, "")
  590.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  591.             if $game_system.soundname_on_speak != ""
  592.               Audio.se_play($game_system.soundname_on_speak)
  593.             end
  594.             c = ""
  595.           end
  596.           # 图标的情况
  597.           if c == "\030"
  598.             @now_text.sub!(/\[(.*?)\]/, "")
  599.             self.contents.blt(@x , @y * line_height + (line_height - 32) / 2, RPG::Cache.icon($1), Rect.new(0, 0, 32, 32))
  600.             if $game_system.soundname_on_speak != ""
  601.               Audio.se_play($game_system.soundname_on_speak)
  602.             end
  603.             @x += 24
  604.             c = ""
  605.           end
  606.           # 另起一行的情况下
  607.           if c == "\n"
  608.             if @lines >= $game_temp.choice_start
  609.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  610.             end
  611.             @lines += 1
  612.             @y += 1
  613.             @x = 0 + @indent + @face_indent
  614.             if @lines >= $game_temp.choice_start
  615.               @x = 8 + @indent + @face_indent
  616.             end
  617.             c = ""
  618.           end
  619.           if c != ""
  620.             # 文字描画
  621.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size) / 2, c, @opacity)
  622.             if $game_system.soundname_on_speak != "" then
  623.               Audio.se_play($game_system.soundname_on_speak)
  624.             end
  625.           end
  626.           if Input.press?(Input::B)
  627.             text_not_skip = false
  628.           end
  629.         else
  630.           text_not_skip = true
  631.           break
  632.         end
  633.         # 終了判定
  634.         if text_not_skip
  635.           break
  636.         end
  637.       end
  638.       @write_wait += @write_speed
  639.       return
  640.     end
  641.     # 数值输入的处理
  642.     if @input_number_window != nil
  643.       @input_number_window.update
  644.       # 确认
  645.       if Input.trigger?(Input::C)
  646.         $game_system.se_play($data_system.decision_se)
  647.         $game_variables[$game_temp.num_input_variable_id] =
  648.           @input_number_window.number
  649.         $game_map.need_refresh = true
  650.         @input_number_window.dispose
  651.         @input_number_window = nil
  652.         terminate_message
  653.       end
  654.       return
  655.     end
  656.     # 文章显示中的情况下
  657.     if @contents_showing
  658.       if $game_temp.choice_max == 0
  659.         self.pause = true
  660.       end
  661.       # 取消
  662.       if Input.trigger?(Input::B)
  663.         if $game_temp.choice_max > 0 && $game_temp.choice_cancel_type > 0
  664.           $game_system.se_play($data_system.cancel_se)
  665.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  666.           terminate_message
  667.         end
  668.       end
  669.       # 确定
  670.       if Input.trigger?(Input::C) || Input.press?(Input::CTRL)
  671.         # 释放气泡图标
  672.         if @k_tale != nil  
  673.           @k_tale.dispose
  674.           @k_tale = nil
  675.         end
  676.         if $game_temp.choice_max > 0
  677.           $game_system.se_play($data_system.decision_se)
  678.           $game_temp.choice_proc.call(self.index)
  679.         end
  680.         if @mid_stop
  681.           @mid_stop = false
  682.           return
  683.         else
  684.         terminate_message
  685.         end
  686.       end
  687.       return
  688.     end
  689.    
  690.     if @fade_out == false and $game_temp.message_text != nil
  691.       @contents_showing = true
  692.       $game_temp.message_window_showing = true
  693.       refresh
  694.       Graphics.frame_reset
  695.       self.visible = true
  696.       self.contents_opacity = 0
  697.       if @input_number_window != nil
  698.         @input_number_window.contents_opacity = 0
  699.       end
  700.       @fade_in = true
  701.       return
  702.     end
  703.     if self.visible
  704.       @fade_out = true
  705.       self.opacity -= 48
  706.       if self.opacity == 0
  707.         self.visible = false
  708.         @fade_out = false
  709.         $game_temp.message_window_showing = false
  710.       end
  711.       return
  712.     end
  713.   end
  714.   #--------------------------------------------------------------------------
  715.   # ● 预览实际描绘内容(计算窗口宽用)
  716.   #--------------------------------------------------------------------------
  717.   #    实际对 @text_save 进行操作
  718.   #    此方法用于去除某些控制码引起窗口过长的影响
  719.   #--------------------------------------------------------------------------
  720.   def process_real_text
  721.     return if @text_save.nil?
  722.     regex = /[\001-\006\016\017\020\021\024](\[.*?\]){0,1}/
  723.     regex30 = /\030\[.*?\]/
  724.     @text_save.gsub!(regex, "")
  725.     @text_save.gsub!(regex30, "   ")
  726.   end
  727.   #--------------------------------------------------------------------------
  728.   # ● 获得角色(\p功能)
  729.   #--------------------------------------------------------------------------
  730.   def get_character(parameter)
  731.     case parameter
  732.     when 0
  733.       return $game_player
  734.     else
  735.       events = $game_map.events
  736.       return events == nil ? nil : events[parameter]
  737.     end
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # ● 获得战斗者(\p功能,此功能仅在战斗中有效)
  741.   #--------------------------------------------------------------------------
  742.   #    parameter : 1-999 表示主角 ID,1001-1008 表示索引为1-8的各个敌人
  743.   #--------------------------------------------------------------------------
  744.   def get_battler(parameter)
  745.     if parameter < 1000
  746.       return $game_actors[parameter]
  747.     else
  748.       return $game_troop.enemies[parameter - 1001]
  749.     end
  750.   end
  751.   #--------------------------------------------------------------------------
  752.   # ● 计算 y 偏移量(\p功能,这是考虑到不同战斗图/行走图的高度不同)
  753.   #--------------------------------------------------------------------------
  754.   #    character : 角色/战斗者
  755.   #--------------------------------------------------------------------------
  756.   def process_y_shift(character)
  757.     rate = character.is_a?(Game_Battler) ? 1 : 4
  758.     bmp = character.is_a?(Game_Battler) ?
  759.       RPG::Cache.battler(character.battler_name, character.battler_hue) :
  760.       RPG::Cache.character(character.character_name, character.character_hue)
  761.     return bmp.height / rate + 16
  762.   end
  763.   #--------------------------------------------------------------------------
  764.   # ● 重置窗口(位置,不透明度)
  765.   #--------------------------------------------------------------------------
  766.   def reset_window
  767.     # 判定
  768.     if @k_tale != nil  
  769.       @k_tale.dispose
  770.       @k_tale = nil
  771.     end
  772.     # 如果使用了 \p 设置位置
  773.     if @popchar >= 0
  774.       character = $game_temp.in_battle ? get_battler(@popchar) : get_character(@popchar)
  775.       if character != nil
  776.         x = [[character.screen_x - self.width / 2, 4].max, 636 - self.width].min
  777.         if $game_system.message_position == 2
  778.           y = [[character.screen_y + 16, 4].max, 476 - self.height].min
  779.         elsif $game_system.message_position == 0
  780.           y = [[character.screen_y - process_y_shift(character) - self.height, 4].max, 476 - self.height].min
  781.         else
  782.           x = 320 - self.width / 2
  783.           y = 240 - self.height / 2
  784.         end
  785.         self.x = x
  786.         self.y = y
  787.         # 设置气泡图标
  788.         @k_tale = Sprite.new
  789.         k_tale_filename = Mes_Windowskin == "" ? $game_system.windowskin_name : Mes_Windowskin
  790.         suffix = $game_system.message_position == 2 ? "-under" : "-top"
  791.         @k_tale.bitmap = RPG::Cache.windowskin(k_tale_filename + suffix)
  792.         @k_tale.x = character.is_a?(Game_Character) ?
  793.           ( character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16 :
  794.           character.screen_x
  795.         if $game_system.message_position == 2
  796.           @k_tale.y = self.y - 16
  797.         elsif $game_system.message_position == 0
  798.           @k_tale.y = self.y + self.height - 16
  799.         else
  800.           @k_tale.visible = false
  801.         end
  802.         @k_tale.z = 9999
  803.       end
  804.     elsif @popchar == -1
  805.       self.x = 0
  806.       self.width = 640
  807.       self.height = 64 + line_height * 3
  808.       self.y = 480 - self.height
  809.     else # 无 \p 的情况下
  810.       # 处于战斗中时
  811.       if $game_temp.in_battle
  812.         self.y = 16
  813.       else
  814.         # 显示文章位置的分支
  815.         case $game_system.message_position
  816.         when 0 # 上
  817.           self.y = 16
  818.         when 1 # 中
  819.           self.y = 160
  820.         when 2 # 下
  821.           self.y = 304
  822.         end
  823.       end
  824.       self.width = 480 * 0.8
  825.       self.height = 64 + line_height * 3
  826.       self.x = 320 - self.width / 2
  827.     end # of @popchar >= 0
  828.     # 设置左侧立绘
  829.     if @left_picture != nil and !@left_picture.disposed?
  830.       @left_picture.x = self.x + 8
  831.       @left_picture.y = self.y - @left_picture.bitmap.height + self.height - 8
  832.       @left_picture.z = self.z + 4
  833.     end
  834.     # 设置右侧立绘
  835.     if @right_picture != nil and !@right_picture.disposed?
  836.       @right_picture.x = self.x + self.width - @right_picture.bitmap.width - 8
  837.       @right_picture.y = self.y - @right_picture.bitmap.height + self.height - 8
  838.       @right_picture.z = self.z + 4
  839.     end
  840.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  841.     self.contents.font.size = Size
  842.     # 设置不透明度
  843.     if $game_system.message_frame == 0
  844.       self.opacity = 255
  845.       self.back_opacity = 200
  846.     else
  847.       self.opacity = 0
  848.       self.back_opacity = 200
  849.     end
  850.   end
  851.   #--------------------------------------------------------------------------
  852.   # ● line_height
  853.   #--------------------------------------------------------------------------
  854.   # 返回值 : 行高
  855.   #--------------------------------------------------------------------------
  856.   def line_height
  857.     return [[Size * 15 / 10, 18].max, 32].min
  858.   end
  859.   #--------------------------------------------------------------------------
  860.   # ● 文字描画
  861.   #--------------------------------------------------------------------------
  862.   # target :描绘的目标 bitmap 对象
  863.   # x      :x 坐标
  864.   # y      :y 坐标
  865.   # str   :描绘的文字
  866.   # opacity:不透明度(0~255)
  867.   # 返回值 :文字宽度(@x 的增加值)。
  868.   #--------------------------------------------------------------------------
  869.   def opacity_draw_text(target, x, y, str,opacity)
  870.     height = target.font.size
  871.     width = target.text_size(str).width
  872.     opacity = [[opacity, 0].max, 255].min
  873.     if opacity == 255
  874.       target.draw_text(x, y, width, height, str)
  875.       return width
  876.     else
  877.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  878.         @opacity_text_buf.dispose
  879.         @opacity_text_buf = Bitmap.new(width, height)
  880.       else
  881.         @opacity_text_buf.clear
  882.       end
  883.       @opacity_text_buf.font.size = target.font.size
  884.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  885.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  886.     return width
  887.     end
  888.   end
  889.   def ruby_draw_text(target, x, y, str, opacity)
  890.     sizeback = target.font.size
  891.     target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  892.     rubysize = [rubysize, 6].max
  893.     opacity = [[opacity, 0].max, 255].min
  894.     split_s = str.split(/,/)
  895.     split_s[0] == nil ? split_s[0] = "" : nil
  896.     split_s[1] == nil ? split_s[1] = "" : nil
  897.     height = sizeback + rubysize
  898.     width = target.text_size(split_s[0]).width
  899.     target.font.size = rubysize
  900.     ruby_width = target.text_size(split_s[1]).width
  901.     target.font.size = sizeback
  902.     buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  903.     width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  904.     if opacity == 255
  905.       target.font.size = rubysize
  906.       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  907.       target.font.size = sizeback
  908.       target.draw_text(x, y, width, target.font.size, split_s[0])
  909.       return width
  910.     else
  911.       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  912.         @opacity_text_buf.dispose
  913.         @opacity_text_buf = Bitmap.new(buf_width, height)
  914.       else
  915.         @opacity_text_buf.clear
  916.       end
  917.       @opacity_text_buf.font.size = rubysize
  918.       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  919.       @opacity_text_buf.font.size = sizeback
  920.       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  921.       if sub_x >= 0
  922.         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  923.       else
  924.         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  925.       end
  926.       return width
  927.     end
  928.   end
  929.   #--------------------------------------------------------------------------
  930.   # ● \V 变换
  931.   #--------------------------------------------------------------------------
  932.   # option : 选项,'i'物品,'w'武器,'a'防具,'s'技能
  933.   # index  : 数据库的索引
  934.   #--------------------------------------------------------------------------
  935.   def convart_value(option, index)
  936.     option == nil ? option = "" : nil
  937.     option.downcase!
  938.     case option
  939.       when "i"
  940.         unless $data_items[index].name == nil
  941.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  942.         end
  943.       when "w"
  944.         unless $data_weapons[index].name == nil
  945.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  946.         end
  947.       when "a"
  948.         unless $data_armors[index].name == nil
  949.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  950.         end
  951.       when "s"
  952.         unless $data_skills[index].name == nil
  953.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  954.         end
  955.       else
  956.       r = $game_variables[index]
  957.     end
  958.     r == nil ? r = "" : nil
  959.     return r
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● 释放
  963.   #--------------------------------------------------------------------------
  964.   def dispose
  965.     terminate_message
  966.     unless @opacity_text_buf.disposed?
  967.       @opacity_text_buf.dispose
  968.     end
  969.     $game_temp.message_window_showing = false
  970.     if @input_number_window != nil
  971.       @input_number_window.dispose
  972.     end
  973.     super
  974.   end
  975.   #--------------------------------------------------------------------------
  976.   # ● 刷新光标矩形
  977.   #--------------------------------------------------------------------------
  978.   def update_cursor_rect
  979.     if @index >= 0
  980.       n = $game_temp.choice_start + @index
  981.       self.cursor_rect.set(4 + @indent + @face_indent, n * line_height, @cursor_width, line_height)
  982.     else
  983.       self.cursor_rect.empty
  984.     end
  985.   end
  986. end
  987. #==============================================================================
  988. # ■ Air_Text
  989. #------------------------------------------------------------------------------
  990. #   空气文字,借助窗口显示文字,但是不显示窗口载体。
  991. #==============================================================================
  992. class Air_Text < Window_Base
  993.   #--------------------------------------------------------------------------
  994.   # ● 对象初始化
  995.   #--------------------------------------------------------------------------
  996.   def initialize(x, y, designate_text, color)
  997.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  998.     self.opacity = 0
  999.     self.back_opacity = 0
  1000.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  1001.     self.contents.font.size = 20
  1002.     self.contents.font.color = color
  1003.     w = self.contents.width
  1004.     h = self.contents.height
  1005.     self.contents.draw_text(0, 0, w, h, designate_text)
  1006.   end
  1007.   #--------------------------------------------------------------------------
  1008.   # ● 释放
  1009.   #--------------------------------------------------------------------------
  1010.   def dispose
  1011.     self.contents.clear
  1012.     super
  1013.   end
  1014. end

  1015. class Interpreter
  1016.   #--------------------------------------------------------------------------
  1017.   # ● 显示文章
  1018.   #--------------------------------------------------------------------------
  1019.   def command_101
  1020.     # 另外的文章已经设置过 message_text 的情况下
  1021.     if $game_temp.message_text != nil
  1022.       # 结束
  1023.       return false
  1024.     end
  1025.     # 设置信息结束后待机和返回调用标志
  1026.     @message_waiting = true
  1027.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  1028.     # message_text 设置为 1 行
  1029.     $game_temp.message_text = @list[@index].parameters[0] + "\n"
  1030.     line_count = 1
  1031.     # 循环
  1032.     loop do
  1033.       # 下一个事件指令为文章两行以上的情况
  1034.       if @list[@index+1].code == 401
  1035.         # message_text 添加到第 2 行以下
  1036.         $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
  1037.         line_count += 1
  1038.       # 事件指令不在文章两行以下的情况
  1039.       else
  1040.         # 下一个事件指令为显示选择项的情况下
  1041.         if @list[@index+1].code == 102
  1042.           # 如果选择项能收纳在画面里
  1043.           if @list[@index+1].parameters[0].size <= Window_Message::Max_Lines - line_count
  1044.             # 推进索引
  1045.             @index += 1
  1046.             # 设置选择项
  1047.             $game_temp.choice_start = line_count
  1048.             setup_choices(@list[@index].parameters)
  1049.           end
  1050.         # 下一个事件指令为处理输入数值的情况下
  1051.         elsif @list[@index+1].code == 103
  1052.           # 如果数值输入窗口能收纳在画面里
  1053.           if line_count < Window_Message::Max_Lines
  1054.             # 推进索引
  1055.             @index += 1
  1056.             # 设置输入数值
  1057.             $game_temp.num_input_start = line_count
  1058.             $game_temp.num_input_variable_id = @list[@index].parameters[0]
  1059.             $game_temp.num_input_digits_max = @list[@index].parameters[1]
  1060.           end
  1061.         end
  1062.         # 继续
  1063.         return true
  1064.       end
  1065.       # 推进索引
  1066.       @index += 1
  1067.     end
  1068.   end
  1069. end

  1070. #==============================================================================
  1071. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  1072. #==============================================================================
复制代码

这是我用的对话加强脚本,我在里面加入了按住CTRL键跳过对话的功能,
但是现在跳过不会有任何文字显示,我希望做成像AVG那种文字一闪而过的效果,
请问应该怎么修改?
梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

发表于 2017-6-11 12:46:24 | 显示全部楼层

点评

下了新版,新版里CTRL必须每句话按一次跳过,我想要按住就能做出每句话都一闪而过那种跳过,应该怎么改?  发表于 2017-6-11 13:53
回复

使用道具 举报

梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

发表于 2017-6-11 14:20:56 | 显示全部楼层
脚本 538 行有跳过的判定
  1.     # CTRL 高速跳过对话
  2.     if $game_switches[Text_Skip_Fast] && Input.trigger?(Input::CTRL)
  3.       # 选择项或数字输入时无法高速跳过
  4.       if $game_temp.choice_max > 0 || @input_number_window != nil
  5.         @write_skip = true
  6.       else
  7.         @text_skip = true
  8.       end
  9.     end
复制代码


改一下判定条件即可。例如要制作第一次按下 Ctrl 然后就连续跳过的效果,那就把按下 Ctrl 的判定变成一个开关判定,然后在脚本的 update 里面检查是否按下 Ctrl,如果是的话直接打开相应开关即可。

看来楼主应该会自己改脚本,我就不做例子了吧……

点评

设置一个实例变量(@开头),每次调用 update 的时候将其减少 1,等到它减少到 0 的时候就说明延时结束。  发表于 2017-6-11 18:47
不好意思,我再问一下,脚本里的延时是用什么脚本,以前没有接触过  发表于 2017-6-11 18:02
这是因为如果一直按住的话文字不会描绘出来。你可以给每次判定加个延时让它描绘一点东西出来之后再消失。  发表于 2017-6-11 17:16
唔,我知道要改这里,但是像AVG那种按住跳过的效果做不好,单纯把trigger改成press的话一按就只剩下一个空框了,很不美观  发表于 2017-6-11 14:40

评分

参与人数 1星屑 +6 梦石 +1 收起 理由
guoxiaomi + 6 + 1 售后服务

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部