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

Project1

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

[已经解决] 请问这个脚本错误该怎么解决

[复制链接]

Lv1.梦旅人

梦石
0
星屑
160
在线时间
20 小时
注册时间
2021-11-16
帖子
15
跳转到指定楼层
1
发表于 2023-12-26 16:28:49 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
修改过游戏的分辨率,用的是物品制造的脚本,但是打开合成窗口就会跳出错误,请问怎么解决 orz

屏幕截图 2023-12-26 162731.png (29 KB, 下载次数: 14)

屏幕截图 2023-12-26 162731.png

Lv2.观梦者

梦石
0
星屑
465
在线时间
915 小时
注册时间
2011-5-11
帖子
438
2
发表于 2023-12-26 21:26:24 | 只看该作者
没看到脚本没法评论
http://rpg.blue/static/image/smiley/yct/A059.gif中国字认识都不到一半,哪的心情学英语呀!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
160
在线时间
20 小时
注册时间
2021-11-16
帖子
15
3
 楼主| 发表于 2023-12-27 18:39:58 | 只看该作者
  1. #打开脚本编辑器,将“物品制造1”“物品制造2”脚本插入到main上。
  2. #encoding:utf-8
  3. #==============================================================================
  4. # 本腳本來自www.66RPG.com,使用和轉載請保留此信息
  5. #==============================================================================
  6. #==============================================================================
  7. #使用说明:
  8. #每添加一个制造的类型,最上面的类别菜单就会多一项。
  9. #
  10. #添加类型的方法是运行:
  11. #$game_party.add_cook_type("合成","合成药品", true)
  12. #$game_party.add_cook_type("烹饪","烹饪食物", true)
  13. #
  14. #添加配方的方法:
  15. #$game_party.add_cookbook(配方名称, 配方介绍, 配方类别名称,材料的二维数组,产出物的二维数组,配方状态)
  16. #
  17. #举例:
  18. #$game_party.add_cookbook("初级补血药水", "制作初级补血药水", "制药",[[18,2]],[[1,1]],true)
  19. #
  20. #调用窗口的方法:SceneManager.call(Scene_Cook)
  21. #
  22. #
  23. #==============================================================================

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

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

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

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

  134. #==============================================================================
  135. # ■ Game_Party
  136. #==============================================================================

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

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

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


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

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

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

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

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

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

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

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


  704. # add by Sion 2013.12.17
  705. # 作者修改了原范例的菜单,但是在原系统脚本里改的。
  706. # 整理出来写在这里, 不需要改菜单的同学把这些删掉就可以。
  707. class Scene_Menu
  708.   def command_cook
  709.     SceneManager.call(Scene_Cook)
  710.   end
  711.   alias_method :s20131217_create_command_window, :create_command_window
  712.   def create_command_window
  713.     s20131217_create_command_window
  714.     @command_window.set_handler(:cook, method(:command_cook))
  715.   end
  716. end
  717. class Window_MenuCommand
  718.   alias_method :s20131217_add_main_commands, :add_main_commands
  719.   def add_main_commands
  720.     s20131217_add_main_commands
  721.     add_command("合成",   :cook,   main_commands_enabled)
  722.   end
  723. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
160
在线时间
20 小时
注册时间
2021-11-16
帖子
15
4
 楼主| 发表于 2023-12-27 18:46:14 | 只看该作者
