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

Project1

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

人物对话时怎么显示人物图片?

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

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-19
帖子
20
跳转到指定楼层
1
发表于 2008-7-24 21:02:38 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽

Lv1.梦旅人

弃坑的微博控

梦石
0
星屑
50
在线时间
548 小时
注册时间
2008-6-23
帖子
2114
10
发表于 2008-7-25 02:19:01 | 只看该作者
请不要无视置顶帖..
http://rpg.blue/viewthread.php?tid=41070
纯引用菜刀的话...
《灵中那些事》停工很久了。..

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2008-6-5
帖子
312
9
发表于 2008-7-25 00:32:58 | 只看该作者
使用这个脚本就可以了!
  1. #==============================================================================
  2. # ◎ GPRA_Window_Message
  3. #------------------------------------------------------------------------------
  4. # ◎ 显示文章的信息窗口加强。
  5. #------------------------------------------------------------------------------
  6. # 制作者:绿梨子红苹果
  7. # 个人主页:vbgm.9126.com
  8. # E-Mail:[email protected]
  9. # QQ:42378361
  10. #==============================================================================

  11. class Window_Message < Window_Selectable
  12.   #--------------------------------------------------------------------------
  13.   # ● 初始化状态
  14.   #--------------------------------------------------------------------------
  15.   def initialize
  16.     super(80, 304, 480, 160)
  17.     self.contents = Bitmap.new(width - 32, height - 32)
  18.     self.visible = false
  19.     self.z = 9998
  20.     @fade_in = false
  21.     @fade_out = false
  22.     @contents_showing = false
  23.     @cursor_width = 0
  24.     @op = 255 # 不透明度
  25.     @head_bmp = nil # 装载头像用
  26.     @head_file = nil # 头像文件名
  27.     @text = nil # 记录所处理文字
  28.     @skip = false # 记录是否跳过此次对话
  29.     @auto_close = -1 # 默认不打开自动关闭
  30.     @type_mode=-1 # 打字模式
  31.     @delay=-1 # 等待n帧标志
  32.     @finish=false # 记录文字处理是否结束
  33.     @ts = TextStream.new # 创建一个新的TXT读取流
  34.     @is_read_txt =false # 默认不是在读取txt文件
  35.     self.active = false
  36.     self.index = -1
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 释放
  40.   #--------------------------------------------------------------------------
  41.   def dispose
  42.     terminate_message
  43.     $game_temp.message_window_showing = false
  44.     if @input_number_window != nil
  45.       @input_number_window.dispose
  46.     end
  47.     super
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● 处理信息结束
  51.   #--------------------------------------------------------------------------
  52.   def terminate_message
  53.     self.active = false
  54.     self.pause = false
  55.     self.index = -1
  56.     self.contents.clear
  57.     # 清除显示中标志
  58.     @contents_showing = false
  59.     # 呼叫信息调用
  60.     if $game_temp.message_proc != nil
  61.       $game_temp.message_proc.call
  62.     end
  63.     # 清除文章、选择项、输入数值的相关变量
  64.     $game_temp.message_text = nil
  65.     $game_temp.message_proc = nil
  66.     $game_temp.choice_start = 99
  67.     $game_temp.choice_max = 0
  68.     $game_temp.choice_cancel_type = 0
  69.     $game_temp.choice_proc = nil
  70.     $game_temp.num_input_start = 99
  71.     $game_temp.num_input_variable_id = 0
  72.     $game_temp.num_input_digits_max = 0
  73.     # 开放金钱窗口
  74.     if @gold_window != nil
  75.       @gold_window.dispose
  76.       @gold_window = nil
  77.     end
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 刷新
  81.   #--------------------------------------------------------------------------
  82.   def refresh
  83.     # 清空原先内容
  84.     self.contents.clear
  85.     # 恢复一般字色
  86.     self.contents.font.color = normal_color
  87.     # 恢复字体大小
  88.     self.contents.font.size = 20
  89.     # 绘制文字位置初始化
  90.     @x = @y = 0
  91.     # 字体高度记录
  92.     @height = 32
  93.     # 文字不透明度设定为255
  94.     @op = 255
  95.     # 头像默认显示在右边
  96.     @right = true
  97.     # 头像默认显示一般表情
  98.     @face = nil
  99.     # 默认显示角色姓名
  100.     @name = nil
  101.     # 默认不跳过此次对话
  102.     @skip = false
  103.     # 从变量读取自动关闭设置
  104.     @auto_close = $game_variables[2]
  105.     # 从变量读取打字模式设置
  106.     @type_mode=$game_variables[3]
  107.     # 默认不等待
  108.     @delay=-1
  109.     # 设定文字没有处理结束
  110.     @finish=false
  111.     # 光标宽度初始化为零
  112.     @cursor_width = 0
  113.     # 到选择项的下一行字
  114.     if $game_temp.choice_start == 0
  115.       @x = 16
  116.     end
  117.     # 有等待显示的文字的情况下
  118.     # (注:因为一旦文字非空就处理,所以可以设定 $game_temp.message_text 达到显示文章的效果)
  119.     if $game_temp.message_text != nil
  120.       # @text 功能改进
  121.       if @text==nil or @text==""
  122.         @text = $game_temp.message_text.dup
  123.       else
  124.         @text = @text + $game_temp.message_text
  125.       end
  126.       
  127.       # 最先必须要将 "\\\\" 变换为 "\000"
  128.       @text.gsub!(/\\\\/)                { "\000" }
  129.       
  130.       # 在TXT模式还没有打开的时候
  131.       if !@is_read_txt
  132.         # TXT读取模式打开
  133.         if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]\[(\w+)\]/)!=nil
  134.           # 打开文件,成功打开后再进入后面部分
  135.           if @ts.open($1,$2)
  136.             # 根据显示模式确定需要打开行数
  137.             case $game_variables[1]
  138.             when 0 # 正常模式
  139.               @text =  @ts.get_text(4)
  140.             when 1 # 图书模式
  141.               @text =  @ts.get_text(12)
  142.             when 2 # 全屏模式
  143.               @text =  @ts.get_text(15)
  144.             end
  145.             # 如果包含[END]
  146.             if @text.gsub!(/\[END\]/){""}!=nil
  147.               #退出TXT读取模式
  148.               @is_read_txt=false
  149.             else
  150.               #否则设置正在读取标志
  151.               @is_read_txt=true
  152.             end
  153.           end
  154.         else
  155.           if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]/)!=nil
  156.             # 打开文件,成功打开后再进入后面部分
  157.             if @ts.open($1,"")
  158.               # 根据显示模式确定需要打开行数
  159.               case $game_variables[1]
  160.               when 0 # 正常模式
  161.                 @text =  @ts.get_text(4)
  162.               when 1 # 图书模式
  163.                 @text =  @ts.get_text(12)
  164.               when 2 # 全屏模式
  165.                 @text =  @ts.get_text(15)
  166.               end
  167.               # 如果包含[END]
  168.               if @text.gsub!(/\[END\]/){""}!=nil
  169.                 #退出TXT读取模式
  170.                 @is_read_txt=false
  171.               else
  172.                 #否则设置正在读取标志
  173.                 @is_read_txt=true
  174.               end
  175.             end
  176.           end
  177.         end
  178.       end
  179.         
  180.       # 如果取得的字符含"\\~"时
  181.       if @text.slice!(/\\~/)!=nil
  182.         # 跳过此次对话
  183.         terminate_message
  184.         # 设置跳过此次对话标志
  185.         @skip = true
  186.         # 直接返回等待连接后面部分
  187.         return
  188.       end
  189.       
  190.       # 限制文字处理(注:这里是默认功能。)
  191.       begin
  192.         last_text = @text.clone
  193.         @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  194.       end until @text == last_text
  195.       @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  196.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  197.       end
  198.       #(注:后面将单个字符循环判断,所以这里将控制符全部换成单个字符)
  199.       # 为了方便将 "\\C" 变为 "\001"
  200.       @text.gsub!(/\\[Cc]\[([0-9#a-zA-Z]+)\]/)  { "\001[#{$1}]" }
  201.       # "\\G" 变为 "\002"
  202.       @text.gsub!(/\\[Gg]/)              { "\002" }
  203.       
  204.       # ========================增强功能========================
  205.       
  206.       # "\\/" 删除行尾换行符号
  207.       @text.gsub!(/\\\/\n/) {""}
  208.       # 去掉不在行尾的"\\/"符号,防止出错
  209.       @text.gsub!(/\\\//) {""}
  210.       
  211.       # "\\I" 物品图标+名称显示
  212.       @text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]"+$data_items[$1.to_i].name }
  213.       # "\\K" 技能图标+名称显示
  214.       @text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\004[#{$1}]"+$data_skills[$1.to_i].name }
  215.       # "\\W" 武器图标+名称显示
  216.       @text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\005[#{$1}]"+$data_weapons[$1.to_i].name }
  217.       # "\\A" 防具图标+名称显示
  218.       @text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\006[#{$1}]"+$data_armors[$1.to_i].name }
  219.       
  220.       # 注:大量显示图片将是游戏的速度大大减慢
  221.       # "\\I1" 物品图标显示
  222.       @text.gsub!(/\\[Ii]1\[([0-9]+)\]/) { "\003[#{$1}]" }
  223.       # "\\K1" 技能图标显示
  224.       @text.gsub!(/\\[Kk]1\[([0-9]+)\]/) { "\004[#{$1}]" }
  225.       # "\\W1" 武器图标显示
  226.       @text.gsub!(/\\[Ww]1\[([0-9]+)\]/) { "\005[#{$1}]" }
  227.       # "\\A1" 防具图标显示
  228.       @text.gsub!(/\\[Dd]1\[([0-9]+)\]/) { "\006[#{$1}]" }
  229.       
  230.       # "\\I2" 物品名称显示
  231.       @text.gsub!(/\\[Ii]2\[([0-9]+)\]/) { $data_items[$1.to_i].name }
  232.       # "\\K2" 技能名称显示
  233.       @text.gsub!(/\\[Kk]2\[([0-9]+)\]/) { $data_skills[$1.to_i].name }
  234.       # "\\W2" 武器名称显示
  235.       @text.gsub!(/\\[Ww]2\[([0-9]+)\]/) { $data_weapons[$1.to_i].name }
  236.       # "\\A2" 防具名称显示
  237.       @text.gsub!(/\\[Dd]2\[([0-9]+)\]/) { $data_armors[$1.to_i].name }
  238.       
  239.       # "\\S" 字体大小(只修改第一个"\\S")
  240.       # 这里首先删掉能找到的第一个"\\S"
  241.       if @text.slice!(/\\[Ss]\[([0-9]+)\]/)!=nil
  242.         # 当找了"\\S"时满足上述条件,就设置文字大小
  243.         self.set_font_size($1.to_i)
  244.       end
  245.       # "\\O" 文字透明度(使用注意同上,模拟声音变小……)
  246.       if @text.slice!(/\\[Oo]\[([0-9]+)\]/)!=nil
  247.         self.set_font_op($1.to_i)
  248.       end

  249.       # "\\=" 停顿固定帧(延时)
  250.       @text.gsub!(/\\=\[([0-9]+)\]/)    { "\024[#{$1}]" }
  251.       # "\\." 停顿3帧
  252.       @text.gsub!(/\\\./)               { "\024[3]" }
  253.       # "\\_" 停顿1秒(30帧)
  254.       @text.gsub!(/\\_/)                { "\024[30]" }
  255.       
  256.       # "\\L" 指定头像左边显示
  257.       if @text.slice!(/\\[Ll]/)!=nil
  258.         # 设定头像居右标志为假
  259.         @right=false
  260.         # 顺便要设置@x=104,文字在右边显示
  261.         @x=104
  262.       end
  263.       # "\\X" 指定不要显示姓名,带参数就是指定显示姓名(可内部使用"\\N[]")
  264.       # 首先是寻找有没有带参数的"\\X"
  265.       if @text.slice!(/\\[Xx]\[(\w+)\]/)!=nil
  266.         # 找到的话将参数赋予@name
  267.         @name=$1
  268.       # 没有找到的话
  269.       else
  270.         # 再去寻找有没有不带参数的"\\X"
  271.         if @text.slice!(/\\[Xx]/)!=nil
  272.           # 找到的话就将姓名变成"???"
  273.           @name="???"
  274.         end
  275.       end
  276.       # "\\F" 指定表情(Face 用来指定表情啦)
  277.       # 这里"\w"表示匹配字母+数字还有下划线,同样支持中文
  278.       if @text.slice!(/\\[Ff]\[(\w+)\]/)!=nil
  279.         # 找到的话就设定表情
  280.         @face=$1
  281.       end
  282.       # "\\H" 显示头像(不明白大家为什么都喜欢用 Face 表示头像……)
  283.       # 这里我将把显示头像放到字串的最前面,因为头像应该先显示出来
  284.       if @text.slice!(/\\[Hh]\[([0-9]+)\]/)!=nil
  285.         # 找到的话就提到字符串最前面
  286.         @text="\030[#{$1}]"+@text
  287.       end
  288.       
  289.       # ================ 分析部分结束,下面是显示部分 ================
  290.    
  291.       # 在此调用过程完成,因为在update部分也会有相同代码
  292.       self.refresh_

  293.     end
  294.     # 选择项的情况
  295.     if $game_temp.choice_max > 0
  296.       @item_max = $game_temp.choice_max
  297.       self.active = true
  298.       self.index = 0
  299.     end
  300.     # 输入数值的情况
  301.     if $game_temp.num_input_variable_id > 0
  302.       digits_max = $game_temp.num_input_digits_max
  303.       number = $game_variables[$game_temp.num_input_variable_id]
  304.       @input_number_window = Window_InputNumber.new(digits_max)
  305.       @input_number_window.number = number
  306.       @input_number_window.x = self.x + 8
  307.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  308.     end
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● 设置窗口位置与不透明度
  312.   #--------------------------------------------------------------------------
  313.   def reset_window
  314.     # 判断现在的显示模式
  315.     case $game_variables[1]
  316.     when 0 # 普通模式
  317.       self.width=480
  318.       self.height=160
  319.       self.contents = Bitmap.new(width - 32, height - 32)
  320.       self.x = 80
  321.       if $game_temp.in_battle
  322.         self.y = 16
  323.       else
  324.         case $game_system.message_position
  325.         when 0  # 上
  326.           self.y = 16
  327.         when 1  # 中
  328.           self.y = 160
  329.         when 2  # 下
  330.           self.y = 304
  331.         end
  332.       end
  333.     when 1 # 图书模式
  334.       self.width=532
  335.       self.height=416
  336.       self.contents = Bitmap.new(width - 32, height - 32)
  337.       self.x = 54
  338.       self.y = 32
  339.     when 2 # 全屏模式
  340.       self.width=672
  341.       self.height=512
  342.       self.contents = Bitmap.new(width - 32, height - 32)
  343.       self.x = -16
  344.       self.y = -16
  345.     end
  346.     if $game_system.message_frame == 0
  347.       self.opacity = 255
  348.     else
  349.       self.opacity = 0
  350.     end
  351.     self.back_opacity = 192
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 刷新画面
  355.   #--------------------------------------------------------------------------
  356.   def update
  357.     super
  358.     # 渐变的情况下
  359.     if @fade_in
  360.       # 脚本在这里设定透明度
  361.       self.contents_opacity += @op/8
  362.       if @input_number_window != nil
  363.         @input_number_window.contents_opacity += 32
  364.       end
  365.       if self.contents_opacity >= @op
  366.         @fade_in = false
  367.       end
  368.       return
  369.     end
  370.     # 输入数值的情况下
  371.     if @input_number_window != nil
  372.       @input_number_window.update
  373.       # 确定
  374.       if Input.trigger?(Input::C)
  375.         $game_system.se_play($data_system.decision_se)
  376.         $game_variables[$game_temp.num_input_variable_id] =
  377.           @input_number_window.number
  378.         $game_map.need_refresh = true
  379.         # 释放输入数值窗口
  380.         @input_number_window.dispose
  381.         @input_number_window = nil
  382.         terminate_message
  383.       end
  384.       return
  385.     end
  386.     # 显示信息中的情况下
  387.     if @contents_showing
  388.       # 刷新文本
  389.       self.refresh_
  390.       # 如果不是在显示选择项中就显示暂停标志
  391.       if $game_temp.choice_max == 0
  392.         self.pause = true
  393.       end
  394.       # 取消
  395.       if Input.trigger?(Input::B)
  396.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  397.           $game_system.se_play($data_system.cancel_se)
  398.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  399.           terminate_message
  400.         end
  401.       end
  402.       # @auto_close自减计数
  403.       @auto_close-=1
  404.       # 确定或者自动关闭
  405.       if Input.trigger?(Input::C) or @auto_close==0 # @auto_close为0自动关闭,所以一开始为负数或0就不会自动关闭
  406.         # 文字还没有处理完的时候
  407.         if !@finish
  408.           # 删除所有停顿效果
  409.           @text.gsub!(/\024\[([0-9]+)\]/) { "" }
  410.           # 删除当前延迟效果
  411.           @delay = 0
  412.           # 关闭打字效果
  413.           @type_mode=-1
  414.           # 一次处理完所有的字
  415.           self.refresh_
  416.         else
  417.           # 有选择项的情况
  418.           if $game_temp.choice_max > 0
  419.             $game_system.se_play($data_system.decision_se)
  420.             $game_temp.choice_proc.call(self.index)
  421.           end
  422.           # 清空文字
  423.           terminate_message
  424.           # 在读取TXT的模式下,需要继续打开文字
  425.           if @is_read_txt
  426.             # 根据显示模式确定需要打开行数
  427.             case $game_variables[1]
  428.             when 0 # 正常模式
  429.               $game_temp.message_text =  @ts.get_text(4)
  430.             when 1 # 图书模式
  431.               $game_temp.message_text =  @ts.get_text(12)
  432.             when 2 # 全屏模式
  433.               $game_temp.message_text =  @ts.get_text(15)
  434.             end
  435.             # 如果包含[END]则退出TXT读取模式
  436.             if $game_temp.message_text.gsub!(/\[END\]/){""}!=nil
  437.               @is_read_txt=false
  438.             end
  439.           end
  440.         end
  441.       end
  442.       return
  443.     end
  444.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  445.     if @fade_out == false and !($game_temp.message_text == nil or $game_temp.message_text == "")
  446.       @contents_showing = true
  447.       $game_temp.message_window_showing = true
  448.       reset_window
  449.       refresh
  450.       Graphics.frame_reset
  451.       # 当不跳过对话时才进行淡入操作
  452.       if !@skip
  453.         self.visible = true
  454.         self.contents_opacity = 0
  455.         if @input_number_window != nil
  456.           @input_number_window.contents_opacity = 0
  457.         end
  458.         @fade_in = true
  459.       end
  460.       return
  461.     end
  462.     # 没有可以显示的信息、但是窗口为可见的情况下
  463.     if self.visible
  464.       @fade_out = true
  465.       self.opacity -= 48
  466.       if self.opacity == 0
  467.         self.visible = false
  468.         @fade_out = false
  469.         $game_temp.message_window_showing = false
  470.       end
  471.       return
  472.     end
  473.   end
  474.   #--------------------------------------------------------------------------
  475.   # ● 刷新光标矩形
  476.   #--------------------------------------------------------------------------
  477.   def update_cursor_rect
  478.     if @index >= 0
  479.       n = $game_temp.choice_start + @index
  480.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  481.     else
  482.       self.cursor_rect.empty
  483.     end
  484.   end
  485.   #--------------------------------------------------------------------------
  486.   # ● 设定字体大小
  487.   #--------------------------------------------------------------------------
  488.   def set_font_size(size=20)
  489.     # 最大字96号,再大就超过文字栏了,而且Ruby本来有限制……
  490.     if size>96
  491.       size=96
  492.     end
  493.     # 设定字的大小
  494.     self.contents.font.size = size
  495.     # 如果字太大了就要加高每行文字高度。
  496.     if size > 28
  497.       @height=size+4
  498.     else
  499.       @height=32
  500.     end
  501.   end
  502.   #--------------------------------------------------------------------------
  503.   # ● 设定文字透明
  504.   #--------------------------------------------------------------------------
  505.   def set_font_op(op=255)
  506.     # 限制透明度为0-255
  507.     if op>255
  508.       op=255
  509.     elsif op<0
  510.       op=0
  511.     end
  512.     # 这里设定文字透明是没有用的,设定透明在update过程开始
  513.     @op = op
  514.   end
  515.   #--------------------------------------------------------------------------
  516.   # ● 显示文字/头像过程
  517.   #--------------------------------------------------------------------------
  518.   def refresh_
  519.     # 处理已经结束的情况下直接return
  520.     if @finish
  521.       return
  522.     end
  523.     # 延时处理
  524.     @delay-=1
  525.     if @delay<=0
  526.       # 每次处理i个标志,这里i就设置为@type_mode了
  527.       i=@type_mode
  528.       # c 获取 1 个字 (如果不能取得文字就循环)
  529.       while ((c = @text.slice!(/./m)) != nil)
  530.         # ======================== 默认功能 ========================
  531.         # \\ 的情况下
  532.         if c == "\000"
  533.           # 还原为本来的文字
  534.           c = "\\"
  535.         end
  536.         # \C[n] 的情况下
  537.         if c == "\001"
  538.           # 取得字色编码
  539.           @text.sub!(/\[([0-9#a-zA-Z]+)\]/, "")
  540.           # 如果是设定RGB颜色
  541.           if $1[0,1]=="#"
  542.             # 先拷贝一下文字
  543.             c=$1.dup
  544.             # 分3段分别取出R,G,B颜色
  545.             c.sub!(/#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/, "")
  546.             # 设定文字颜色
  547.             self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16),@op)
  548.             next
  549.           else
  550.             # 记录到变量 color
  551.             color = $1.to_i
  552.             # 字色0~7是有效的
  553.             if color >= 0 and color <= 7
  554.               # 设置文字颜色
  555.               self.contents.font.color = text_color(color)
  556.             end
  557.           end
  558.           # 进行下次循环
  559.           next
  560.         end
  561.         # 显示金钱窗口,这个……不用说了吧……
  562.         if c == "\002"
  563.           if @gold_window == nil
  564.             @gold_window = Window_Gold.new
  565.             @gold_window.x = 560 - @gold_window.width
  566.             if $game_temp.in_battle
  567.               @gold_window.y = 192
  568.             else
  569.               @gold_window.y = self.y >= 128 ? 32 : 384
  570.             end
  571.             @gold_window.opacity = self.opacity
  572.             @gold_window.back_opacity = self.back_opacity
  573.           end
  574.           next
  575.         end
  576.         # 另起一行文字的情况下
  577.         if c == "\n"
  578.           # 刷新选择项及光标的高
  579.           if @y >= $game_temp.choice_start
  580.             @cursor_width = [@cursor_width, @x>440 ? 448 : @x+8].max
  581.           end
  582.           # y 加 1
  583.           @y += 1
  584.           # 因为字体大小会变化,这里添加判断语句,超出就不显示了
  585.           if @y>=self.contents.height/@height
  586.             # 删除@text剩余的所有内容
  587.             @text=nil
  588.             # 然后返回
  589.             break
  590.           end
  591.           # 因为头像的缘故,这里需要改写
  592.           if @right
  593.             # 头像右边显示的时候是0
  594.             @x=0
  595.           else
  596.             # 头像靠左显示时@x要留出绘制头像空间
  597.             @x=104
  598.           end
  599.           # 移动到选择项的下一行
  600.           if @y >= $game_temp.choice_start
  601.             @x=16
  602.           end
  603.           # 下面的文字
  604.           next
  605.         end
  606.         
  607.         # ======================== 加强功能 ========================
  608.         
  609.         # 显示物品图标
  610.         if c == "\003"
  611.           # 取得物品ID
  612.           @text.sub!(/\[([0-9]+)\]/, "")
  613.           # 这里的 RPG::Cache 是高速缓存,不明白的看看帮助文档吧……
  614.           icon = RPG::Cache.icon($data_items[$1.to_i].icon_name)
  615.           # 绘制这个图标
  616.           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  617.           # 将x值增加24
  618.           @x+=24
  619.           # 执行下一次循环
  620.           next
  621.         end
  622.         # 显示技能图标(因为类似物品图标显示,所以省略注释)
  623.         if c == "\004"
  624.           @text.sub!(/\[([0-9]+)\]/, "")
  625.           icon = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
  626.           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  627.           @x+=24
  628.           next
  629.         end
  630.         # 显示武器图标(因为类似物品图标显示,所以省略注释)
  631.         if c == "\005"
  632.           @text.sub!(/\[([0-9]+)\]/, "")
  633.           icon = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
  634.           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  635.           @x+=24
  636.           next
  637.         end
  638.         # 显示防具图标(因为类似物品图标显示,所以省略注释)
  639.         if c == "\006"
  640.           @text.sub!(/\[([0-9]+)\]/, "")
  641.           icon = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
  642.           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  643.           @x+=24
  644.           next
  645.         end
  646.         
  647.         # 等待n帧
  648.         if c == "\024"
  649.           # 取得参数(需要等待多少帧)
  650.           @text.sub!(/\[([0-9]+)\]/, "")
  651.           # 设定@delay标志
  652.           @delay = $1.to_i
  653.           # 退出此次循环
  654.           break
  655.         end
  656.         
  657.         # 显示头像
  658.         if c == "\030"
  659.           #暂时记录文字大小,用于显示完头像恢复
  660.           size=self.contents.font.size
  661.           # 设定为正常的20号字
  662.           self.contents.font.size=20
  663.           # 设定系统字色,为写名字做准备的
  664.           self.contents.font.color = system_color
  665.           # 取得"[]"内的字符并从原字串中删除这一部分
  666.           @text.sub!(/\[([0-9]+)\]/, "")
  667.           # 记录到head变量
  668.           head=$1
  669.           # 判断头像和原来的是不是一样的
  670.           if @face == nil
  671.             # 不一样
  672.             if @head_file != head
  673.               # 改变成现在的头像文件名
  674.               @head_file = head
  675.               # 不一样的话再重新载入头像
  676.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  677.             end
  678.           else
  679.             # 当表情不是空的时候需要考虑表情的
  680.             if @head_file != head + "_" + @face
  681.               # 改变成现在的头像文件名
  682.               @head_file = head + "_" + @face
  683.               # 不一样的话再重新载入头像
  684.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  685.             end
  686.           end
  687.           # 显示头像,分左右两种情况
  688.           if @right
  689.             # 绘制头像图片
  690.             self.contents.blt(348,0,@head_bmp,Rect.new(0,0,100,100))
  691.             # 显示角色姓名
  692.             if @name==nil
  693.               # 取得角色姓名到变量 c
  694.               c = $game_actors[head.to_i].name
  695.               # 描绘角色的姓名
  696.               self.contents.draw_text(348,104,100,24,c,1)
  697.             else
  698.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  699.               c = @name
  700.               # 描绘角色的姓名
  701.               self.contents.draw_text(348,104,100,24,c,1)
  702.             end
  703.           else
  704.             # 绘制头像图片
  705.             self.contents.blt(0,0,@head_bmp,Rect.new(0,0,100,100))
  706.             # 显示角色姓名
  707.             if @name==nil
  708.               # 取得角色姓名到变量 c
  709.               c = $game_actors[head.to_i].name
  710.               # 描绘角色的姓名
  711.               self.contents.draw_text(0,104,100,24,c,1)
  712.             else
  713.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  714.               c = @name
  715.               # 描绘角色的姓名
  716.               self.contents.draw_text(0,104,100,24,c,1)
  717.             end
  718.           end
  719.           # 恢复默认字色
  720.           self.contents.font.color = normal_color
  721.           # 恢复字体大小
  722.           self.contents.font.size=size
  723.           # 进行下一次循环
  724.           next
  725.         end
  726.         
  727.         # ======================== 以上加强部分 ========================
  728.         
  729.         # 描绘文字
  730.         self.contents.draw_text(4+@x,@height*@y, @height, @height, c)
  731.         # x 为描绘文字宽度进行自增运算,计算下一个文字起始位置
  732.         @x += self.contents.text_size(c).width
  733.         
  734.         # 操作了@type_mode个字符后就退出循环了,@type_mode为负则操作一次完成
  735.         i-=1
  736.         if i==0
  737.           break
  738.         end
  739.       
  740.       end
  741.     end
  742.     # 如果@text处理结束了,就设置结束标志
  743.     if @text==nil or @text==""
  744.       @finish=true
  745.     end
  746.   end
  747. end





  748. 脚本内容2——GPRA_TextStream

  749. #==============================================================================
  750. # ◎ GPRA_TextStream
  751. #------------------------------------------------------------------------------
  752. # ◎ TXT文件读取流类
  753. #------------------------------------------------------------------------------
  754. # 制作者:绿梨子红苹果
  755. # 个人主页:vbgm.9126.com
  756. # E-Mail:[email protected]
  757. # QQ:42378361
  758. #------------------------------------------------------------------------------
  759. # 附加说明:TXT文件需要是UTF-8编码(Windows自带记事本支持),其它的好似会乱码
  760. #==============================================================================

  761. class TextStream
  762.   #--------------------------------------------------------------------------
  763.   # ● 初始化状态
  764.   #--------------------------------------------------------------------------
  765.   def initialize
  766.     @file_name = "" # 记录已经打开文件名称
  767.     @line_label = "" # 记录行号标签
  768.     @is_open = false # 用于记录文件是否打开
  769.     @txt_file = nil # 用于打开文件
  770.     @t = nil # 记录每行文字
  771.     @p = 0 #记录行号
  772.   end
  773.   #--------------------------------------------------------------------------
  774.   # ● 打开文件
  775.   #--------------------------------------------------------------------------
  776.   def open(file_name,line_label="",reload=false)
  777.    
  778.     # 文件名改变的时候,或者文件没有打开的时候打开文件
  779.     if (file_name != @file_name) or !@is_open or reload
  780.       
  781.       #文件已经打开的时候首先关闭文件
  782.       if @is_open
  783.         @txt_file.close
  784.       end
  785.         
  786.       # 测试文本文件是否存在
  787.       if !FileTest.exist?("Text/" + file_name + ".txt")
  788.         # 初始化变量
  789.         @file_name = ""
  790.         @line_label = ""
  791.         @is_open = false
  792.         @txt_file = nil
  793.         @t = nil
  794.         @p = 0
  795.         # 返回错误值
  796.         return(false)
  797.       end
  798.       
  799.       #如果通过了测试,说明文件存在,那么就打开它
  800.       @txt_file = File.open ("Text/" + file_name + ".txt")
  801.       #读取所有行的文字
  802.       @t=@txt_file.readlines
  803.       #把行“指针”设定为0
  804.       @p=0
  805.       
  806.       #如果行号非空
  807.       if line_label != ""
  808.           #搜索到指定的行号,直到文件结尾才结束
  809.           for @p in [email protected]
  810.               #打开下一行文字
  811.               t=@t[@p]
  812.               #当此行是行号时(左右为匹配的方括号)
  813.               if t[0,1] == "[" and t[-2,1] == "]"
  814.                   #判断是不是要找的行号
  815.                   if t == "[" + line_label + "]\n"
  816.                       #是的话说明找到了,停在下行,并退出循环
  817.                       @p+=1
  818.                       break
  819.                   end
  820.               end
  821.           end
  822.       end
  823.       
  824.       #设定变量
  825.       @file_name = file_name
  826.       @line_label = line_label
  827.       @is_open = true
  828.         
  829.     end

  830.     #行号改变的时候重新搜索行号
  831.     if line_label != @line_label
  832.    
  833.         #首先把指针移动到文件开头
  834.         @p=0
  835.         
  836.         #如果行号非空
  837.         if line_label != "" and line_label != nil
  838.             #搜索到指定的行号,直到文件结尾才结束
  839.             for @p in [email protected]
  840.                 #打开下一行文字
  841.                 t=@t[@p]
  842.                 #当此行是行号时(左右为匹配的方括号)
  843.                 if t[0,1] == "[" and t[-2,1] == "]"
  844.                     #判断是不是要找的行号
  845.                     if t == "[" + line_label + "]\n"
  846.                         #是的话说明找到了,停在下行,并退出循环
  847.                         @p+=1
  848.                         break
  849.                     end
  850.                 end
  851.             end
  852.         end
  853.            
  854.         #设定变量
  855.         @line_label = line_label
  856.         @is_open = true
  857.         
  858.     end
  859.    
  860.     return(true)
  861.    
  862.   end
  863.   #--------------------------------------------------------------------------
  864.   # ● 关闭文件
  865.   #--------------------------------------------------------------------------
  866.   def close
  867.     @txt_file.close
  868.     @is_open=false
  869.   end
  870.   #--------------------------------------------------------------------------
  871.   # ● 读入一行文字,文件已结束返回"[END]"
  872.   #--------------------------------------------------------------------------
  873.   def get_text(len=4)
  874.    
  875.     t="" # 临时变量
  876.     s="" # 返回值
  877.     l=0 # 已打开的行数
  878.    
  879.     #如果文件已经关闭,直接返回结束标志
  880.     if !@is_open
  881.         return("\\~\\/[END]")
  882.     end
  883.    
  884.     #如果文件已经读到了末尾
  885.     if @p>[email protected]
  886.         #关闭文件
  887.         @txt_file.close
  888.         #设置标志变量
  889.         @is_open = false
  890.         #返回结束标志
  891.         return("\\~\\/[END]")
  892.     end
  893.       
  894.     #打开一行文字
  895.     t=@t[@p]
  896.     #读入字符串,终止条件是文件结束、遇到行号或者已经打开需要行数的文字
  897.     while l        #否则的话就加入到字符串s末尾
  898.         s = s + t
  899.         #l自增
  900.         l += 1
  901.         #@p自增
  902.         @p += 1
  903.         #打开一行文字
  904.         t=@t[@p]
  905.         #当下行是行号(左右为匹配的方括号)或者已经结束时退出,否则就会进入下次循环
  906.         if t==nil or (t[0,1] == "[" and t[-2,1] == "]")
  907.           #加入"[END]"到字符串s末尾
  908.           s = s + "[END]"
  909.           #关闭文件
  910.           @txt_file.close
  911.           #设置标志变量
  912.           @is_open = false
  913.           #终止循环
  914.           break
  915.         end
  916.     end
  917.    
  918.     if s.size > 0
  919.       #字符串非空的时候返回字符串
  920.       return s
  921.     else
  922.       #否则可能是文件结束了所以返回结束标志
  923.       return "\\~\\/[END]"
  924.     end
  925.       
  926.   end
  927. end


复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-6-10
帖子
678
8
发表于 2008-7-24 22:01:28 | 只看该作者
去主站搜索"对话框"多得是~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
70
在线时间
215 小时
注册时间
2007-9-5
帖子
370
7
发表于 2008-7-24 21:46:53 | 只看该作者
前面有一段对话...
http://rpg.blue/web/htm/news163.htm
回复 支持 反对

使用道具 举报

Lv1.梦旅人

蚂蚁卡卡

梦石
0
星屑
116
在线时间
66 小时
注册时间
2007-12-16
帖子
3081
6
发表于 2008-7-24 21:21:20 | 只看该作者
http://rpg.blue/viewthread.php?tid=95668



先在PS里把头像弄好了 位置最好也调整好 (可以用辅助线)

在数据库 公共事件 里如图设置



显示图片的方法 脚本是整合版的66MEESAGE



对话的时候在事件里 仿照上面图写



游戏《神话》的这么制作的 你可以下来看看



图片显示的方法 可以随便移动位置(坐标) 所以头像在哪里显示都行
《隋唐乱》完整解密版点击进入
米兰,让我怎么说离开……

曾经我也是一个有志青年,直到我膝盖中了一箭……

《隋唐乱》博客地址
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
87 小时
注册时间
2007-7-26
帖子
313
5
发表于 2008-7-24 21:17:06 | 只看该作者
看这个:
http://rpg.blue/web/htm/news162.htm
回复 支持 反对

使用道具 举报

Lv4.逐梦者

ST戰士

梦石
11
星屑
82
在线时间
1155 小时
注册时间
2007-5-5
帖子
3489

第5届短篇游戏比赛季军

4
发表于 2008-7-24 21:10:57 | 只看该作者
新人建议使用苹果梨对话脚本

>>> http://rpg.blue/web/htm/news667.htm
我是昵称 JIN 的迅雷進,是一位以日本特攝講解爲主的馬來西亞 YouTuber。

歡迎瀏覽我的頻道:JinRaiXin -迅雷進-
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-6-3
帖子
54
3
发表于 2008-7-24 21:06:54 | 只看该作者
http://rpg.blue/viewthread.php?tid=95233
系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-7-5
帖子
116
2
发表于 2008-7-24 21:04:52 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-8-9 15:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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