查看: 2198|回复: 1

[已经解决] 关于菜单新增选项问题,在线等答案,表示我只是小白

[复制链接]
梦石
0
星屑
55
在线时间
60 小时
注册时间
2014-8-28
回帖
88
发表于 2014-10-24 20:46:11 | 显示全部楼层 |阅读模式

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

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

×
表示今天使用了一个任务脚本

就是这茬

  1. =begin
  2. --------------------------------------------------------------------------
  3. 详尽任务显示界面 v2.1
  4. --------------------------------------------------------------------------
  5. By 叶子

  6. 日期与更新
  7. 3-29-2006 -v1.0
  8. 4-3-2006  -v2.0
  9. -可以改变文字颜色,显示变量,显示图标,显示图片
  10. -大幅简化了编写任务内容的过程,加入自动换行功能
  11. -精简了窗口,使其还可以用作图鉴系统、日记系统等等
  12. 4-6-2006  -v2.1
  13. -增加了获得全部任务与删除全部任务命令
  14. -改正通假字,修改了示例任务3
  15. --------------------------------------------------------------------------
  16. 顾名思义,就是显示任务资料的界面
  17. 任务资料要预先在这里设定好
  18. 下载范例工程,能帮助你更快更好地掌握使用方法
  19. --------------------------------------------------------------------------
  20. 使用方法:

  21. 1、召唤任务显示界面:$scene = Scene_Task.new

  22. 可以在事件中的“脚本”指令加入这段东西,又或者修改 Scene_Menu 来增加一个显示
  23. 任务的选项。如果是修改 Scene_Menu 增加选项的话,在脚本倒数第30行左右,
  24. 把 $scene = Scene_Map.new 修改成 $scene = Scene_Menu.new(任务界面index)

  25. 2、设置任务资料

  26.   2.1、相关内容解析
  27.   
  28.   所有内容文字必须用双引号括住
  29.   
  30.   名称:任务的名字(显示在左边窗口中),大小为208×32,如果全部为文字的话,
  31.         够放九个全角字符
  32.         
  33.   简介:任务的介绍(显示在右边窗口中),宽368,高不限
  34.   
  35.         文字可以自动换行
  36.   
  37.    2.1.1、控制码解析
  38.    
  39.    名称和内容均可用控制码,注意两条反斜线都要打!
  40.    
  41.    \\v[n] 显示n号变量
  42.    \\c[n] 改变字体颜色。
  43.           n=1~7 时同“显示文章”的\c[n],n=8 时为半透明色,n=9 时为系统色(青色)
  44.    \\n[i] 显示i号角色名字
  45.    \\i[文件名] 显示图标
  46.    \\p[文件名] 显示图片
  47.    
  48.    2.1.2、高级:内嵌表达式
  49.         
  50.    请参考帮助-脚本入门-字符串-内嵌表达式相关内容。
  51.    它可以用来在任务的名称和简介那里显示变量。
  52.    常用的表达式(注意不要漏了井号和大括号):
  53.    #{$game_variables[n]}       ——插入n号变量的值
  54.    #{$game_party.item_number(n)}  ——插入持有n号物品数量
  55.                                       同理还有weapon_number,armor_number
  56.    还可以预先定义一个变量,再插入(例子见示例任务3-灵魂线)
  57.    
  58.   2.2、注意事项
  59.   
  60.    2.2.1、括号、逗号和双引号 [ ] , " 必须使用半角符号(英文输入),
  61.           引号内的内容则没有关系
  62.          
  63.    2.2.2、单引号 ' 和双引号 " 的区别:
  64.           为了不出错误,全部用双引号吧!当然如果你对Ruby很熟悉,那就没所谓了
  65.   
  66.   2.3、开始设置吧!
  67.   从107行开始设置任务资料,可以参考示例任务来设置,请仔细阅读附加讲解
  68.   
  69. 3、接受任务

  70. 事件里的“脚本”指令输入:get_task(任务ID)
  71. 例如 get_task(1) 就是接受1号任务

  72.   3.1、获得全部任务
  73.   
  74.   事件里的“脚本”指令输入:get_all_task
  75.   这个功能基本上是用来在编写好所有任务资料后测试排版的
  76.   

  77. 4、完成/删除任务

  78. 事件里的“脚本”指令输入:finish_task(任务ID)
  79. 例如 finish_task(1) 就是完成1号任务

  80. 注意:本脚本不负责完成任务后的奖励之类的东西,请自行在事件中判断,
  81.        这里的完成任务指的是从任务列表中删去此任务

  82.   4.1、删除全部任务
  83.   
  84.   事件里的“脚本”指令输入:finish_all_task
  85.   作为获得全部任务的对应功能存在,似乎不会怎么用到
  86. =end

  87. class Scene_Task
  88.   # 这里设置任务内容翻页音效
  89.   CHANGE_PAGE_SE = "Audio/SE/046-Book01"
  90. end

  91. class Game_Party
  92.   #--------------------------------------------------------------------------
  93.   # ● 设置任务资料
  94.   #--------------------------------------------------------------------------
  95.   def get_tasks_info
  96.     @tasks_info = []
  97.    
  98.     #-讲解-
  99.     # 三个示例任务由浅入深,其实只要看懂第一个就可以使用了。
  100.     # 任务的写法多种多样,不限于这三个任务的方法
  101.     #----
  102.     #-----------------------------
  103.     # 示例任务1:沙漠中的五叶花
  104.     #-----------------------------
  105.     名称 = "\\c[6]沙漠中的五叶花"
  106.     #-讲解-
  107.     # 注意!脚本编辑器的变色功能并不是非常完善,所以换行后字变黑了,但仍然是字符
  108.     # 串的一部分,所以不要忘记在内容最后打一个双引号
  109.     # 按回车是强制换行
  110.     #----
  111.     简介 = "\\c[6]沙漠中的五叶花

  112. \\c[9]任务目标:
  113. 获得5朵五叶花,交给西露达

  114. \\c[0]五叶花数目:\\v[1]/5

  115. 西露达:
  116. 人家等着你的花哦~"
  117.     #-讲解-
  118.     # 每个任务最后一定要加上:
  119.     # @tasks_info[任务ID] = Game_Task.new(名称, 简介)
  120.     # 接受任务和完成任务都是用这个任务ID来索引
  121.     #----
  122.     @tasks_info[1] = Game_Task.new(名称, 简介)
  123.    
  124.     #-----------------------------
  125.     # 示例任务2:克萝莉亚的药瓶
  126.     #-----------------------------
  127.     名称 = "\\c[6]克萝莉亚的药瓶"
  128.     #-讲解-
  129.     # 这里使用了字符串相加,例如 s = "a" + "b" ,s 就是 "ab"
  130.     # 还用了内嵌表达式,$game_party.item_number(38) 就是38号物品的数量
  131.     #----
  132.     简介 = 名称 + "
  133.    
  134. \\c[9]任务目标:
  135. 问克萝莉亚要一个药瓶,交给西露达

  136. \\c[0]药瓶:#{$game_party.item_number(38)}/1

  137. 西露达:
  138. 克萝莉亚就在西边的屋子里"
  139.     @tasks_info[2] = Game_Task.new(名称, 简介)
  140.    
  141.     #-----------------------------
  142.     # 示例任务3:灵魂线
  143.     #-----------------------------
  144.     #-讲解-
  145.     # 这里用了条件判断,当3号变量大于等于1时,加上“完成”字样,同时变色
  146.     #----
  147.     if $game_variables[3] >= 1
  148.       名称 = "\\c[8]灵魂线(完成)"
  149.       item = "\\c[8]灵魂线:#{$game_variables[3]}/1 (完成)"
  150.     else
  151.       名称 = "\\c[2]灵魂线"
  152.       item = "\\c[0]灵魂线:#{$game_variables[3]}/1"
  153.     end
  154.     #-讲解-
  155.     # 预先定义变量,用内嵌表达式插入
  156.     # 最后用了显示图标
  157.     #----
  158.     简介 = "#{名称}
  159.    
  160. \\c[9]任务目标:
  161. 找到埋起来的灵魂线,交给克萝莉亚

  162. #{item}

  163. \\c[0]克萝莉亚:
  164. 灵魂线就埋在其中一棵树下,给我好好找\\i[046-Skill03]"
  165.     @tasks_info[3] = Game_Task.new(名称, 简介)
  166.    
  167.   end
  168. end
  169.    
  170. #==============================================================================
  171. # ■ Interpreter
  172. #------------------------------------------------------------------------------
  173. #  执行事件命令的解释器。本类在 Game_System 类
  174. # 与 Game_Event 类的内部使用。
  175. #==============================================================================

  176. class Interpreter
  177.   #--------------------------------------------------------------------------
  178.   # ● 接受任务
  179.   #--------------------------------------------------------------------------
  180.   def get_task(id)
  181.     task = $game_party.tasks_info[id]
  182.     return true if (task.nil? or $game_party.current_tasks.include?(task.id))
  183.     $game_party.current_tasks.unshift(task.id)
  184.     return true
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 获得全部任务
  188.   #--------------------------------------------------------------------------
  189.   def get_all_task
  190.     # 清空当前任务
  191.     $game_party.current_tasks.clear
  192.     for task in $game_party.tasks_info
  193.       next if task.nil?
  194.       $game_party.current_tasks.unshift(task.id)
  195.     end
  196.     return true
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● 完成/放弃任务
  200.   #--------------------------------------------------------------------------
  201.   def finish_task(id)
  202.     task = $game_party.tasks_info[id]
  203.     return true if task.nil?
  204.     $game_party.current_tasks.delete(task.id)
  205.     return true
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # ● 删除全部任务
  209.   #--------------------------------------------------------------------------
  210.   def finish_all_task
  211.     $game_party.current_tasks.clear
  212.     return true
  213.   end
  214. end

  215. #==============================================================================
  216. # ■ Game_Party
  217. #------------------------------------------------------------------------------
  218. #  处理同伴的类。包含金钱以及物品的信息。本类的实例
  219. # 请参考 $game_party。
  220. #==============================================================================

  221. class Game_Party
  222.   #--------------------------------------------------------------------------
  223.   # ● 定义实例变量
  224.   #--------------------------------------------------------------------------
  225.   attr_writer     :latest_task                  # 上次查看的任务
  226.   #--------------------------------------------------------------------------
  227.   # ● 取得任务资料
  228.   #--------------------------------------------------------------------------
  229.   def tasks_info
  230.     if @tasks_info.nil?
  231.       get_tasks_info
  232.     end
  233.     return @tasks_info
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● 取得当前任务
  237.   #--------------------------------------------------------------------------
  238.   def current_tasks
  239.     if @current_tasks.nil?
  240.       @current_tasks = []
  241.     end
  242.     return @current_tasks
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● 上次查看的任务
  246.   #--------------------------------------------------------------------------
  247.   def latest_task
  248.     if !current_tasks.include?(@latest_task)
  249.       @latest_task = current_tasks[0]
  250.     end
  251.     return @latest_task
  252.   end
  253. end

  254. #==============================================================================
  255. # ■ Game_Task
  256. #------------------------------------------------------------------------------
  257. #  处理任务的类。包含任务的信息。
  258. #==============================================================================

  259. class Game_Task
  260.   attr_accessor   :name                   # 名称
  261.   attr_accessor   :briefing               # 简介
  262.   def initialize(name, briefing)
  263.     @name = name
  264.     @briefing = briefing
  265.   end
  266.   def height
  267.     text = @briefing.clone
  268.     x = 0
  269.     y = 64
  270.     min_y = 0
  271.     # 限制文字处理
  272.     begin
  273.       last_text = text.clone
  274.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  275.     end until text == last_text
  276.     text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  277.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  278.     end
  279.     # 为了方便、将 "\\\" 变换为 "\000"
  280.     text.gsub!(/\\\\/) { "\000" }
  281.     # "\C" 变为 "\001"
  282.     text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  283.     # "\I" 变为 "\002"
  284.     text.gsub!(/\\[Ii]/) { "\002" }
  285.     # "\P" 变为 "\003"
  286.     text.gsub!(/\\[Pp]/) { "\003" }
  287.     # c 获取 1 个字 (如果不能取得文字就循环)
  288.     while ((c = text.slice!(/./m)) != nil)
  289.       # \\ 的情况下
  290.       if c == "\000"
  291.         # 还原为本来的文字
  292.         c = "\"
  293.       end
  294.       # \C[n] 的情况下
  295.       if c == "\001"
  296.         # 更改文字色
  297.         text.sub!(/\[([0-9]+)\]/, "")
  298.         # 下面的文字
  299.         next
  300.       end
  301.       # 图标的情况下
  302.       if c == "\002"
  303.         icon_name = ''
  304.         while ((cha = text.slice!(/./m)) != ']')
  305.           next if cha == '['
  306.           icon_name += cha
  307.         end
  308.         icon = RPG::Cache.icon(icon_name)
  309.         if x + icon.width > 368
  310.           x = 0
  311.           y += [32, min_y].max
  312.           min_y = 0
  313.         end
  314.         x += 28
  315.         next
  316.       end
  317.       # 图片的情况下
  318.       if c == "\003"
  319.         pic_name = ''
  320.         while ((cha = text.slice!(/./m)) != ']')
  321.           next if cha == '['
  322.           pic_name += cha
  323.         end
  324.         pic = RPG::Cache.picture(pic_name)
  325.         if x + pic.width > 368
  326.           x = 0
  327.           y += [32, min_y].max
  328.           min_y = 0
  329.         end
  330.         x += pic.width
  331.         min_y = [pic.height, 32].max
  332.         next
  333.       end
  334.       # 另起一行文字的情况下
  335.       if c == "\n"
  336.         y += [32, min_y].max
  337.         min_y = 0
  338.         x = 0
  339.         # 下面的文字
  340.         next
  341.       end
  342.       # 自动换行处理
  343.       if x + 22 > 368
  344.         y += [32, min_y].max
  345.         min_y = 0
  346.         x = 0
  347.       end
  348.       # x 为要描绘文字的加法运算
  349.       x += 22
  350.     end
  351.     return (y + [32, min_y].max)
  352.   end
  353.   def id
  354.     return $game_party.tasks_info.index(self)
  355.   end
  356. end

  357. #==============================================================================
  358. # ■ Window_Task_Name
  359. #------------------------------------------------------------------------------
  360. #  任务名称显示窗口。
  361. #==============================================================================

  362. class Window_Task_Name < Window_Selectable
  363.   #--------------------------------------------------------------------------
  364.   # ● 初始化对像
  365.   #--------------------------------------------------------------------------
  366.   def initialize(tasks)
  367.     super(0, 0, 240, 480)
  368.     @tasks = []
  369.     for id in tasks
  370.       @tasks.push($game_party.tasks_info[id])
  371.     end
  372.     @item_max = tasks.size
  373.     self.contents = Bitmap.new(
  374.     self.width - 32, @item_max == 0 ? 32 : @item_max * 32)
  375.     refresh
  376.     self.index = 0
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ● 刷新
  380.   #--------------------------------------------------------------------------
  381.   def refresh
  382.     self.contents.clear
  383.     if @tasks != []
  384.       for task in @tasks
  385.         draw_item(task)
  386.       end
  387.     else
  388.       draw_blank
  389.     end
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # ● 描绘项目
  393.   #--------------------------------------------------------------------------
  394.   def draw_item(task)
  395.     text = task.name.clone
  396.     x = 0
  397.     y = @tasks.index(task) * 32
  398.     # 限制文字处理
  399.     begin
  400.       last_text = text.clone
  401.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  402.     end until text == last_text
  403.     text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  404.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  405.     end
  406.     # 为了方便、将 "\\\" 变换为 "\000"
  407.     text.gsub!(/\\\\/) { "\000" }
  408.     # "\\C" 变为 "\001"
  409.     text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  410.     # "\I" 变为 "\002"
  411.     text.gsub!(/\\[Ii]/) { "\002" }
  412.     # "\P" 变为 "\003"
  413.     text.gsub!(/\\[Pp]/) { "\003" }
  414.     # c 获取 1 个字 (如果不能取得文字就循环)
  415.     while ((c = text.slice!(/./m)) != nil)
  416.       # \\ 的情况下
  417.       if c == "\000"
  418.         # 还原为本来的文字
  419.         c = "\"
  420.       end
  421.       # \C[n] 的情况下
  422.       if c == "\001"
  423.         # 更改文字色
  424.         text.sub!(/\[([0-9]+)\]/, "")
  425.         color = $1.to_i
  426.         if color >= 0 and color <= 7
  427.           self.contents.font.color = text_color(color)
  428.         elsif color == 8
  429.           self.contents.font.color = disabled_color
  430.         elsif color == 9
  431.           self.contents.font.color = system_color
  432.         end
  433.         # 下面的文字
  434.         next
  435.       end
  436.       # 图标的情况下
  437.       if c == "\002"
  438.         icon_name = ''
  439.         while ((cha = text.slice!(/./m)) != ']')
  440.           next if cha == '['
  441.           icon_name += cha
  442.         end
  443.         icon = RPG::Cache.icon(icon_name)
  444.         if x + icon.width > self.contents.width
  445.           x = 0
  446.           y += [32, min_y].max
  447.           min_y = 0
  448.         end
  449.         self.contents.blt(x + 4, y + 4, icon, Rect.new(0, 0, 24, 24))
  450.         x += 28
  451.         next
  452.       end
  453.       # 图片的情况下
  454.       if c == "\003"
  455.         pic_name = ''
  456.         while ((cha = text.slice!(/./m)) != ']')
  457.           next if cha == '['
  458.           pic_name += cha
  459.         end
  460.         pic = RPG::Cache.picture(pic_name)
  461.         if x + pic.width > self.contents.width
  462.           x = 0
  463.           y += [32, min_y].max
  464.           min_y = 0
  465.         end
  466.         self.contents.blt(x + 4, y, pic, Rect.new(0, 0, pic.width, pic.height))
  467.         x += pic.width
  468.         next
  469.       end
  470.       # 描绘文字
  471.       self.contents.draw_text(4 + x, y, 40, 32, c)
  472.       # x 为要描绘文字的加法运算
  473.       x += self.contents.text_size(c).width
  474.     end
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # ● 描绘空行
  478.   #--------------------------------------------------------------------------
  479.   def draw_blank
  480.     self.contents.font.color = disabled_color
  481.     rect = Rect.new(4, 0, self.contents.width - 8, 32)
  482.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  483.     self.contents.draw_text(rect, '当前没有任何任务')
  484.   end
  485.   #--------------------------------------------------------------------------
  486.   # ● 获取任务
  487.   #--------------------------------------------------------------------------
  488.   def task
  489.     return @tasks[self.index]
  490.   end
  491. end
  492.   
  493. #==============================================================================
  494. # ■ Window_Task
  495. #------------------------------------------------------------------------------
  496. #  任务内容显示窗口。
  497. #==============================================================================

  498. class Window_Task < Window_Base
  499.   #--------------------------------------------------------------------------
  500.   # ● 初始化对像
  501.   #--------------------------------------------------------------------------
  502.   def initialize(task_id)
  503.     super(240, 0, 400, 480)
  504.     refresh(task_id)
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # ● 刷新内容
  508.   #--------------------------------------------------------------------------
  509.   def refresh(task_id)
  510.     self.oy = 0
  511.     self.visible = true
  512.     return if task_id.nil?
  513.     task = $game_party.tasks_info[task_id]
  514.     if !task.nil?
  515.       self.contents = Bitmap.new(self.width - 32, task.height)
  516.     else
  517.       self.contents = Bitmap.new(self.width - 32, self.height - 32)
  518.       return
  519.     end
  520.     self.contents.font.color = normal_color
  521.     # 描绘任务内容
  522.     draw_task_info(task)
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # ● 描绘任务内容
  526.   #--------------------------------------------------------------------------
  527.   def draw_task_info(task)
  528.     # 记录文字x坐标
  529.     x = 0
  530.     # 记录文字y坐标
  531.     y = 0
  532.     # 记录换行时y坐标最小加值
  533.     min_y = 0
  534.     self.contents.font.color = normal_color
  535.     # 描绘任务简介
  536.     text = task.briefing.clone
  537.     # 限制文字处理
  538.     begin
  539.       last_text = text.clone
  540.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  541.     end until text == last_text
  542.     text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  543.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  544.     end
  545.     # 为了方便、将 "\\\" 变换为 "\000"
  546.     text.gsub!(/\\\\/) { "\000" }
  547.     # "\C" 变为 "\001"
  548.     text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  549.     # "\I" 变为 "\002"
  550.     text.gsub!(/\\[Ii]/) { "\002" }
  551.     # "\P" 变为 "\003"
  552.     text.gsub!(/\\[Pp]/) { "\003" }
  553.     # c 获取 1 个字 (如果不能取得文字就循环)
  554.     while ((c = text.slice!(/./m)) != nil)
  555.       # \\ 的情况下
  556.       if c == "\000"
  557.         # 还原为本来的文字
  558.         c = "\"
  559.       end
  560.       # \C[n] 的情况下
  561.       if c == "\001"
  562.         # 更改文字色
  563.         text.sub!(/\[([0-9]+)\]/, "")
  564.         color = $1.to_i
  565.         if color >= 0 and color <= 7
  566.           self.contents.font.color = text_color(color)
  567.         elsif color == 8
  568.           self.contents.font.color = disabled_color
  569.         elsif color == 9
  570.           self.contents.font.color = system_color
  571.         end
  572.         # 下面的文字
  573.         next
  574.       end
  575.       # 图标的情况下
  576.       if c == "\002"
  577.         icon_name = ''
  578.         while ((cha = text.slice!(/./m)) != ']')
  579.           next if cha == '['
  580.           icon_name += cha
  581.         end
  582.         icon = RPG::Cache.icon(icon_name)
  583.         if x + icon.width > self.contents.width
  584.           x = 0
  585.           y += [32, min_y].max
  586.           min_y = 0
  587.         end
  588.         self.contents.blt(x + 4, y + 4, icon, Rect.new(0, 0, 24, 24))
  589.         x += 28
  590.         next
  591.       end
  592.       # 图片的情况下
  593.       if c == "\003"
  594.         pic_name = ''
  595.         while ((cha = text.slice!(/./m)) != ']')
  596.           next if cha == '['
  597.           pic_name += cha
  598.         end
  599.         pic = RPG::Cache.picture(pic_name)
  600.         if x + pic.width > self.contents.width
  601.           x = 0
  602.           y += [32, min_y].max
  603.           min_y = 0
  604.         end
  605.         self.contents.blt(x + 4, y, pic, Rect.new(0, 0, pic.width, pic.height))
  606.         x += pic.width
  607.         min_y = [pic.height, 32].max
  608.         next
  609.       end
  610.       # 另起一行文字的情况下
  611.       if c == "\n"
  612.         y += [32, min_y].max
  613.         min_y = 0
  614.         x = 0
  615.         # 下面的文字
  616.         next
  617.       end
  618.       # 自动换行处理
  619.       if x + self.contents.text_size(c).width > self.contents.width
  620.         y += [32, min_y].max
  621.         min_y = 0
  622.         x = 0
  623.       end
  624.       # 描绘文字
  625.       self.contents.draw_text(4 + x, y, 40, 32, c)
  626.       # x 为要描绘文字的加法运算
  627.       x += self.contents.text_size(c).width
  628.     end
  629.   end
  630. end

  631. #==============================================================================
  632. # ■ Scene_Task
  633. #------------------------------------------------------------------------------
  634. #  处理任务画面的类。
  635. #==============================================================================

  636. class Scene_Task
  637.   #--------------------------------------------------------------------------
  638.   # ● 主处理
  639.   #--------------------------------------------------------------------------
  640.   def main
  641.     # 刷新任务资料
  642.     $game_party.get_tasks_info
  643.     # 生成任务名称窗口
  644.     @task_names_window = Window_Task_Name.new($game_party.current_tasks)
  645.     @task_names_window.active = true
  646.     if $game_party.current_tasks != []
  647.       @task_names_window.index = $game_party.current_tasks.index($game_party.latest_task)
  648.     end
  649.     # 生成任务内容窗口
  650.     @task_info_window = Window_Task.new($game_party.latest_task)
  651.     @task_info_window.active = true
  652.     # 执行过渡
  653.     Graphics.transition
  654.     # 主循环
  655.     loop do
  656.       # 刷新游戏画面
  657.       Graphics.update
  658.       # 刷新输入信息
  659.       Input.update
  660.       # 刷新画面
  661.       update
  662.       # 如果画面被切换的话就中断循环
  663.       if $scene != self
  664.         break
  665.       end
  666.     end
  667.     # 准备过渡
  668.     Graphics.freeze
  669.     # 释放窗口
  670.     @task_names_window.dispose
  671.     @task_info_window.dispose
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # ● 刷新画面
  675.   #--------------------------------------------------------------------------
  676.   def update
  677.     # 刷新窗口
  678.     @task_names_window.update
  679.     @task_info_window.update
  680.     update_task_names_window
  681.   end
  682.   #--------------------------------------------------------------------------
  683.   # ● 刷新任务名称窗口
  684.   #--------------------------------------------------------------------------
  685.   def update_task_names_window
  686.     # 按下 B 键的情况下
  687.     if Input.trigger?(Input::B)
  688.       # 演奏取消 SE
  689.       $game_system.se_play($data_system.cancel_se)
  690.       # 这里设置返回的场景,返回地图是Scene_Map.new,菜单是Scene_Menu.new(任务界面index)
  691.       $scene = Scene_Map.new
  692.       return
  693.     end
  694.     # 按下 C 键的情况下
  695.     if Input.trigger?(Input::C)
  696.       # 无任务可显示的话
  697.       if @task_names_window.task == nil
  698.         # 演奏冻结 SE
  699.         $game_system.se_play($data_system.buzzer_se)
  700.         return
  701.       end
  702.       # 如果光标没有移动的话,翻页
  703.       if $game_party.latest_task == @task_names_window.task.id
  704.         if @task_info_window.oy + @task_info_window.height - 32 > @task_info_window.contents.height
  705.           @task_info_window.oy = 0
  706.         else
  707.           @task_info_window.oy += 480-32
  708.         end
  709.         if @task_info_window.contents.height > @task_info_window.height - 32
  710.           # 演奏翻页 SE
  711.           Audio.se_play(CHANGE_PAGE_SE)
  712.         end
  713.       else
  714.         @task_info_window.refresh(@task_names_window.task.id)
  715.         $game_party.latest_task = @task_names_window.task.id
  716.         # 演奏确定 SE
  717.         $game_system.se_play($data_system.decision_se)
  718.       end
  719.     end
  720.   end
  721. end
