查看: 3009|回复: 1

[已经过期] 如何在修改后的菜单添加选项

[复制链接]

炎

梦石
0
星屑
98
在线时间
1617 小时
注册时间
2013-8-15
回帖
4322
发表于 2014-8-16 14:53:31 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 永燃的狂炎 于 2014-8-19 00:58 编辑

@VIPArcher 直接调过期吧,,反正没人答得出
ads11000 的 制造物品 脚本
  1. #encoding:utf-8
  2. #==============================================================================
  3. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  4. #==============================================================================
  5. #==============================================================================
  6. #
  7. #每添加一个制造的类型,最上面的类别菜单就会多一项。
  8. #
  9. #添加类型的方法是:
  10. #$game_party.add_cook_type(类别名称,类别介绍, 类别状态-默认false)
  11. #
  12. #举例:
  13. #$game_party.add_cook_type("制药","调配药品", true)
  14. #
  15. #添加配方的方法:
  16. #$game_party.add_cookbook(配方名称, 配方介绍, 配方类别名称,材料的二维数组,产出物的二维数组,配方状态)
  17. #
  18. #举例:
  19. #$game_party.add_cookbook("初级补血药水", "制作初级补血药水", "制药",[[18,2]],[[1,1]],true)
  20. #
  21. #调用窗口的方法:SceneManager.call(Scene_Cook)
  22. #
  23. #
  24. #==============================================================================

  25. #==============================================================================
  26. # ■ Cookbook_Type
  27. #------------------------------------------------------------------------------
  28. #  食谱类型类。
  29. #==============================================================================

  30. class Cookbook_Type
  31.   attr_reader :index
  32.   attr_reader :name
  33.   attr_reader :description
  34.   attr_reader :enabled
  35.   #--------------------------------------------------------------------------
  36.   # ● 初始化对象
  37.   #--------------------------------------------------------------------------
  38.   def initialize(index, name, description, enabled = false)
  39.     @index = index
  40.     @name = name
  41.     @description = description
  42.     @enabled = enabled
  43.   end
  44.   
  45.   def enable(en)
  46.     @enabled = en
  47.   end
  48. end

  49. #==============================================================================
  50. # ■ Cookbook
  51. #------------------------------------------------------------------------------
  52. #  食谱类。本类在 Game_Task 类的内部使用。
  53. #   食谱属性:食谱序号,食谱名称,食谱类型,食谱介绍,原料,成品
  54. #==============================================================================

  55. class Cookbook
  56.   attr_reader :index
  57.   attr_reader :name
  58.   attr_reader :description
  59.   attr_reader :type
  60.   attr_reader :input
  61.   attr_reader :output
  62.   attr_reader :enabled
  63.   #--------------------------------------------------------------------------
  64.   # ● 初始化对象
  65.   #--------------------------------------------------------------------------
  66.   def initialize(index, name, description, type, input, output, enabled = true)
  67.     @index = index
  68.     @name = name
  69.     @description = description
  70.     @type = type
  71.     @input = input
  72.     @output = output
  73.     @enabled = enabled
  74.   end
  75.   
  76.   def enable(en)
  77.     @enabled = en
  78.   end
  79.   
  80.   #--------------------------------------------------------------------------
  81.   # ● 查询列表中的物品
  82.   #--------------------------------------------------------------------------
  83.   def in_list?(item, list)
  84.     list.each do |arr|
  85.       return true if arr[0] == item.id
  86.     end
  87.     return false
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 查询是否是材料列表中的物品
  91.   #--------------------------------------------------------------------------
  92.   def resource?(item)
  93.     in_list?(item, @input)
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 查询是否是产出列表中的物品
  97.   #--------------------------------------------------------------------------
  98.   def output?(item)
  99.     in_list?(item, @output)
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 查询材料需求量
  103.   #--------------------------------------------------------------------------
  104.   def amount(item, i)
  105.     if i == 0
  106.       @input.each do |arr|
  107.         return arr[1] if arr[0] == item.id
  108.       end
  109.     else
  110.       @output.each do |arr|
  111.         return arr[1] if arr[0] == item.id
  112.       end
  113.     end
  114.     return 0
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● 查询材料是否足够
  118.   #--------------------------------------------------------------------------
  119.   def enough?
  120.     input.each do |arr|
  121.       return false if $data_items[arr[0]] && arr[1] > $game_party.item_number($data_items[arr[0]])
  122.     end
  123.     return true
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 查询某件材料是否足够
  127.   #--------------------------------------------------------------------------
  128.   def item_enough?(item)
  129.     input.each do |arr|
  130.       return false if arr[0] == item.id && arr[1] > $game_party.item_number(item)
  131.     end
  132.     return true
  133.   end
  134. end

  135. #==============================================================================
  136. # ■ Game_Party
  137. #==============================================================================

  138. class Game_Party < Game_Unit
  139.   #--------------------------------------------------------------------------
  140.   # ● 初始化对象
  141.   #--------------------------------------------------------------------------
  142.   alias old_init initialize
  143.   def initialize
  144.     old_init
  145.     @cook_types = []
  146.     @cookbooks = []
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 添加新的制造类型
  150.   #--------------------------------------------------------------------------
  151.   def add_cook_type(n, d, en)
  152.     @cook_types.push(Cookbook_Type.new(@cook_types.size, n, d, en)) if !have_cook_type?(n)
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 添加新的食谱
  156.   #--------------------------------------------------------------------------
  157.   def add_cookbook(n, d, type, input, output, en)
  158.     if !have_cookbook?(n) && have_cook_type?(type)
  159.       @cookbooks.push(Cookbook.new(@cookbooks.size, n, d, type, input, output, en))
  160.     end
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● 判断名称为n的制造类型是否存在
  164.   #--------------------------------------------------------------------------
  165.   def have_cook_type?(n)
  166.     @cook_types.each do |x|
  167.       return true if x.name == n
  168.     end
  169.     return false
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 判断名称为n的食谱是否存在
  173.   #--------------------------------------------------------------------------
  174.   def have_cookbook?(n)
  175.     @cookbooks.each do |x|
  176.       return true if x.name == n
  177.     end
  178.     return false
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ● 返回制造类型列表
  182.   #--------------------------------------------------------------------------
  183.   def cook_types
  184.     return @cook_types
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 返回食谱列表
  188.   #--------------------------------------------------------------------------
  189.   def cookbooks(type = nil)
  190.     return @cookbooks if type == nil
  191.     arr = []
  192.     @cookbooks.each do |x|
  193.       arr.push(x) if x.type == type
  194.     end
  195.     return arr
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 更改序号为i的制造类型的使用状态
  199.   #--------------------------------------------------------------------------
  200.   def set_cook_type(i, en)
  201.     @cook_types[i].enable(en)
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 更改序号为i的食谱的使用状态
  205.   #--------------------------------------------------------------------------
  206.   def set_cookbook(i, en)
  207.     @cookbooks[i].enable(en)
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 返回制造类型数目
  211.   #--------------------------------------------------------------------------
  212.   def cook_types_size
  213.     return @cook_types.size
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 查询名称为n的制造类型的描述
  217.   #--------------------------------------------------------------------------
  218.   def cook_type_description(n)
  219.     @cook_types.each do |x|
  220.       return x.description if x.name == n
  221.     end
  222.     return ""
  223.   end
  224. end

  225. #==============================================================================
  226. # ■ Scene_Cook
  227. #------------------------------------------------------------------------------
  228. #  制造画面
  229. #==============================================================================

  230. class Scene_Cook < Scene_ItemBase
  231.   #--------------------------------------------------------------------------
  232.   # ● 开始处理
  233.   #--------------------------------------------------------------------------
  234.   def start
  235.     super
  236.     create_category_window
  237.     create_cookbook_window
  238.     create_description_window
  239.     create_needs_window
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 生成分类窗口
  243.   #--------------------------------------------------------------------------
  244.   def create_category_window
  245.     @category_window = Window_CookCategory.new
  246.     @category_window.viewport = @viewport
  247.     @category_window.y = 0
  248.     @category_window.set_handler(:ok,     method(:on_category_ok))
  249.     @category_window.set_handler(:cancel, method(:return_scene))
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● 生成食谱窗口
  253.   #--------------------------------------------------------------------------
  254.   def create_cookbook_window
  255.     wy = @category_window.height
  256.     wh = Graphics.height - wy
  257.     @item_window = Window_CookList.new(0, wy, Graphics.width*0.5 , wh)
  258.     @item_window.viewport = @viewport
  259.     @item_window.set_handler(:ok,     method(:on_item_ok))
  260.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  261.     @category_window.item_window = @item_window
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 生成描述窗口
  265.   #--------------------------------------------------------------------------
  266.   def create_description_window
  267.     wy = @category_window.height
  268.     @help_window = Window_Description.new(Graphics.width*0.5, wy)
  269.     @help_window.viewport = @viewport
  270.     @item_window.help_window = @help_window
  271.     @category_window.help_window = @help_window
  272.   end
  273.     #--------------------------------------------------------------------------
  274.   # ● 生成材料窗口
  275.   #--------------------------------------------------------------------------
  276.   def create_needs_window
  277.     wy = @category_window.height + @help_window.height
  278.     wh = Graphics.height - wy
  279.     @needs_window = Window_NeedsList.new(Graphics.width*0.5, wy, Graphics.width*0.5 , wh)
  280.     #@item_window.viewport = @viewport
  281.     @item_window.needs_window = @needs_window
  282.    
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ● 分类“确定”
  286.   #--------------------------------------------------------------------------
  287.   def on_category_ok
  288.     @item_window.activate
  289.     @item_window.select_last
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ● 食谱“确定”
  293.   #--------------------------------------------------------------------------
  294.   def on_item_ok
  295.     #$game_party.last_item.object = item
  296.     cook
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ● 食谱“取消”
  300.   #--------------------------------------------------------------------------
  301.   def on_item_cancel
  302.     @item_window.unselect
  303.     @category_window.activate
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● 制造
  307.   #--------------------------------------------------------------------------
  308.   def cook
  309.     if item.enough?
  310.       play_se_for_item
  311.       use_item
  312.       @needs_window.refresh
  313.       @item_window.refresh
  314.       activate_item_window
  315.     end
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● 播放制作声效
  319.   #--------------------------------------------------------------------------
  320.   def play_se_for_item
  321.     Sound.play_recovery
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # ● 使用食谱
  325.   #--------------------------------------------------------------------------
  326.   def use_item
  327.     #super
  328.     #@item_window.redraw_current_item
  329.     $data_items.each do |it|
  330.       if it && !it.name.empty?
  331.         $game_party.gain_item(it,-item.amount(it,0)) if item.resource?(it)
  332.         $game_party.gain_item(it,item.amount(it,1)) if item.output?(it)
  333.       end
  334.     end
  335.   end
  336. end


  337. #==============================================================================
  338. # ■ Window_CookCategory
  339. #------------------------------------------------------------------------------
  340. #  制造画面中,显示制造类型的窗口。
  341. #==============================================================================

  342. class Window_CookCategory < Window_HorzCommand
  343.   #--------------------------------------------------------------------------
  344.   # ● 定义实例变量
  345.   #--------------------------------------------------------------------------
  346.   attr_reader   :item_window
  347.   #--------------------------------------------------------------------------
  348.   # ● 初始化对象
  349.   #--------------------------------------------------------------------------
  350.   def initialize
  351.     super(0, 0)
  352.   end
  353.   #--------------------------------------------------------------------------
  354.   # ● 获取窗口的宽度
  355.   #--------------------------------------------------------------------------
  356.   def window_width
  357.     Graphics.width
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # ● 获取列数
  361.   #--------------------------------------------------------------------------
  362.   def col_max
  363.     return $game_party.cook_types_size
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● 更新画面
  367.   #--------------------------------------------------------------------------
  368.   def update
  369.     super
  370.     #@item_window.category = current_symbol if @item_window
  371.     @item_window.category = current_data[:name] if @item_window
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● 生成制造列表
  375.   #--------------------------------------------------------------------------
  376.   def make_command_list
  377.     $game_party.cook_types.each do |t|
  378.       add_command(t.name, t.index, t.enabled)
  379.     end
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # ● 设置制造列表窗口
  383.   #--------------------------------------------------------------------------
  384.   def item_window=(item_window)
  385.     @item_window = item_window
  386.     update
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● 更新帮助内容
  390.   #--------------------------------------------------------------------------
  391.   def update_help
  392.     @help_window.set_text($game_party.cook_type_description(current_data[:name]))
  393.   end
  394. end

  395. #==============================================================================
  396. # ■ Window_CookList
  397. #------------------------------------------------------------------------------
  398. #  任务画面中,显示已获得任务的窗口。
  399. #==============================================================================

  400. class Window_CookList < Window_Selectable
  401.   #--------------------------------------------------------------------------
  402.   # ● 定义实例变量
  403.   #--------------------------------------------------------------------------
  404.   attr_reader   :needs_window
  405.   #--------------------------------------------------------------------------
  406.   # ● 初始化对象
  407.   #--------------------------------------------------------------------------
  408.   def initialize(x, y, width, height)
  409.     super
  410.     @data = []
  411.     @category = $game_party.cook_types_size > 0 ? $game_party.cook_types[0].name : nil
  412.     refresh
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 设置分类
  416.   #--------------------------------------------------------------------------
  417.   def category=(category)
  418.     return if @category == category
  419.     @category = category
  420.     refresh
  421.     self.oy = 0
  422.   end
  423.   #--------------------------------------------------------------------------
  424.   # ● 设置材料窗口
  425.   #--------------------------------------------------------------------------
  426.   def needs_window=(needs_window)
  427.     @needs_window = needs_window
  428.     update
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ● 获取列数
  432.   #--------------------------------------------------------------------------
  433.   def col_max
  434.     return 1
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ● 获取项目数
  438.   #--------------------------------------------------------------------------
  439.   def item_max
  440.     @data ? @data.size : 1
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # ● 获取食谱
  444.   #--------------------------------------------------------------------------
  445.   def item
  446.     @data && index >= 0 ? @data[index] : nil
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # ● 获取选择食谱的有效状态
  450.   #--------------------------------------------------------------------------
  451.   def current_item_enabled?
  452.     enable?(@data[index])
  453.   end
  454.   #--------------------------------------------------------------------------
  455.   # ● 查询此食谱是否可用
  456.   #--------------------------------------------------------------------------
  457.   def enable?(item)
  458.     item.enabled && item.enough?
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # ● 生成食谱列表
  462.   #--------------------------------------------------------------------------
  463.   def make_item_list
  464.     @data = $game_party.cookbooks(@category)
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ● 返回上一个选择的位置
  468.   #--------------------------------------------------------------------------
  469.   def select_last
  470.     select(0)
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 绘制项目
  474.   #--------------------------------------------------------------------------
  475.   def draw_item(index)
  476.     item = @data[index]
  477.     if item
  478.       rect = item_rect(index)
  479.       rect.width -= 4
  480.       draw_item_name(item, rect.x, rect.y, enable?(item))
  481.     end
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # ● 绘制名称
  485.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  486.   #--------------------------------------------------------------------------
  487.   def draw_item_name(item, x, y, enabled = true, width = 300)
  488.     return unless item
  489.     text = item.name
  490.     text += "[材料不足]" if !item.enough?
  491.     change_color(normal_color, enabled)
  492.     draw_text(x, y, width, line_height, text)
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ● 更新帮助内容
  496.   #--------------------------------------------------------------------------
  497.   def update_help
  498.     @help_window.set_item(item)
  499.   end
  500.    #--------------------------------------------------------------------------
  501.   # ● 更新食谱清单
  502.   #--------------------------------------------------------------------------
  503.   def update_needslist
  504.     @needs_window.set_item(item)
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # ● 调用帮助窗口的更新方法
  508.   #--------------------------------------------------------------------------
  509.   def call_update_help
  510.     update_help if @help_window
  511.     update_needslist if @needs_window
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # ● 刷新
  515.   #--------------------------------------------------------------------------
  516.   def refresh
  517.     make_item_list
  518.     create_contents
  519.     draw_all_items
  520.   end
  521. end
  522. #==============================================================================
  523. # ■ Window_Description
  524. #------------------------------------------------------------------------------
  525. #  显示食谱的说明的窗口
  526. #==============================================================================

  527. class Window_Description < Window_Base
  528.   #--------------------------------------------------------------------------
  529.   # ● 初始化对象
  530.   #--------------------------------------------------------------------------
  531.   def initialize(x, y)
  532.     super(x, y, Graphics.width*0.5, fitting_height(4))
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # ● 设置内容
  536.   #--------------------------------------------------------------------------
  537.   def set_text(text)
  538.     if text != @text
  539.       @text = text
  540.       refresh
  541.     end
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ● 清除
  545.   #--------------------------------------------------------------------------
  546.   def clear
  547.     set_text("")
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● 设置食谱的介绍
  551.   #--------------------------------------------------------------------------
  552.   def set_item(item)
  553.     set_text(item ? item.description : "")
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● 刷新
  557.   #--------------------------------------------------------------------------
  558.   def refresh
  559.     contents.clear
  560.     draw_text_ex(4, 0, @text)
  561.   end
  562. end

  563. #==============================================================================
  564. # ■ Window_NeedsList
  565. #------------------------------------------------------------------------------
  566. #  制造画面中,显示食谱所需材料的窗口。
  567. #==============================================================================

  568. class Window_NeedsList < Window_Selectable
  569.   #--------------------------------------------------------------------------
  570.   # ● 初始化对象
  571.   #--------------------------------------------------------------------------
  572.   def initialize(x, y, width, height)
  573.     super
  574.     @category = :item
  575.     @cookbook = nil
  576.     @data = []
  577.     refresh
  578.   end
  579.   #--------------------------------------------------------------------------
  580.   # ● 获取列数
  581.   #--------------------------------------------------------------------------
  582.   def col_max
  583.     return 1
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ● 获取项目数
  587.   #--------------------------------------------------------------------------
  588.   def item_max
  589.     @data ? @data.size : 1
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # ● 获取物品
  593.   #--------------------------------------------------------------------------
  594.   def item
  595.     @data && index >= 0 ? @data[index] : nil
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ● 查询列表中是否含有此物品
  599.   #--------------------------------------------------------------------------
  600.   def include?(item)
  601.     item.is_a?(RPG::Item) && !item.key_item?
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # ● 获取选择食谱的有效状态
  605.   #--------------------------------------------------------------------------
  606.   def current_item_enabled?
  607.     enable?(@data[index])
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # ● 查询此食谱是否可用
  611.   #--------------------------------------------------------------------------
  612.   def enable?(item)
  613.     $game_party.usable?(item) && @cookbook.item_enough?(item)
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● 生成物品列表
  617.   #--------------------------------------------------------------------------
  618.   def make_item_list
  619.     @data = []
  620.     return if @cookbook== nil
  621.     tmp1 = []
  622.     tmp2 = []
  623.     $data_items.each do |item|
  624.       tmp1.push([item, 0]) if item && !item.name.empty? && @cookbook.resource?(item)
  625.       tmp2.push([item, 1]) if item && !item.name.empty? && @cookbook.output?(item)
  626.     end
  627.     if tmp1.size > 0 && tmp2.size > 0
  628.       @data.push(["需要材料:",0])
  629.       @data += tmp1
  630.       @data.push(["可以获得:",1])
  631.       @data += tmp2
  632.     end
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # ● 返回上一个选择的位置
  636.   #--------------------------------------------------------------------------
  637.   def select_last
  638.     select(0)
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # ● 绘制项目
  642.   #--------------------------------------------------------------------------
  643.   def draw_item(index)
  644.     item = @data[index]
  645.     if item
  646.       rect = item_rect(index)
  647.       rect.width -= 4
  648.       if item[0].is_a?(RPG::Item)
  649.         draw_item_name(item, rect.x, rect.y, enable?(item[0]))
  650.         draw_item_number(rect, item[0])
  651.       else
  652.         draw_input_output(item, rect.x, rect.y)
  653.       end
  654.     end
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 绘制物品名称
  658.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  659.   #--------------------------------------------------------------------------
  660.   def draw_item_name(item, x, y, enabled = true, width = 172)
  661.     return unless item
  662.     text = item[0].name + "*" + String(@cookbook.amount(item[0], item[1]))
  663.     draw_icon(item[0].icon_index, x, y, enabled)
  664.     change_color(normal_color, enable?(item[0]))
  665.     draw_text(x + 24, y, width, line_height, text)
  666.   end
  667.   #--------------------------------------------------------------------------
  668.   # ● 绘制输入和产出
  669.   #--------------------------------------------------------------------------
  670.   def draw_input_output(item, x, y, enabled = false, width = 172)
  671.     return unless item
  672.     if item[1] == 0
  673.       text = "[需要]"
  674.     else
  675.       text = "[可以获得]"
  676.     end
  677.     change_color(normal_color, @cookbook.enough?)
  678.     draw_text(x , y, width, line_height, text)
  679.   end
  680.   #--------------------------------------------------------------------------
  681.   # ● 绘制物品个数
  682.   #--------------------------------------------------------------------------
  683.   def draw_item_number(rect, item)
  684.     draw_text(rect, sprintf("现有%2d", $game_party.item_number(item)), 2)
  685.   end
  686.   #--------------------------------------------------------------------------
  687.   # ● 刷新
  688.   #--------------------------------------------------------------------------
  689.   def refresh
  690.     make_item_list
  691.     create_contents
  692.     draw_all_items
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 设置食谱的材料
  696.   #--------------------------------------------------------------------------
  697.   def set_item(item)
  698.     @cookbook = item
  699.     refresh
  700.   end
  701. end

  702. #==============================================================================
  703. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  704. #==============================================================================


  705. # add by Sion 2013.12.17
  706. # 作者修改了原范例的菜单,但是在原系统脚本里改的。
  707. # 整理出来写在这里, 不需要改菜单的同学把这些删掉就可以。
  708. class Scene_Menu
  709.   def command_cook
  710.     SceneManager.call(Scene_Cook)
  711.   end
  712.   alias_method :s20131217_create_command_window, :create_command_window
  713.   def create_command_window
  714.     s20131217_create_command_window
  715.     @command_window.set_handler(:cook, method(:command_cook))
  716.   end
  717. end
  718. class Window_MenuCommand
  719.   alias_method :s20131217_add_main_commands, :add_main_commands
  720.   def add_main_commands
  721.     s20131217_add_main_commands
  722.     add_command("制造",   :cook,   main_commands_enabled)
  723.   end
  724. end
