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

Project1

 找回密码
 注册会员
搜索
查看: 1937|回复: 4

[已经解决] Window_Message想找一个能显示名称框和立绘的脚本

[复制链接]

Lv2.观梦者

梦石
0
星屑
946
在线时间
61 小时
注册时间
2019-12-10
帖子
97
发表于 2019-12-11 12:30:32 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 RyanBern 于 2019-12-13 23:55 编辑

在这留个言,我按照RyanBern的视频脚本做出来的头像和姓名窗口,★☆文章就不显示了☆★,其他地方完美,问不到本人,能不能帮我回复个Window_Message的能显示立绘的脚本,我直接用,本人并不知道脚本什么意思

我按照最原版的Window_Message更改到了如下样子,能开始游戏文章不显示,选项也不显示选了也不触发,谁第一个给我解答出为什么不显示文章我给十块钱红包私聊

RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_Message
  3. #------------------------------------------------------------------------------
  4. #  显示文章的信息窗口。
  5. #==============================================================================
  6.  
  7. class Window_Message < Window_Selectable
  8.   Name_Character_Id = 9
  9.   Heads_Dir = "Graphics/Heads/"
  10.   #--------------------------------------------------------------------------
  11.   # ● 初始化状态
  12.   #--------------------------------------------------------------------------
  13.   def initialize
  14.     super(80, 304, 480, 160)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.visible = false
  17.     self.z = 9998
  18.     @fade_in = false
  19.     @fade_out = false
  20.     @contents_showing = false
  21.     @cursor_width = 0
  22.     self.active = false
  23.     self.index = -1
  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.     # 释放姓名窗口
  66.     if @name_window != nil
  67.       @name_window.dispose
  68.       @name_window = nil
  69.     end
  70.     # 释放左右头像
  71.     if @right_head != nil
  72.       @right_head.bitmap.dispose
  73.       @right_head.dispose
  74.       @right_head = nil
  75.     end
  76.     if @left_head != nil
  77.       @left_head.bitmap.dispose
  78.       @left_head.dispose
  79.       @left_head = nil
  80.     end
  81.   end
  82.   def process_all_characters
  83.         @x = @y = 0
  84.     @cursor_width = 0
  85.     # 到选择项的下一行字
  86.     if $game_temp.choice_start == 0
  87.       @x = 8
  88.     end
  89.     # 有等待显示的文字的情况下
  90.     if $game_temp.message_text != nil
  91.       text = $game_temp.message_text
  92.       # 限制文字处理
  93.       begin
  94.         last_text = text.clone
  95.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  96.       end until text == last_text
  97.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  98.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  99.       end
  100.       # 为了方便、将 "\\\\" 变换为 "\000"
  101.       text.gsub!(/\\\\/) { "\000" }
  102.       # "\\C" 变为 "\001" に、"\\G" 变为 "\002"
  103.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  104.       text.gsub!(/\\[Gg]/) { "\002" }
  105.       # 生成姓名窗口
  106.       name = $game_actors[Name_Character_Id].name
  107.       # 取出右侧头像名
  108.       name = name.sub(/\\[Rr]\[(.+?)\]/, "")
  109.       if $1 != nil && @right_head == nil
  110.       # 生成右侧头像
  111.         @right_head = Sprite.new
  112.         @right_head.bitmap = Bitmap.new(Heads_Dir + $1)
  113.         @right_head.x = self.x + self.width - @right_head.bitmap.width
  114.         @right_head.y = self.y - @right_head.bitmap.height + 16
  115.         @right_head.z = self.z - 2
  116.         @right_head.opacity = self.opacity
  117.       end
  118.       # 取出左侧头像名
  119.       name = name.sub(/\\[Ll]\[(.+?)\]/, "")
  120.       if $1 != nil && @left_head == nil
  121.         # 生成左侧头像
  122.         @left_head = Sprite.new
  123.         @left_head.bitmap = Bitmap.new(Heads_Dir + $1)
  124.         @left_head.x = self.x
  125.         @left_head.y = self.y - @left_head.bitmap.height + 16
  126.         @left_head.z = self.z - 2
  127.         @left_head.opacity = self.opacity
  128.       end
  129.       # 显示姓名窗口
  130.       if name != "" && @name_window == nil
  131.         @name_window = Window_Base.new(self.x, self.y - 50, 1, 50)
  132.         @name_window.z = self.z
  133.         @name_window.opacity = self.opacity
  134.         @name_window.contents_opacity = self.contents_opacity
  135.         @name_window.back_opacity = self.back_opacity
  136.         bitmap = Bitmap.new(1, 1)
  137.         bitmap.font.size = 18
  138.         w = bitmap.text_size(name).width
  139.         bitmap.dispose
  140.         @name_window.width = w + 32
  141.         @name_window.contents = Bitmap.new(w, 18)
  142.         @name_window.contents.font.size = 18
  143.         @name_window.contents.draw_text(0, 0, w, 18, name)
  144.       end
  145.     end
  146.   end
  147.   #--------------------------------------------------------------------------
  148.   # ● 刷新
  149.   #--------------------------------------------------------------------------
  150.   def refresh
  151.     self.contents.clear
  152.     self.contents.font.color = normal_color   
  153.     x = y = 0
  154.     @cursor_width = 0
  155.     # 到选择项的下一行字
  156.     if $game_temp.choice_start == 0
  157.       x = 8
  158.     end
  159.     # 有等待显示的文字的情况下
  160.     if $game_temp.message_text != nil
  161.       text = $game_temp.message_text
  162.       # 限制文字处理
  163.       begin
  164.         last_text = text.clone
  165.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  166.       end until text == last_text
  167.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  168.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  169.       end
  170.       # 为了方便、将 "\\\\" 变换为 "\000"
  171.       text.gsub!(/\\\\/) { "\000" }
  172.       # "\\C" 变为 "\001" に、"\\G" 变为 "\002"
  173.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  174.       text.gsub!(/\\[Gg]/) { "\002" }
  175.     # c 获取 1 个字 (如果不能取得文字就循环)
  176.       while ((c = text.slice!(/./m)) != nil)
  177.         # \\ 的情况下
  178.         if c == "\000"
  179.           # 还原为本来的文字
  180.           c = "\\"
  181.         end
  182.         # \C[n] 的情况下
  183.         if c == "\001"
  184.           # 更改文字色
  185.           text.sub!(/\[([0-9]+)\]/, "")
  186.           color = $1.to_i
  187.           if color >= 0 and color <= 7
  188.             self.contents.font.color = text_color(color)
  189.           end
  190.           # 下面的文字
  191.           next
  192.         end
  193.         # \G 的情况下
  194.         if c == "\002"
  195.           # 生成金钱窗口
  196.           if @gold_window == nil
  197.             @gold_window = Window_Gold.new
  198.             @gold_window.x = 560 - @gold_window.width
  199.             if $game_temp.in_battle
  200.               @gold_window.y = 192
  201.             else
  202.               @gold_window.y = self.y >= 128 ? 32 : 384
  203.             end
  204.             @gold_window.opacity = self.opacity
  205.             @gold_window.back_opacity = self.back_opacity
  206.           end
  207.           # 下面的文字
  208.           next
  209.         end
  210.         # 另起一行文字的情况下
  211.         if c == "\n"
  212.           # 刷新选择项及光标的高
  213.           if y >= $game_temp.choice_start
  214.             @cursor_width = [@cursor_width, x].max
  215.           end
  216.           # y 加 1
  217.           y += 1
  218.           x = 0
  219.           # 移动到选择项的下一行
  220.           if y >= $game_temp.choice_start
  221.             x = 8
  222.           end
  223.           # 下面的文字
  224.           next
  225.         end
  226.         # 描绘文字
  227.         self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  228.         # x 为要描绘文字的加法运算
  229.         x += self.contents.text_size(c).width
  230.       end
  231.     end
  232.     # 选择项的情况
  233.     if $game_temp.choice_max > 0
  234.       @item_max = $game_temp.choice_max
  235.       self.active = true
  236.       self.index = 0
  237.     end
  238.     # 输入数值的情况
  239.     if $game_temp.num_input_variable_id > 0
  240.       digits_max = $game_temp.num_input_digits_max
  241.       number = $game_variables[$game_temp.num_input_variable_id]
  242.       @input_number_window = Window_InputNumber.new(digits_max)
  243.       @input_number_window.number = number
  244.       @input_number_window.x = self.x + 8
  245.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  246.     end
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● 设置窗口位置与不透明度
  250.   #--------------------------------------------------------------------------
  251.   def reset_window
  252.     if $game_temp.in_battle
  253.       self.y = 16
  254.     else
  255.       case $game_system.message_position
  256.       when 0  # 上
  257.         self.y = 16
  258.       when 1  # 中
  259.         self.y = 160
  260.       when 2  # 下
  261.         self.y = 304
  262.       end
  263.     end
  264.     if $game_system.message_frame == 0
  265.       self.opacity = 255
  266.     else
  267.       self.opacity = 0
  268.     end
  269.     self.back_opacity = 160
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● 刷新画面
  273.   #--------------------------------------------------------------------------
  274.   def update
  275.     super
  276.     # 渐变的情况下
  277.     if @fade_in
  278.       self.contents_opacity += 24
  279.       if @input_number_window != nil
  280.         @input_number_window.contents_opacity += 24
  281.       end
  282.       if @name_window != nil
  283.         @name_window.opacity += 24
  284.         @name_window.contents_opacity += 24
  285.       end
  286.       if @right_window != nil
  287.         @right_window.opacity += 24
  288.       end
  289.       if @left_window != nil
  290.         @left_window.opacity += 24
  291.       end
  292.       if self.contents_opacity == 255
  293.         @fade_in = false
  294.       end
  295.       return
  296.     end
  297.     # 输入数值的情况下
  298.     if @input_number_window != nil
  299.       @input_number_window.update
  300.       # 确定
  301.       if Input.trigger?(Input::C)
  302.         $game_system.se_play($data_system.decision_se)
  303.         $game_variables[$game_temp.num_input_variable_id] =
  304.           @input_number_window.number
  305.         $game_map.need_refresh = true
  306.         # 释放输入数值窗口
  307.         @input_number_window.dispose
  308.         @input_number_window = nil
  309.         terminate_message
  310.       end
  311.       return
  312.     end
  313.     # 显示信息中的情况下
  314.     if @contents_showing
  315.       # 如果不是在显示选择项中就显示暂停标志
  316.       if $game_temp.choice_max == 0
  317.         self.pause = true
  318.       end
  319.       # 取消
  320.       if Input.trigger?(Input::B)
  321.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  322.           $game_system.se_play($data_system.cancel_se)
  323.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  324.           terminate_message
  325.         end
  326.       end
  327.       # 确定
  328.       if Input.trigger?(Input::C)
  329.         if $game_temp.choice_max > 0
  330.           $game_system.se_play($data_system.decision_se)
  331.           $game_temp.choice_proc.call(self.index)
  332.         end
  333.         terminate_message
  334.       end
  335.       return
  336.     end
  337.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  338.     if @fade_out == false and $game_temp.message_text != nil
  339.       @contents_showing = true
  340.       $game_temp.message_window_showing = true
  341.       reset_window
  342.       #refresh
  343.       process_all_characters
  344.       Graphics.frame_reset
  345.       self.visible = true
  346.       self.contents_opacity = 0
  347.       if @input_number_window != nil
  348.         @input_number_window.contents_opacity = 0
  349.       end
  350.       @fade_in = true
  351.       return
  352.     end
  353.     # 没有可以显示的信息、但是窗口为可见的情况下
  354.     if self.visible
  355.       @fade_out = true
  356.       self.opacity -= 48
  357.             if @name_window != nil
  358.         @name_window.opacity -= 48
  359.         @name_window.contents_opacity -= 48
  360.       end
  361.       if @right_window != nil
  362.         @right_window.opacity -= 48
  363.       end
  364.       if @left_window != nil
  365.         @left_window.opacity -= 48
  366.       end
  367.       if self.opacity == 0
  368.         self.visible = false
  369.         @fade_out = false
  370.         $game_temp.message_window_showing = false
  371.       end
  372.       return
  373.     end
  374.   end
  375.   #--------------------------------------------------------------------------
  376.   # ● 刷新光标矩形
  377.   #--------------------------------------------------------------------------
  378.   def update_cursor_rect
  379.     if @index >= 0
  380.       n = $game_temp.choice_start + @index
  381.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  382.     else
  383.       self.cursor_rect.empty
  384.     end
  385.   end
  386. end

点评

这是个错误案例  发表于 2019-12-11 12:47
想玩我做的游戏加我qq947128749

Lv4.逐梦者 (版主)

梦石
0
星屑
9467
在线时间
5073 小时
注册时间
2013-6-21
帖子
3580

开拓者贵宾剧作品鉴家

发表于 2019-12-13 23:55:00 | 显示全部楼层
问不到本人可还行。

不如用对话加强重制版。
https://rpg.blue/thread-382811-1-1.html

点评

哇偶,大佬!问到本人了。太厉害了。  发表于 2019-12-16 00:18
哇偶,大佬!问到本人了。太厉害了。  发表于 2019-12-16 00:16
回复 支持 1 反对 0

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-19 07:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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