查看: 2783|回复: 4

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

[复制链接]
梦石
0
星屑
946
在线时间
61 小时
注册时间
2019-12-10
回帖
89
发表于 2019-12-11 12:30:32 | 显示全部楼层 |阅读模式

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

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

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

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

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


  1. #==============================================================================
  2. # ■ Window_Message
  3. #------------------------------------------------------------------------------
  4. #  显示文章的信息窗口。
  5. #==============================================================================

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

点评

这是个错误案例  发表于 2019-12-11 12:47
想玩我做的游戏加我qq947128749
梦石
0
星屑
9557
在线时间
5074 小时
注册时间
2013-6-21
回帖
3459

开拓者贵宾剧作品鉴家

发表于 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

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部