345912390 发表于 2023-12-26 21:26
没看到脚本没法评论
  1. class Game_Party < Game_Unit
  2.   #--------------------------------------------------------------------------
  3.   # ● 添加新的制造类型
  4.   #--------------------------------------------------------------------------
  5.   def add_cook_type(n, d, en)
  6.     cook_types.push(Cookbook_Type.new(cook_types.size, n, d, en)) if !have_cook_type?(n)
  7.   end
  8.   #--------------------------------------------------------------------------
  9.   # ● 添加新的食谱
  10.   #--------------------------------------------------------------------------
  11.   def add_cookbook(n, d, type, input, output, en)
  12.     if !have_cookbook?(n) && have_cook_type?(type)
  13.       cookbooks.push(Cookbook.new(cookbooks.size, n, d, type, input, output, en))
  14.     end
  15.   end
  16.   #--------------------------------------------------------------------------
  17.   # ● 判断名称为n的制造类型是否存在
  18.   #--------------------------------------------------------------------------
  19.   def have_cook_type?(n)
  20.     cook_types.each do |x|
  21.       return true if x.name == n
  22.     end
  23.     return false
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 判断名称为n的食谱是否存在
  27.   #--------------------------------------------------------------------------
  28.   def have_cookbook?(n)
  29.     cookbooks.each do |x|
  30.       return true if x.name == n
  31.     end
  32.     return false
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● 返回制造类型列表
  36.   #--------------------------------------------------------------------------
  37.   def cook_types
  38.     @cook_types = [] if @cook_types.nil?
  39.     return @cook_types
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 返回食谱列表
  43.   #--------------------------------------------------------------------------
  44.   def cookbooks(type = nil)
  45.     @cookbooks = [] if @cookbooks.nil?
  46.     return @cookbooks if type == nil
  47.     arr = []
  48.     @cookbooks.each do |x|
  49.       arr.push(x) if x.type == type
  50.     end
  51.     return arr
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 更改序号为i的制造类型的使用状态
  55.   #--------------------------------------------------------------------------
  56.   def set_cook_type(i, en)
  57.     cook_types[i].enable(en)
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 更改序号为i的食谱的使用状态
  61.   #--------------------------------------------------------------------------
  62.   def set_cookbook(i, en)
  63.     cookbooks[i].enable(en)
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 返回制造类型数目
  67.   #--------------------------------------------------------------------------
  68.   def cook_types_size
  69.     return cook_types.size
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 查询名称为n的制造类型的描述
  73.   #--------------------------------------------------------------------------
  74.   def cook_type_description(n)
  75.     cook_types.each do |x|
  76.       return x.description if x.name == n
  77.     end
  78.     return ""
  79.   end
  80. end
复制代码

点评

这个合成脚本在我这没出现问题  发表于 2023-12-27 21:21
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
160
在线时间
20 小时
注册时间
2021-11-16
帖子
15
5
 楼主| 发表于 2023-12-28 13:44:51 | 只看该作者

我是进游戏点击合成的时候会弹出错误
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5680
在线时间
782 小时
注册时间
2019-1-20
帖子
191
6
发表于 2023-12-30 11:14:24 | 只看该作者
不会画梨 发表于 2023-12-28 13:44
我是进游戏点击合成的时候会弹出错误

得先使用 添加种类 和 添加对应配方 至少一次,
之后才能正常使用 SceneManager.call(Scene_Cook)

要是直接照搬说明里面的脚本,
就会缺少配方报错,
也会因缺少数据库物品18无法正常使用

$game_party.add_cook_type("制药","合成药品", true)
$game_party.add_cookbook("初级补血药水", "制作初级补血药水", "制药",[[8,2]],[[1,1]],true)
SceneManager.call(Scene_Cook)

提高解答机会的方法:
看一下对应版本的帮助文件 看天气预报说今天不下雨
改变问题为更有可能的或常见的 如:天气自动变化下雨→天气系统 果然不准呀~
使用论坛的搜索功能查找相关问题 好丧啊... ...想看女装
清楚说明实际上你想解决的问题  想看坛友的女装  
脚本自己有改过的地方要标明  不要遮脸的
脚本有问题但不是默认的要全部贴出来 大胆点,尽情发
三包原则:包有BUG,包甩锅,包咕咕
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
160
在线时间
20 小时
注册时间
2021-11-16
帖子
15
7
 楼主| 发表于 2023-12-30 23:32:22 | 只看该作者
srwjrevenger 发表于 2023-12-30 11:14
得先使用 添加种类 和 添加对应配方 至少一次,
之后才能正常使用 SceneManager.call(Scene_Cook)

谢谢大佬!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
160
在线时间
20 小时
注册时间
2021-11-16
帖子
15
8
 楼主| 发表于 2023-12-30 23:41:15 | 只看该作者
srwjrevenger 发表于 2023-12-30 11:14
得先使用 添加种类 和 添加对应配方 至少一次,
之后才能正常使用 SceneManager.call(Scene_Cook)

请问这添加配方的代码添加到那一段代码后面
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
160
在线时间
20 小时
注册时间
2021-11-16
帖子
15
9
 楼主| 发表于 2023-12-31 00:42:56 | 只看该作者
srwjrevenger 发表于 2023-12-30 11:14
得先使用 添加种类 和 添加对应配方 至少一次,
之后才能正常使用 SceneManager.call(Scene_Cook)

找到原帖范例了 感谢!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 11:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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