复制代码
物品制造系统V0.1_by_asd11000(Fixed.rar (1.57 MB, 下载次数: 0)

945127391 数字君 的 【渣作品】RGSS3教程(二) 菜单的美化
  1. class Window_NewMenuStatus < Window_Command
  2. #----------------------------------------------------------------------------
  3. # * 初始化
  4. #----------------------------------------------------------------------------
  5. def initialize
  6. super(160, 0)
  7. end
  8. #----------------------------------------------------------------------------
  9. # * 获取窗口的宽度
  10. #----------------------------------------------------------------------------
  11. def window_width
  12. return 384
  13. end
  14. #----------------------------------------------------------------------------
  15. # * 获取窗口的高度
  16. #----------------------------------------------------------------------------
  17. def window_height
  18. return 416
  19. end
  20. #----------------------------------------------------------------------------
  21. # * 更新内容
  22. #----------------------------------------------------------------------------
  23. def refresh
  24. super
  25. draw_actor_status
  26. end
  27. #----------------------------------------------------------------------------
  28. # * 生成指令列表
  29. #----------------------------------------------------------------------------
  30. def make_command_list
  31. for actor in $game_party.members
  32. s = "a[#{actor.id}]"
  33. add_command(actor.name, s.to_sym, !actor.death_state?, actor.id)
  34. end
  35. end
  36. #----------------------------------------------------------------------------
  37. # * 描绘选项
  38. #----------------------------------------------------------------------------
  39. def draw_item(index)
  40. rect = item_rect_for_text(index)
  41. b = Bitmap.new(rect.width, rect.height)
  42. cn = $game_actors[@list[index][:ext]].character_name
  43. ci = $game_actors[@list[index][:ext]].character_index
  44. cb = Cache.character(cn)
  45. if cn[0] == "[ DISCUZ_CODE_84 ]quot;
  46. cr = Rect.new
  47. cr.x = cb.width / 3
  48. cr.width = cb.width / 3
  49. cr.height = cb.height / 4
  50. else
  51. cr = Rect.new
  52. cr.x = ci % 4 * (cb.width / 4) + cb.width / 12
  53. cr.y = ci / 4 * (cb.height / 2)
  54. cr.width = cb.width / 12
  55. cr.height = cb.height / 8
  56. end
  57. b.blt((b.width - cr.width) / 2, (b.height - cr.height) / 2, cb, cr)
  58. unless command_enabled?(index)
  59. for y in 0...b.height
  60. for x in 0...b.width
  61. next if b.get_pixel(x, y).alpha == 0
  62. c = b.get_pixel(x, y)
  63. m = (c.red + c.green + c.blue) / 3
  64. b.set_pixel(x, y, Color.new(m, m, m, c.alpha))
  65. end
  66. end
  67. end
  68. self.contents.blt(rect.x, rect.y, b, b.rect)
  69. b.dispose
  70. cb.dispose
  71. end
  72. #----------------------------------------------------------------------------
  73. # * 获取项目的绘制矩形
  74. #----------------------------------------------------------------------------
  75. def item_rect(index)
  76. rect = Rect.new
  77. rect.width = self.contents.width / 4
  78. rect.height = 48
  79. rect.x = (index < 4 ? index * rect.width : (index - 4) * rect.width)
  80. rect.y = (index < 4 ? 0 : self.contents.height - rect.height)
  81. return rect
  82. end
  83. #----------------------------------------------------------------------------
  84. # * 描绘角色的状态
  85. #----------------------------------------------------------------------------
  86. def draw_actor_status
  87. actor = $game_actors[@list[@index][:ext]]
  88. y = item_rect_for_text(0).height + 5
  89. h = self.contents.height - 2 * (item_rect_for_text(0).height + 5)
  90. self.contents.clear_rect(Rect.new(0, y, self.contents.width, h))
  91. draw_actor_face(actor, 0, y)
  92. draw_actor_name(actor, 0, y)
  93. draw_actor_level(actor, 96, y)
  94. draw_actor_nickname(actor, 168, y)
  95. draw_actor_hp(actor, 96, y + line_height, self.contents.width - 96)
  96. draw_actor_mp(actor, 96, y + 2 * line_height, self.contents.width - 96)
  97. draw_actor_icons(actor, 96, y + 3 * line_height)
  98. for i in 0...6
  99. draw_actor_param(actor, 0, y + (4 + i) * line_height, i)
  100. end
  101. for i in 0...5
  102. draw_item_name(actor.equips[i], self.contents.width / 2, y + (4 + i) * line_height) if actor.equips[i] != nil
  103. end
  104. end
  105. #----------------------------------------------------------------------------
  106. # * 选择项目
  107. #----------------------------------------------------------------------------
  108. def select(index)
  109. super
  110. draw_actor_status
  111. end
  112. end
复制代码

点评

你这是?  发表于 2014-8-16 15:02
神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦神烦

百合控

梦石
0
星屑
6548
在线时间
1275 小时
注册时间
2013-8-21
回帖
3522

开拓者

发表于 2014-8-16 15:05:18 | 显示全部楼层
添加什么系统……你是说选项吗?

脚本27-35行:
  1. #----------------------------------------------------------------------------
  2. # * 生成指令列表
  3. #----------------------------------------------------------------------------
  4. def make_command_list
  5. for actor in $game_party.members
  6. s = "a[#{actor.id}]"
  7. add_command(actor.name, s.to_sym, !actor.death_state?, actor.id)
  8. end
  9. end
复制代码
在【end】和【end】中间加就可以了

点评

你给的信息不全 第二个脚本(就是菜单那个)不完整  发表于 2014-8-17 12:10
因为刚才有特殊情况,所以来不及编辑,添加制造**这个脚本  发表于 2014-8-16 19:12
不好意思,再再麻烦你,我编辑了...我想要添加 ’制造物品‘ 的脚本 选项  发表于 2014-8-16 19:10
萌新瑟瑟发抖
看到我请叫我去干活
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部