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

Project1

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

能不能做出类似樱花大战的那种对话系统?

 关闭 [复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-6-30
帖子
111
跳转到指定楼层
1
发表于 2007-7-31 07:14:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-6-30
帖子
111
2
 楼主| 发表于 2007-7-31 07:14:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽

Lv1.梦旅人

梦石
0
星屑
50
在线时间
28 小时
注册时间
2005-10-24
帖子
170
3
发表于 2007-7-31 07:26:02 | 只看该作者
只在选择项那里用的话,倒是可以用开关的方法弄另一个并行事件来做……
要每句都这样就好麻烦啊……{/pz}等高手来给个一劳永逸的脚本吧
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-6-30
帖子
111
4
 楼主| 发表于 2007-7-31 07:42:36 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-6-30
帖子
111
5
 楼主| 发表于 2007-7-31 20:43:19 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-6-30
帖子
111
6
 楼主| 发表于 2007-7-31 21:21:53 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-6-30
帖子
111
7
 楼主| 发表于 2007-7-31 23:35:55 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
49 小时
注册时间
2006-5-7
帖子
526
8
发表于 2007-8-1 00:16:58 | 只看该作者
简单做了一下,还很简陋
修改的是默认的Window_Message,如果使用其它对话加强脚本修改类似地方就可以
标星星的是修改的地方
  1. #==============================================================================
  2. # ■ Window_Message
  3. #------------------------------------------------------------------------------
  4. #  显示文章的信息窗口。
  5. #==============================================================================

  6. class Window_Message < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化状态
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(80, 304, 480, 160)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     self.visible = false
  14.     self.z = 9998
  15.     @fade_in = false
  16.     @fade_out = false
  17.     @contents_showing = false
  18.     @cursor_width = 0
  19.     self.active = false
  20.     self.index = -1
  21.     #★★★★★★★★★★★★★★★★★★★★★★★★★
  22.    @color1=Color.new(255,255,255,128)
  23.    #★★★★★★★★★★★★★★★★★★★★★★★★★
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 释放
  27.   #--------------------------------------------------------------------------
  28.   def dispose
  29.     terminate_message
  30.     $game_temp.message_window_showing = false
  31.     if @input_number_window != nil
  32.       @input_number_window.dispose
  33.     end
  34.     super
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 处理信息结束
  38.   #--------------------------------------------------------------------------
  39.   def terminate_message
  40.     self.active = false
  41.     self.pause = false
  42.     self.index = -1
  43.     self.contents.clear
  44.     # 清除显示中标志
  45.     @contents_showing = false
  46.     # 呼叫信息调用
  47.     if $game_temp.message_proc != nil
  48.       $game_temp.message_proc.call
  49.     end
  50.     # 清除文章、选择项、输入数值的相关变量
  51.     $game_temp.message_text = nil
  52.     $game_temp.message_proc = nil
  53.     $game_temp.choice_start = 99
  54.     $game_temp.choice_max = 0
  55.     $game_temp.choice_cancel_type = 0
  56.     $game_temp.choice_proc = nil
  57.     $game_temp.num_input_start = 99
  58.     $game_temp.num_input_variable_id = 0
  59.     $game_temp.num_input_digits_max = 0
  60.     # 开放金钱窗口
  61.     if @gold_window != nil
  62.       @gold_window.dispose
  63.       @gold_window = nil
  64.     end
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 刷新
  68.   #--------------------------------------------------------------------------
  69.   def refresh
  70.     self.contents.clear
  71.     self.contents.font.color = normal_color
  72.     x = y = 0
  73.     @cursor_width = 0
  74.     # 到选择项的下一行字
  75.     if $game_temp.choice_start == 0
  76.       x = 8
  77.     end
  78.     # 有等待显示的文字的情况下
  79.     if $game_temp.message_text != nil
  80.       text = $game_temp.message_text
  81.       # 限制文字处理
  82.       begin
  83.         last_text = text.clone
  84.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  85.       end until text == last_text
  86.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  87.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  88.       end
  89.       # 为了方便、将 "\\\\" 变换为 "\000"
  90.       text.gsub!(/\\\\/) { "\000" }
  91.       # "\\C" 变为 "\001" に、"\\G" 变为 "\002"
  92.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  93.       text.gsub!(/\\[Gg]/) { "\002" }
  94.       # c 获取 1 个字 (如果不能取得文字就循环)
  95.       while ((c = text.slice!(/./m)) != nil)
  96.         # \\ 的情况下
  97.         if c == "\000"
  98.           # 还原为本来的文字
  99.           c = "\\"
  100.         end
  101.         # \C[n] 的情况下
  102.         if c == "\001"
  103.           # 更改文字色
  104.           text.sub!(/\[([0-9]+)\]/, "")
  105.           color = $1.to_i
  106.           if color >= 0 and color <= 7
  107.             self.contents.font.color = text_color(color)
  108.           end
  109.           # 下面的文字
  110.           next
  111.         end
  112.         # \G 的情况下
  113.         if c == "\002"
  114.           # 生成金钱窗口
  115.           if @gold_window == nil
  116.             @gold_window = Window_Gold.new
  117.             @gold_window.x = 560 - @gold_window.width
  118.             if $game_temp.in_battle
  119.               @gold_window.y = 192
  120.             else
  121.               @gold_window.y = self.y >= 128 ? 32 : 384
  122.             end
  123.             @gold_window.opacity = self.opacity
  124.             @gold_window.back_opacity = self.back_opacity
  125.           end
  126.           # 下面的文字
  127.           next
  128.         end
  129.         # 另起一行文字的情况下
  130.         if c == "\n"
  131.           # 刷新选择项及光标的高
  132.           if y >= $game_temp.choice_start
  133.             @cursor_width = [@cursor_width, x].max
  134.           end
  135.           # y 加 1
  136.           y += 1
  137.           x = 0
  138.           # 移动到选择项的下一行
  139.           if y >= $game_temp.choice_start
  140.             x = 8
  141.           end
  142.           # 下面的文字
  143.           next
  144.         end
  145.         # 描绘文字
  146.         self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  147.         # x 为要描绘文字的加法运算
  148.         x += self.contents.text_size(c).width
  149.       end
  150.     end
  151.     # 选择项的情况
  152.     if $game_temp.choice_max > 0
  153.       @item_max = $game_temp.choice_max
  154.       self.active = true
  155.       self.index = 0
  156. #★★★★★★★★★★★★★★★★★★★★★★★★★
  157.       @count=0
  158.     if $game_variables[100]>0
  159.       @sel=true
  160.      end
  161. #★★★★★★★★★★★★★★★★★★★★★★★★★
  162.     end
  163.     # 输入数值的情况
  164.     if $game_temp.num_input_variable_id > 0
  165.       digits_max = $game_temp.num_input_digits_max
  166.       number = $game_variables[$game_temp.num_input_variable_id]
  167.       @input_number_window = Window_InputNumber.new(digits_max)
  168.       @input_number_window.number = number
  169.       @input_number_window.x = self.x + 8
  170.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  171.     end
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 设置窗口位置与不透明度
  175.   #--------------------------------------------------------------------------
  176.   def reset_window
  177.     if $game_temp.in_battle
  178.       self.y = 16
  179.     else
  180.       case $game_system.message_position
  181.       when 0  # 上
  182.         self.y = 16
  183.       when 1  # 中
  184.         self.y = 160
  185.       when 2  # 下
  186.         self.y = 304
  187.       end
  188.     end
  189.     if $game_system.message_frame == 0
  190.       self.opacity = 255
  191.     else
  192.       self.opacity = 0
  193.     end
  194.     self.back_opacity = 160
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 刷新画面
  198.   #--------------------------------------------------------------------------
  199.   def update
  200. #★★★★★★★★★★★★★★★★★★★★★★★★★
  201. if @sel
  202.       @count+=1
  203.      self.contents.fill_rect(0, 0, 480*@count/$game_variables[100],2 , @color1)
  204.   #    p @count
  205.       if ($game_temp.choice_max > 0 and @count>=$game_variables[100])#即等待的帧数100号变量
  206.           $game_system.se_play($data_system.decision_se)
  207.          $game_temp.choice_proc.call($game_variables[101])#即默认选择项101号变量
  208.          $game_variables[102]=@count
  209.          @count=0
  210.          @sel=false
  211.          terminate_message
  212.         end
  213.       end
  214. #★★★★★★★★★★★★★★★★★★★★★★★★★
  215.     super
  216.     # 渐变的情况下
  217.     if @fade_in
  218.       self.contents_opacity += 24
  219.       if @input_number_window != nil
  220.         @input_number_window.contents_opacity += 24
  221.       end
  222.       if self.contents_opacity == 255
  223.         @fade_in = false
  224.       end
  225.       return
  226.     end
  227.     # 输入数值的情况下
  228.     if @input_number_window != nil
  229.       @input_number_window.update
  230.       # 确定
  231.       if Input.trigger?(Input::C)
  232.         $game_system.se_play($data_system.decision_se)
  233.         $game_variables[$game_temp.num_input_variable_id] =
  234.           @input_number_window.number
  235.         $game_map.need_refresh = true
  236.         # 释放输入数值窗口
  237.         @input_number_window.dispose
  238.         @input_number_window = nil
  239.         terminate_message
  240.       end
  241.       return
  242.     end
  243.     # 显示信息中的情况下
  244.     if @contents_showing
  245.       # 如果不是在显示选择项中就显示暂停标志
  246.       if $game_temp.choice_max == 0
  247.         self.pause = true
  248.       end
  249.       # 取消
  250.       if Input.trigger?(Input::B)
  251.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  252.           $game_system.se_play($data_system.cancel_se)
  253.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  254.           terminate_message
  255.         end
  256.       end
  257.       # 确定
  258.       if Input.trigger?(Input::C)
  259.         if $game_temp.choice_max > 0
  260.           $game_system.se_play($data_system.decision_se)
  261.           $game_temp.choice_proc.call(self.index)
  262.           #★★★★★★★★★★★★★★★★★★★★★★★★★
  263.           $game_variables[102]=@count
  264.           if @sel
  265.          @count=0
  266.          @sel=false
  267.         end
  268.           #★★★★★★★★★★★★★★★★★★★★★★★★★
  269.         end
  270.         terminate_message
  271.       end
  272.       return
  273.     end
  274.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  275.     if @fade_out == false and $game_temp.message_text != nil
  276.       @contents_showing = true
  277.       $game_temp.message_window_showing = true
  278.       reset_window
  279.       refresh
  280.       Graphics.frame_reset
  281.       self.visible = true
  282.       self.contents_opacity = 0
  283.       if @input_number_window != nil
  284.         @input_number_window.contents_opacity = 0
  285.       end
  286.       @fade_in = true
  287.       return
  288.     end
  289.     # 没有可以显示的信息、但是窗口为可见的情况下
  290.     if self.visible
  291.       @fade_out = true
  292.       self.opacity -= 48
  293.       if self.opacity == 0
  294.         self.visible = false
  295.         @fade_out = false
  296.         $game_temp.message_window_showing = false
  297.       end
  298.       return
  299.     end
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 刷新光标矩形
  303.   #--------------------------------------------------------------------------
  304.   def update_cursor_rect
  305.     if @index >= 0
  306.       n = $game_temp.choice_start + @index
  307.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  308.     else
  309.       self.cursor_rect.empty
  310.     end
  311.   end
  312. end
复制代码


在出现选项前,用100号系统变量指定最大等待帧数,用101号变量指定默认选择项(从0开始)
超过最大等待帧数就会自动选择默认项(比如101号变量是0就自动选择第一项)
选择完后102号变量会得到选择花的帧数


现在很多新人提问的态度是大问题!请记住!大家玩RM都是处于爱好,没有任何人有任何义务要无偿为你做任何事情!

系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
446 小时
注册时间
2006-11-18
帖子
1686
9
发表于 2007-8-1 01:29:52 | 只看该作者
以下引用世界de守望者于2007-7-31 15:35:55的发言:

到底是人死光了还是高手都挂了

看到这句话~~~~飘过
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
49 小时
注册时间
2006-5-7
帖子
526
10
发表于 2007-8-1 05:00:51 | 只看该作者
补充上面发的脚本,利用* Graphics.frame_rate可以把帧数计时改成时间计时

另外,突然想到了用进度条表示时间进度的方法,为了不影响速度没有用渐变之类的美化
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-30 06:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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