复制代码




使用之后出现如图情况,求大神解决

4755468.jpg

看看结束游戏出现的地方

求解决啊,我是小白一个,最好附上修改教程

谢谢













欢迎加入我的工作室“劍龍工作室”
找人開坑,大家一起探討人生
群號: 252259148
[b][color=Red]and
这是我的论坛,请大家捧场,指点,以及建议[/color][/b]
[url=http://52makegames.haotui.com/bbs.php][color=Red][b][color=DarkOrchid]我爱制作游戏讨论社[/color][/b][/color][/url]
梦石
0
星屑
2826
在线时间
2634 小时
注册时间
2013-1-16
回帖
5453

贵宾

发表于 2014-10-25 02:39:30 | 显示全部楼层
显然游戏时间挡住了改动后的菜单,如果你觉得游戏时间不是很重要的话(我是这么认为的),跟着我的步骤删了它。
找到默认的Scen_Menu脚本。把出现过"@playtime_window"字样的语句都删掉(不过我更建议你注释掉即可)。
之后的脚本就变成这样:
  1. #==============================================================================
  2. # ■ Scene_Menu
  3. #------------------------------------------------------------------------------
  4. #  处理菜单画面的类。
  5. #==============================================================================

  6. class Scene_Menu
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #     menu_index : 命令光标的初期位置
  10.   #--------------------------------------------------------------------------
  11.   def initialize(menu_index = 0)
  12.     @menu_index = menu_index
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● 主处理
  16.   #--------------------------------------------------------------------------
  17.   def main
  18.     # 生成命令窗口
  19.     s1 = $data_system.words.item
  20.     s2 = $data_system.words.skill
  21.     s3 = $data_system.words.equip
  22.     s4 = "状态"
  23.     s5 = "存档"
  24.     s6 = "结束游戏"
  25.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
  26.     @command_window.index = @menu_index
  27.     # 同伴人数为 0 的情况下
  28.     if $game_party.actors.size == 0
  29.       # 物品、特技、装备、状态无效化
  30.       @command_window.disable_item(0)
  31.       @command_window.disable_item(1)
  32.       @command_window.disable_item(2)
  33.       @command_window.disable_item(3)
  34.     end
  35.     # 禁止存档的情况下
  36.     if $game_system.save_disabled
  37.       # 存档无效
  38.       @command_window.disable_item(4)
  39.     end
  40.     # 生成游戏时间窗口
  41.     #@playtime_window = Window_PlayTime.new
  42.     #@playtime_window.x = 0
  43.     #@playtime_window.y = 224
  44.     # 生成步数窗口
  45.     @steps_window = Window_Steps.new
  46.     @steps_window.x = 0
  47.     @steps_window.y = 320
  48.     # 生成金钱窗口
  49.     @gold_window = Window_Gold.new
  50.     @gold_window.x = 0
  51.     @gold_window.y = 416
  52.     # 生成状态窗口
  53.     @status_window = Window_MenuStatus.new
  54.     @status_window.x = 160
  55.     @status_window.y = 0
  56.     # 执行过渡
  57.     Graphics.transition
  58.     # 主循环
  59.     loop do
  60.       # 刷新游戏画面
  61.       Graphics.update
  62.       # 刷新输入信息
  63.       Input.update
  64.       # 刷新画面
  65.       update
  66.       # 如果切换画面就中断循环
  67.       if $scene != self
  68.         break
  69.       end
  70.     end
  71.     # 准备过渡
  72.     Graphics.freeze
  73.     # 释放窗口
  74.     @command_window.dispose
  75.     #@playtime_window.dispose
  76.     @steps_window.dispose
  77.     @gold_window.dispose
  78.     @status_window.dispose
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● 刷新画面
  82.   #--------------------------------------------------------------------------
  83.   def update
  84.     # 刷新窗口
  85.     @command_window.update
  86.     #@playtime_window.update
  87.     @steps_window.update
  88.     @gold_window.update
  89.     @status_window.update
  90.     # 命令窗口被激活的情况下: 调用 update_command
  91.     if @command_window.active
  92.       update_command
  93.       return
  94.     end
  95.     # 状态窗口被激活的情况下: 调用 update_status
  96.     if @status_window.active
  97.       update_status
  98.       return
  99.     end
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 刷新画面 (命令窗口被激活的情况下)
  103.   #--------------------------------------------------------------------------
  104.   def update_command
  105.     # 按下 B 键的情况下
  106.     if Input.trigger?(Input::B)
  107.       # 演奏取消 SE
  108.       $game_system.se_play($data_system.cancel_se)
  109.       # 切换的地图画面
  110.       $scene = Scene_Map.new
  111.       return
  112.     end
  113.     # 按下 C 键的情况下
  114.     if Input.trigger?(Input::C)
  115.       # 同伴人数为 0、存档、游戏结束以外的场合
  116.       if $game_party.actors.size == 0 and @command_window.index < 4
  117.         # 演奏冻结 SE
  118.         $game_system.se_play($data_system.buzzer_se)
  119.         return
  120.       end
  121.       # 命令窗口的光标位置分支
  122.       case @command_window.index
  123.       when 0  # 物品
  124.         # 演奏确定 SE
  125.         $game_system.se_play($data_system.decision_se)
  126.         # 切换到物品画面
  127.         $scene = Scene_Item.new
  128.       when 1  # 特技
  129.         # 演奏确定 SE
  130.         $game_system.se_play($data_system.decision_se)
  131.         # 激活状态窗口
  132.         @command_window.active = false
  133.         @status_window.active = true
  134.         @status_window.index = 0
  135.       when 2  # 装备
  136.         # 演奏确定 SE
  137.         $game_system.se_play($data_system.decision_se)
  138.         # 激活状态窗口
  139.         @command_window.active = false
  140.         @status_window.active = true
  141.         @status_window.index = 0
  142.       when 3  # 状态
  143.         # 演奏确定 SE
  144.         $game_system.se_play($data_system.decision_se)
  145.         # 激活状态窗口
  146.         @command_window.active = false
  147.         @status_window.active = true
  148.         @status_window.index = 0
  149.       when 4  # 存档
  150.         # 禁止存档的情况下
  151.         if $game_system.save_disabled
  152.           # 演奏冻结 SE
  153.           $game_system.se_play($data_system.buzzer_se)
  154.           return
  155.         end
  156.         # 演奏确定 SE
  157.         $game_system.se_play($data_system.decision_se)
  158.         # 切换到存档画面
  159.         $scene = Scene_Save.new
  160.       when 5  # 游戏结束
  161.         # 演奏确定 SE
  162.         $game_system.se_play($data_system.decision_se)
  163.         # 切换到游戏结束画面
  164.         $scene = Scene_End.new
  165.       end
  166.       return
  167.     end
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● 刷新画面 (状态窗口被激活的情况下)
  171.   #--------------------------------------------------------------------------
  172.   def update_status
  173.     # 按下 B 键的情况下
  174.     if Input.trigger?(Input::B)
  175.       # 演奏取消 SE
  176.       $game_system.se_play($data_system.cancel_se)
  177.       # 激活命令窗口
  178.       @command_window.active = true
  179.       @status_window.active = false
  180.       @status_window.index = -1
  181.       return
  182.     end
  183.     # 按下 C 键的情况下
  184.     if Input.trigger?(Input::C)
  185.       # 命令窗口的光标位置分支
  186.       case @command_window.index
  187.       when 1  # 特技
  188.         # 本角色的行动限制在 2 以上的情况下
  189.         if $game_party.actors[@status_window.index].restriction >= 2
  190.           # 演奏冻结 SE
  191.           $game_system.se_play($data_system.buzzer_se)
  192.           return
  193.         end
  194.         # 演奏确定 SE
  195.         $game_system.se_play($data_system.decision_se)
  196.         # 切换到特技画面
  197.         $scene = Scene_Skill.new(@status_window.index)
  198.       when 2  # 装备
  199.         # 演奏确定 SE
  200.         $game_system.se_play($data_system.decision_se)
  201.         # 切换的装备画面
  202.         $scene = Scene_Equip.new(@status_window.index)
  203.       when 3  # 状态
  204.         # 演奏确定 SE
  205.         $game_system.se_play($data_system.decision_se)
  206.         # 切换到状态画面
  207.         $scene = Scene_Status.new(@status_window.index)
  208.       end
  209.       return
  210.     end
  211.   end
  212. end
复制代码
这样仅仅可以解决命令窗口被遮挡的问题。
若你觉得这样修改之后还有不妥之处,请及时回复。

点评

谢谢,采用  发表于 2014-10-25 12:41
那要看菜单扩展多少了,我习惯留游戏时间删掉步数  发表于 2014-10-25 12:00
↓都删了画面有点空荡吧  发表于 2014-10-25 11:52
其实我觉得“步数”比“游戏时间”还没用啊  发表于 2014-10-25 09:33

评分

参与人数 1星屑 +220 收起 理由
RyanBern + 220 认可答案

查看全部评分

(Created by @喵kano)


施工现场:hotege.github.io
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部