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

Project1

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

[已经解决] 求一个物品合成系统

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
206 小时
注册时间
2014-2-8
帖子
396
跳转到指定楼层
1
发表于 2014-3-8 18:52:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
不知道为什么,连续翻了3个合成脚本都出错了,于是想求给个合成脚本
刚接触RPG的新人们裤艾来这里!在这里能够帮助你们提高自身的能力,让大家来帮助每个人实现自己的创意、构想!
也许你只是正在看RPG教程的新人,或者是正在努力学着制作自己的RPG的制作者,或者是狂热的RPG游戏喜爱者,
但都不重要!
加入我们,我们会帮助你实现梦想,或者帮助你更好的运用RPG并且创造个人的一片天地!周末我们会不定时间开放RM技术讨论活动或者RM经验交流课!
加入我们,我们愿意与你共同创造奇迹,共同进步!
QQ群号:329443038  
或者联系QQ:573932914
我们和你站在同一线!
要求只有:常能上线
我们会用十分的热情接纳你!

Lv1.梦旅人

梦石
0
星屑
50
在线时间
206 小时
注册时间
2014-2-8
帖子
396
2
 楼主| 发表于 2014-3-8 23:33:15 | 只看该作者
DDDDDDDDDDDDD
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1784
在线时间
951 小时
注册时间
2012-7-5
帖子
245
3
发表于 2014-3-10 15:08:21 | 只看该作者
果断用事件吧。。。
比如说
有 两个二分之一的的某道具
去找某NPC,事件--条件分歧判断是否拥有足够的材料什么的
有就删除这两个物品
再获得合成后的物品{:2_285:}

评分

参与人数 1星屑 +40 收起 理由
天地有正气 + 40 塞糖

查看全部评分

tan(pi/2)
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
206 小时
注册时间
2014-2-8
帖子
396
4
 楼主| 发表于 2014-3-11 12:18:15 | 只看该作者
浮云半仙 发表于 2014-3-10 15:08
果断用事件吧。。。
比如说
有 两个二分之一的的某道具

太简单了点暗暗啊暗暗啊= -
刚接触RPG的新人们裤艾来这里!在这里能够帮助你们提高自身的能力,让大家来帮助每个人实现自己的创意、构想!
也许你只是正在看RPG教程的新人,或者是正在努力学着制作自己的RPG的制作者,或者是狂热的RPG游戏喜爱者,
但都不重要!
加入我们,我们会帮助你实现梦想,或者帮助你更好的运用RPG并且创造个人的一片天地!周末我们会不定时间开放RM技术讨论活动或者RM经验交流课!
加入我们,我们愿意与你共同创造奇迹,共同进步!
QQ群号:329443038  
或者联系QQ:573932914
我们和你站在同一线!
要求只有:常能上线
我们会用十分的热情接纳你!
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
381
在线时间
238 小时
注册时间
2013-8-20
帖子
496
5
发表于 2014-3-11 12:30:02 | 只看该作者
主站内的合成脚本不会出现呀
请重新进入游戏后再操作

评分

参与人数 1星屑 +40 收起 理由
天地有正气 + 40 塞糖

查看全部评分

不定期回来6R玩。
下方广告帖,欢迎点击
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
6
发表于 2014-3-11 21:43:34 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. # 欢迎访问www.66RPG.com
  4. # 梦想世界,在你手中
  5. #==============================================================================  
  6. #
  7. # Sample master list for crafting script (物品分类增强版) v1.1
  8. # written by Deke
  9. # 增强:叶子
  10. #
  11. # 12-30-2005 v1.0
  12. # 8-17-2006 v1.1
  13. # 修正了返回界面时不显示成品的BUG
  14. # 修正了材料大于8个不显示的BUG
  15. # 描绘物品美化
  16. # 自动检测能否合成
  17. #============================================================================================
  18. # 简介:
  19. # 这是一个很不错的合成物品系统,可以通过游戏的过程,不断学习可以合成的
  20. # 物品方法。
  21. # ------
  22. # 增强版补充说明:
  23. # 在这个增强版中,可以对成品进行手动分类。
  24. # 成品增加了一个分类属性。
  25. # 这个分类纯粹是按自己的意愿,没有规定第几类必须是什么。
  26. # 召唤特定分类的界面,就只会看到特定分类的成品。
  27. #
  28. # 例如:
  29. # 使用脚本$scene = Scene_Craft.new(1),
  30. # 出来的界面就只会显示成品分类为1的东西
  31. # 同样道理,使用脚本$scene = Scene_Craft.new(2),
  32. # 出来的界面就只会显示成品分类为2的东西
  33. #
  34. # 如果使用脚本$scene = Scene_Craft.new或$scene = Scene_Craft.new(0)来召唤界面
  35. # 就可以看到所有成品。
  36. #
  37. # 注意:不要弄混淆“成品种类”和“成品分类”
  38. # 成品种类是指成品是普通物品(0),防具(1)或武器(2)
  39. # 成品分类是指此物品的自定义分类
  40. #
  41. #
  42. # 使用方法:
  43. # 1、召唤界面:使用脚本$scene = Scene_Craft.new(分类的数字)
  44. # 例如:使用脚本$scene = Scene_Craft.new(1),出来分类1的界面
  45. #
  46. # 2、学习合成:$game_party.learn_recipe(合成项目)
  47. #
  48. #  2.1、其实这个脚本可以使同一成品有不同配方
  49. #
  50. #    就这样说可能解释得不清楚,先来解释一下脚本学习配方的原理:
  51. #    $game_party.learn_recipe(合成项目)的处理过程并不是直接学习这个配方,
  52. #    而是在配方库中找到和合成项目成品相同的配方。
  53. #
  54. #    如果配方库中有两个配方成品相同的话,配方版本就变得重要。
  55. #    $game_party.learn_recipe(合成项目,配方版本)
  56. #    配方版本为1的话,学到的配方就是@recipe_list[xx]中与合成项目成品相同且数字最小的配方
  57. #    配方版本为2的话,学到的配方就是数字第二小的配方
  58. #    在上面这个脚本语句中,不填配方版本的话就默认为1
  59. #
  60. #  2.2、忘记配方:$game_party.forget_recipe(合成项目)
  61. #   2.21、同样道理,这个语句也可以写配方版本
  62. #    $game_party.forget_recipe(合成项目,配方版本)
  63. #    配方版本定义见2.1
  64. #
  65. #  2.3、配方版本不能乱填!例如游戏中某一个配方的成品是唯一的,与所有其它配方的成品都不相同
  66. #   那么学习的时候就不用填配方版本。
  67. #   如果这时在配方版本填了2的话,就有可能学不到或者忘不了(-_-||)
  68. #   
  69. #
  70. # 3、合成定义:
  71. # 这个合成脚本可以定义两种合成物品。一种是预先定义好了的,就像下面这样,
  72. # 直接写在这里就可以,另一种是在学习之前现场定义。
  73. #
  74. # 4、举例
  75. #  4.1、学会recipe_list[1]定义的合成:$game_party.learn_recipe($game_temp.recipe_list[1])
  76. #       注意,一行如果输入不下,在(的后面或[的后面按回车换行,否则可能出错
  77. #
  78. #  4.2、在游戏中临时定义一种合成,让玩家学会。使用事件中的脚本如下,   
  79. #  脚本:
  80. #    材料 = [$game_variables[1],$game_variables[2]]  #——材料编号是变量1、2的编号
  81. #    材料种类 = [0,0]                                #——材料是物品
  82. #    材料数量 = [$game_variables[3],$game_variables[4]]  #——需要材料数量是变量3、4的编号
  83. #    成品 = $game_variables[5]                       #——获得结果编号是5
  84. #    成品种类 = 1                                    #——成品是防具类
  85. #    成品分类 = 1                                    #——这一项不写的话默认为0
  86. #    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类,成品分类))
  87. #    上面这条语句的成品分类这一项不写也行,这样它就默认为0了。
  88. #    (也就是此物品没有分类,不会在分类菜单中出现)
  89. #    省略成品分类的脚本语句可以像下面这样写:
  90. #    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类))
  91. #
  92. #===========================================================================================
  93. class Game_Temp
  94.   attr_reader :recipe_list  
  95.   alias crafting_temp_initialize initialize
  96.   def initialize
  97.     crafting_temp_initialize
  98.     @recipe_list=[]
  99.     get_recipe_list
  100.   end  
  101.   def get_recipe_list   
  102.     ##########################################################################
  103.     # 1 号合成物品设定 (物品小药水×2 + 中药水 = 大药水) 成品分类:1
  104.     ##########################################################################
  105.     材料 = [1, 2]             # 需要材料的数据库编号
  106.     材料种类 = [0, 0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  107.     材料数量 = [2, 1]         # 需要材料的数量
  108.     成品 = 3                  # 获得物品编号
  109.     成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
  110.     成品分类 = 1              # 获得成品分类
  111.     @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  112.    
  113.     ##########################################################################
  114.     # 2 号合成物品设定 (武器铜剑3、铁剑2、钢剑1 = 密切斯特剑) 成品分类:2
  115.     ##########################################################################
  116.     材料 = [1, 2, 3]          # 需要材料的数据库编号
  117.     材料种类 = [2, 2, 2]      # 需要材料的种类,0是普通物品,1是防具,2是武器
  118.     材料数量 = [3, 2, 1]      # 需要材料的数量
  119.     成品 = 4                  # 获得物品编号
  120.     成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
  121.     成品分类 = 2              # 获得成品分类
  122.     @recipe_list[2] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  123.    
  124.     ##########################################################################
  125.     # 3 号合成物品设定 (物品力量之石×2 + 防具钢盾×1 = 密切斯特盾) 成品分类:3
  126.     ##########################################################################
  127.     材料 = [13, 3]            # 需要材料的数据库编号
  128.     材料种类 = [0, 1]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  129.     材料数量 = [2, 1]         # 需要材料的数量
  130.     成品 = 4                  # 获得物品编号
  131.     成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
  132.     成品分类 = 3              # 获得成品分类
  133.     @recipe_list[3] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  134.    
  135.     ##########################################################################
  136.     # 4 号合成物品设定 (生命之种×2 + 香水×1 = 完全滋补液) 成品分类:3
  137.     ##########################################################################
  138.     材料 = [17, 4]            # 需要材料的数据库编号
  139.     材料种类 = [0, 0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  140.     材料数量 = [2, 1]         # 需要材料的数量
  141.     成品 = 10                  # 获得物品编号
  142.     成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
  143.     成品分类 = 3              # 获得成品分类
  144.     @recipe_list[4] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  145.     ##########################################################################
  146.     # 5 号合成物品设定 成品分类:3
  147.     ##########################################################################
  148.     材料 = [1,2,3,4,5,6,7,8,9,10]            # 需要材料的数据库编号
  149.     材料种类 = [0,0,0,0,0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  150.     材料数量 = [1,1,1,1,1,1,1,1,1,1]         # 需要材料的数量
  151.     成品 = 28                  # 获得物品编号
  152.     成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
  153.     成品分类 = 3              # 获得成品分类
  154.     @recipe_list[5] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  155.     ##########################################################################
  156.     # 6 号合成物品设定 成品分类:3
  157.     ##########################################################################
  158.     材料 = [1,2,3,4,5,6,7,8,9,10]            # 需要材料的数据库编号
  159.     材料种类 = [0,0,0,0,0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  160.     材料数量 = [1,1,1,1,1,1,1,1,1,1]         # 需要材料的数量
  161.     成品 = 28                  # 获得物品编号
  162.     成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
  163.     成品分类 = 3              # 获得成品分类
  164.     @recipe_list[6] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  165.     ##########################################################################
  166.     # 7 号合成物品设定 成品分类:3
  167.     ##########################################################################
  168.     材料 = [1,2,3,4,5,6,7,8,9,10]            # 需要材料的数据库编号
  169.     材料种类 = [0,0,0,0,0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  170.     材料数量 = [1,1,1,1,1,1,1,1,1,1]         # 需要材料的数量
  171.     成品 = 28                  # 获得物品编号
  172.     成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
  173.     成品分类 = 3              # 获得成品分类
  174.     @recipe_list[7] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  175.     ##########################################################################
  176.     # 8 号合成物品设定 成品分类:3
  177.     ##########################################################################
  178.     材料 = [1,2,3,4,5,6,7,8,9,10]            # 需要材料的数据库编号
  179.     材料种类 = [0,0,0,0,0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  180.     材料数量 = [1,1,1,1,1,1,1,1,1,1]         # 需要材料的数量
  181.     成品 = 28                  # 获得物品编号
  182.     成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
  183.     成品分类 = 3              # 获得成品分类
  184.     @recipe_list[8] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  185.   
  186.     end # of get_recipe_list method
  187. end # of updates to Game_Temp Class

  188. #================================
  189. # CRAFTING PROGRAM
  190. #----------------------------------------------------------------
  191. #-written by Deke
  192. #-yes_no window code created by Phsylomortis
  193. #----------------------------------------------------------------
  194. #================================

  195. #updates to Game_Party class

  196. class Game_Party
  197.   
  198.   attr_accessor       :recipes
  199.   
  200.   alias crafting_party_initialize initialize
  201.   
  202.   def initialize
  203.     crafting_party_initialize
  204.     @recipes=[]
  205.   end
  206.   
  207.   #----------------------------------------------------------------------
  208.   def know?(recipe, version = 1)
  209.     unless recipe.is_a?(Game_Recipe)
  210.       recipe = get_recipe_from_master_list(recipe, version)
  211.     end
  212.     return $game_party.recipes.include?(recipe)
  213.   end
  214.   
  215. #----------------------------------------------------------------------
  216.   def learn_recipe(recipe , version = 1)
  217.     unless recipe.is_a?(Game_Recipe)
  218.       recipe = get_recipe_from_master_list(recipe, version)
  219.     end
  220.     if recipe.is_a?(Game_Recipe)
  221.       unless know?(recipe)
  222.         @recipes.push(recipe)
  223.       end
  224.     end
  225.   end
  226.   
  227. #----------------------------------------------------------------------
  228.   def forget_recipe(recipe , version = 1)
  229.     if !recipe.is_a?(Game_Recipe)
  230.       recipe = get_recipe_from_master_list(recipe, version)
  231.     end
  232.     if recipe.is_a?(Game_Recipe)
  233.       for i in [email protected]
  234.         if recipe == @recipes[i]
  235.           index = i
  236.           break
  237.         end
  238.       end
  239.       if index != nil
  240.         @recipes.delete(@recipes[index])
  241.       end
  242.     end
  243.   end
  244.   
  245. #----------------------------------------------------------------------
  246.   def get_recipe_from_master_list(item, version)
  247.     index = nil
  248.     for i in 0...$game_temp.recipe_list.size
  249.       if item[0] == $game_temp.recipe_list[i].result and item[1] ==$game_temp.recipe_list[i].result_type
  250.         version -= 1
  251.         if version == 0
  252.           index = i
  253.           break
  254.         end
  255.       end
  256.     end
  257.     if index.is_a?(Integer)
  258.       return ($game_temp.recipe_list[index])
  259.     else
  260.       return false
  261.     end
  262.   end
  263.   
  264. end # of Game_Party updates

  265. #================================
  266. class Game_Recipe

  267.   attr_reader :ingredients
  268.   attr_reader :quantities
  269.   attr_reader :result
  270.   attr_reader :result_type
  271.   attr_reader :ingredient_types
  272.   attr_reader :craft_type  #物品分类
  273.   
  274. #----------------------------------------------------------------------
  275.   def initialize( ingredients, ingredient_types, quantities, result, result_type, craft_type=0)
  276.     @ingredients = ingredients
  277.     @ingredient_types = ingredient_types
  278.     @quantities = quantities
  279.     @result = result
  280.     @result_type = result_type
  281.     @craft_type = craft_type
  282.   end
  283.   
  284. #----------------------------------------------------------------------
  285.   def name
  286.     case @result_type
  287.       when 0
  288.         name = $data_items[@result].name
  289.       when 1
  290.         name = $data_armors[@result].name
  291.       when 2
  292.         name = $data_weapons[@result].name
  293.     end
  294.     return name
  295.   end
  296.   
  297. #----------------------------------------------------------------------

  298.   def item
  299.     case @result_type
  300.       when 0
  301.         item = $data_items[@result]
  302.       when 1
  303.         item = $data_armors[@result]
  304.       when 2
  305.         item = $data_weapons[@result]
  306.     end
  307.     return item
  308.   end

  309. #----------------------------------------------------------------------
  310.   def have
  311.     have_all = true
  312.     for i in [email protected]
  313.       case @ingredient_types[i]
  314.         when 0
  315.           if $game_party.item_number(@ingredients[i]) < @quantities[i]
  316.             have_all=false
  317.           end
  318.         when 1
  319.           if $game_party.armor_number(@ingredients[i]) < @quantities[i]
  320.             have_all=false
  321.           end
  322.         when 2
  323.           if $game_party.weapon_number(@ingredients[i]) < @quantities[i]
  324.             have_all=false
  325.           end
  326.       end
  327.     end
  328.     return have_all
  329.   end

  330. #----------------------------------------------------------------------
  331.   def decrement
  332.     for i in [email protected]
  333.       case @ingredient_types[i]
  334.       when 0
  335.         $game_party.lose_item(@ingredients[i], @quantities[i])
  336.       when 1
  337.         $game_party.lose_armor(@ingredients[i], @quantities[i])
  338.       when 2
  339.         $game_party.lose_weapon(@ingredients[i], @quantities[i])
  340.       end
  341.     end
  342.   end

  343. #----------------------------------------------------------------------
  344.   def make
  345.     if have
  346.       case @result_type
  347.       when 0
  348.         $game_party.gain_item(@result, 1)
  349.       when 1
  350.         $game_party.gain_armor(@result, 1)
  351.       when 2
  352.         $game_party.gain_weapon(@result, 1)
  353.       end
  354.       decrement
  355.     end
  356.   end
  357.   
  358. #----------------------------------------------------------------------
  359.   def == (recipe)
  360.     if recipe.is_a?(Game_Recipe)
  361.       equal = true
  362.       if recipe.ingredients != self.ingredients
  363.         equal = false
  364.       end
  365.       if recipe.ingredient_types != self.ingredient_types
  366.         equal = false
  367.       end
  368.       if recipe.quantities != self.quantities
  369.         equal = false
  370.       end
  371.       if recipe.result != self.result
  372.         equal=false
  373.       end
  374.       if recipe.result_type != self.result_type
  375.         equal = false
  376.       end
  377.     else
  378.       equal = false
  379.     end
  380.     return equal
  381.   end
  382.   
  383. end # of Game_Recipe class

  384. #===================================

  385. class Window_Craft < Window_Selectable
  386.   attr_reader :data #声明数据
  387.   #--------------------------------------------------------------------------
  388.   def initialize(craft_type=0)
  389.     @craft_type = craft_type
  390.     super(0, 64, 240, 416)
  391.     @column_max = 1
  392.     refresh
  393.     self.index = 0
  394.   end

  395.   #--------------------------------------------------------------------------
  396.   def recipe
  397.     return @data[self.index]
  398.   end

  399.   #--------------------------------------------------------------------------
  400.   def refresh
  401.     if self.contents != nil
  402.       self.contents.dispose
  403.       self.contents = nil
  404.     end
  405.     @data = []
  406.     for i in 0...$game_party.recipes.size
  407.        #@craft_type为0时就显示全部物品
  408.        #不为0时就显示对应物品
  409.       if @craft_type == 0
  410.         @data.push($game_party.recipes[i])
  411.       elsif $game_party.recipes[i].craft_type == @craft_type
  412.         @data.push($game_party.recipes[i])
  413.       end
  414.     end
  415.     @item_max = @data.size
  416.     if @item_max > 0
  417.       self.contents = Bitmap.new(width - 32, row_max * 32)
  418.       self.contents.font.name = "黑体" # = "黑体"
  419.       self.contents.font.size = 18 # = 18
  420.       for i in 0...@item_max
  421.         x = 16
  422.         y = i * 32
  423.         able = true
  424.         for ingredient in 0...@data[i].ingredients.size
  425.           case @data[i].ingredient_types[ingredient]
  426.           when 0
  427.             count = $game_party.item_number(@data[i].ingredients[ingredient])
  428.           when 1
  429.             count = $game_party.armor_number(@data[i].ingredients[ingredient])
  430.           when 2
  431.             count = $game_party.weapon_number(@data[i].ingredients[ingredient])
  432.           end
  433.           if count < @data[i].quantities[ingredient]
  434.             able = false
  435.             break
  436.           end
  437.         end
  438.         draw_item_name(@data[i].item, x, y, able)
  439.       end
  440.     end
  441.   end

  442.   #--------------------------------------------------------------------------
  443.   #def draw_item(index)
  444.   #  recipe = @data[index]
  445.   #  self.contents.font.color = recipe.have ? normal_color : disabled_color
  446.   #  x = 16
  447.   #  y = index * 32
  448.   #  self.contents.draw_text(x , y, self.width-32, 32, recipe.name, 0)
  449.   #end
  450.   
  451.   #--------------------------------------------------------------------------
  452.   # ● 描绘物品名
  453.   #     item : 物品
  454.   #     x    : 描画目标 X 坐标
  455.   #     y    : 描画目标 Y 坐标
  456.   #--------------------------------------------------------------------------
  457.   def draw_item_name(item, x, y, able = true)
  458.     if item == nil
  459.       return
  460.     end
  461.     if !able
  462.       self.contents.font.color = disabled_color
  463.     end
  464.     bitmap = RPG::Cache.icon(item.icon_name)
  465.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  466.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  467.     self.contents.font.color = normal_color
  468.   end
  469.   
  470.   #--------------------------------------------------------------------------
  471.   def update_help
  472.     current_recipe = recipe
  473.     if current_recipe.is_a?(Game_Recipe)
  474.     case current_recipe.result_type
  475.       when 0
  476.         description = $data_items[current_recipe.result].description
  477.       when 1
  478.         description = $data_armors[current_recipe.result].description
  479.       when 2
  480.         description = $data_weapons[current_recipe.result].description
  481.       end
  482.     else
  483.       description = ""
  484.     end
  485.     @help_window.set_text(description)
  486.     @help_window.update
  487.   end
  488.   
  489. end # of Window_Craft

  490. #=======================================
  491. class Window_CraftResult < Window_Base

  492.   #--------------------------------------------------------------------------
  493.   def initialize
  494.     super(240, 64, 400, 184)
  495.     self.contents = Bitmap.new(width - 32, height - 32)
  496.     self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
  497.     self.contents.font.size = 18 # = 20
  498.     @result = nil
  499.     @type = nil
  500.   end

  501.   #--------------------------------------------------------------------------
  502.   def refresh
  503.     self.contents.clear
  504.     case @type
  505.       when 0
  506.         item = $data_items[@result]
  507.         if item.recover_hp_rate > item.recover_hp
  508.           hp_string = "HP回复率:"
  509.           hp_stat = item.recover_hp_rate
  510.         else
  511.           hp_string = "HP回复量:"
  512.           hp_stat = item.recover_hp
  513.         end
  514.         if item.recover_sp_rate > item.recover_sp
  515.           sp_string = "SP回复率:"
  516.           sp_stat = item.recover_sp_rate
  517.         else
  518.           sp_string = "SP回复量:"
  519.           sp_stat = item.recover_sp
  520.         end
  521.         @strings = [hp_string, sp_string, "物理防御:" , "魔法防御:", "命中率:", "分散度:"]
  522.         @stats = [hp_stat, sp_stat, item. pdef_f, item.mdef_f, item.hit, item.variance,
  523.                        $game_party.item_number(@result)]
  524.         @bitmap = RPG::Cache.icon(item.icon_name)
  525.       when 1
  526.         item = $data_armors[@result]
  527.         @strings = ["物理防御:", "魔法防御:", "回避修正:", "力量增加:", "灵巧增加:",
  528.                        "速度增加:", "魔力增加:"]
  529.         @stats = [item.pdef, item.mdef, item.eva, item.str_plus, item.dex_plus,
  530.                     item.agi_plus, item.int_plus, $game_party.armor_number(@result) ]
  531.         @bitmap = RPG::Cache.icon(item.icon_name)
  532.       when 2
  533.         item = $data_weapons[@result]
  534.         @strings =["攻击力:", "物理防御:", "魔法防御:", "力量增加:", "灵巧增加:",
  535.                     "速度增加:", "魔力增加:"]
  536.         @stats = [item.atk, item.pdef, item.mdef, item.str_plus, item.dex_plus,
  537.                     item.agi_plus, item.int_plus, $game_party.weapon_number(@result) ]
  538.         @bitmap = RPG::Cache.icon(item.icon_name)
  539.     end
  540.     for i in [email protected]
  541.       x = i%2 * 184
  542.       y = i /2 *28 +32
  543.       self.contents.font.color = normal_color
  544.       self.contents.draw_text(x,y,100, 28,@strings[i])
  545.       self.contents.font.color = system_color
  546.       self.contents.draw_text(x + 110, y, 45, 28, @stats[i].to_s)
  547.     end
  548.     self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, 24, 24), 255)
  549.     self.contents.font.color= normal_color
  550.     self.contents.draw_text(40, 0, 300, 28, "待合成物品的现有数量:")
  551.     self.contents.font.color = system_color
  552.     count = @stats[@stats.size - 1].to_s
  553.     self.contents.draw_text(294, 0, 45, 28, count )
  554.   end
  555.    
  556. #----------------------------------------------------------------------
  557.   def set_result(result , type)
  558.     @result = result
  559.     @type = type
  560.     refresh
  561.   end

  562. end #of Window_CraftResult

  563. #=======================================
  564. class Window_CraftIngredients < Window_Base

  565.   #--------------------------------------------------------------------------
  566.   def initialize
  567.     super(240, 248, 400, 232)
  568.     self.contents = Bitmap.new(width - 32, height - 32)
  569.     self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
  570.     self.contents.font.size = 18 # = 20
  571.     @ingredients = []
  572.     @types = []
  573.     @quantities = []
  574.     @item = nil
  575.     @count = 0
  576.     @counter = 0
  577.     @real_oy = 0
  578.   end

  579.   #--------------------------------------------------------------------------
  580.   def refresh
  581.     @counter = 0
  582.     self.contents.clear
  583.     self.contents = Bitmap.new(width - 32, @ingredients.size * 26)
  584.     for i in [email protected]
  585.       case @types[i]
  586.       when 0
  587.         @item = $data_items[@ingredients[i]]
  588.         @count = $game_party.item_number(@ingredients[i])
  589.       when 1
  590.         @item = $data_armors[@ingredients[i]]
  591.         @count = $game_party.armor_number(@ingredients[i])
  592.       when 2
  593.         @item = $data_weapons[@ingredients[i]]
  594.         @count = $game_party.weapon_number(@ingredients[i])
  595.       end
  596.       y = i *26
  597.       self.contents.blt(0, y, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), 255)
  598.       self.contents.font.color = @count >= @quantities[i] ? normal_color : disabled_color
  599.       self.contents.draw_text(30, y, 280, 28, @item.name)
  600.       self.contents.draw_text(300, y, 45, 28, @quantities[i].to_s)
  601.       self.contents.font.color = system_color
  602.       self.contents.draw_text(245, y, 45, 28, @count.to_s )     
  603.     end
  604.   end
  605.       
  606.   #--------------------------------------------------------------------------
  607.   def set_ingredients(ingredients , types, quantities)
  608.     @ingredients = ingredients
  609.     @types = types
  610.     @quantities = quantities
  611.     refresh
  612.     if @ingredients.size > 7
  613.       self.oy = -52
  614.       @real_oy = 0
  615.     else
  616.       self.oy = 0
  617.     end
  618.   end

  619.   def update
  620.     super
  621.     @counter += 1
  622.     if @ingredients.size > 7 and @counter > 30
  623.       @real_oy = (@real_oy + 1) % ((@ingredients.size - 3) * 26)
  624.       self.oy = @real_oy - 52
  625.     end
  626.   end
  627.    
  628. end # of Window_CraftIngredients

  629. #======================================
  630. class Scene_Craft

  631.   #--------------------------------------------------------------------------
  632.   # @craft_type:物品种类,0就是全部
  633.   def initialize(craft_type=0,craft_index=0)
  634.     @craft_index=craft_index
  635.     @craft_type = craft_type
  636.   end
  637.   
  638.   #--------------------------------------------------------------------------
  639.   def main
  640.     @craft_window = Window_Craft.new(@craft_type)
  641.     @craft_window.index=@craft_index
  642.     @confirm_window = Window_Base.new(120, 188, 400, 64)
  643.     @confirm_window.contents = Bitmap.new(368, 32)
  644.     @confirm_window.contents.font.name = "黑体"
  645.     @confirm_window.contents.font.size = 20
  646.     @help_window = Window_Help.new
  647.     @craft_window.help_window = @help_window
  648.     @result_window=Window_CraftResult.new
  649.     @ingredients_window=Window_CraftIngredients.new
  650.     if @craft_window.data.size > 0 #本类窗口物品大于0的话
  651.       @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
  652.       @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
  653.                                                           @craft_window.recipe.ingredient_types,
  654.                                                           @craft_window.recipe.quantities)
  655.     end
  656.     @yes_no_window = Window_Command.new(100, ["确定", "放弃"])
  657.     @confirm_window.visible = false
  658.     @confirm_window.z = 1500
  659.     @yes_no_window.visible = false
  660.     @yes_no_window.active = false
  661.     @yes_no_window.index = 1
  662.     @yes_no_window.x = 270
  663.     @yes_no_window.y = 252
  664.     @yes_no_window.z = 1500
  665.     @label_window = Window_Base.new(450,200,190,52)
  666.     @label_window.contents=Bitmap.new(@label_window.width - 32,@label_window.height - 32)
  667.     @label_window.contents.font.size=20
  668.     @label_window.contents.font.color = @label_window.normal_color
  669.     @label_window.contents.font.name = "黑体"
  670.     @label_window.contents.draw_text(0, 0, @label_window.contents.width, 20, "  现有   需要")
  671.     Graphics.transition
  672.     loop do
  673.       Graphics.update
  674.       Input.update
  675.       update
  676.       if $scene != self
  677.         break
  678.       end
  679.     end
  680.     Graphics.freeze
  681.     @help_window.dispose
  682.     @craft_window.dispose
  683.     @result_window.dispose
  684.     @ingredients_window.dispose
  685.     @confirm_window.dispose
  686.     @yes_no_window.dispose
  687.     @label_window.dispose
  688.   end

  689.   #--------------------------------------------------------------------------
  690.   def update
  691.     @craft_window.update
  692.     @ingredients_window.update
  693.     if @craft_window.active
  694.       update_craft
  695.       return
  696.     end
  697.     if @yes_no_window.active
  698.       confirm_update
  699.       return
  700.     end
  701.   end

  702.   #--------------------------------------------------------------------------
  703.   def update_craft
  704.     if Input.dir4 != 0
  705.       if @craft_window.data.size > 0 #本类窗口物品大于0的话
  706.         @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
  707.         @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
  708.                                                            @craft_window.recipe.ingredient_types,
  709.                                                            @craft_window.recipe.quantities)
  710.       end
  711.     end
  712.     if Input.trigger?(Input::B)
  713.       $game_system.se_play($data_system.cancel_se)
  714.       $scene = Scene_Map.new
  715.       return
  716.     end
  717.     if Input.trigger?(Input::C) and $game_party.recipes.size != 0
  718.       @recipe = @craft_window.recipe
  719.       if @recipe != nil
  720.         if @recipe.have
  721.           @yes_no_window.active = true
  722.           @craft_window.active = false
  723.         else
  724.           $game_system.se_play($data_system.buzzer_se)
  725.           return
  726.         end
  727.       else
  728.         $game_system.se_play($data_system.buzzer_se)
  729.         return
  730.       end
  731.     end
  732.   end

  733.   #--------------------------------------------------------------------------
  734.   def confirm_update
  735.     @craft_index = @craft_window.index
  736.     @confirm_window.visible = true
  737.     @confirm_window.z = 1500
  738.     @yes_no_window.visible = true
  739.     @yes_no_window.active = true
  740.     @yes_no_window.z = 1500
  741.     @yes_no_window.update
  742.     string = "合成 " + @recipe.name + "?"
  743.     cw = @confirm_window.contents.text_size(string).width
  744.     center = @confirm_window.contents.width/2 - cw /2
  745.     unless @drawn
  746.       @confirm_window.contents.draw_text(center, 0, cw, 30, string)
  747.       @drawn = true
  748.     end
  749.     if Input.trigger?(Input::C)
  750.       if @yes_no_window.index == 0
  751.         $game_system.se_play($data_system.decision_se)
  752.         @recipe.make
  753.         $game_system.se_play($data_system.save_se)
  754.         $scene=Scene_Craft.new(@craft_type,@craft_index)
  755.       else
  756.         $game_system.se_play($data_system.cancel_se)
  757.         $scene=Scene_Craft.new(@craft_type,@craft_index)
  758.       end
  759.     end
  760.     if Input.trigger?(Input::B)
  761.       $game_system.se_play($data_system.cancel_se)
  762.       $scene=Scene_Craft.new(@craft_type,@craft_index)
  763.     end
  764.   end

  765. end # of Scene_Craft

  766. #==============================================================================
  767. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  768. # 欢迎访问www.66RPG.com
  769. # 梦想世界,在你手中
  770. #==============================================================================
复制代码
我用这个不会出错呀

   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
206 小时
注册时间
2014-2-8
帖子
396
7
 楼主| 发表于 2014-3-12 20:25:50 | 只看该作者
guoyq1988 发表于 2014-3-11 21:43
我用这个不会出错呀

召唤不出来啊我了个去

点评

你有认真看脚本么?  发表于 2014-3-12 21:58
刚接触RPG的新人们裤艾来这里!在这里能够帮助你们提高自身的能力,让大家来帮助每个人实现自己的创意、构想!
也许你只是正在看RPG教程的新人,或者是正在努力学着制作自己的RPG的制作者,或者是狂热的RPG游戏喜爱者,
但都不重要!
加入我们,我们会帮助你实现梦想,或者帮助你更好的运用RPG并且创造个人的一片天地!周末我们会不定时间开放RM技术讨论活动或者RM经验交流课!
加入我们,我们愿意与你共同创造奇迹,共同进步!
QQ群号:329443038  
或者联系QQ:573932914
我们和你站在同一线!
要求只有:常能上线
我们会用十分的热情接纳你!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
8
发表于 2014-3-12 21:58:24 | 只看该作者
573932914 发表于 2014-3-12 20:25
召唤不出来啊我了个去

学习合成的项目
$game_party.learn_recipe(
$game_temp.recipe_list[1])

召唤项目1界面
$scene = Scene_Craft.new(1)

评分

参与人数 1星屑 +80 收起 理由
天地有正气 + 80 认可答案

查看全部评分


   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
206 小时
注册时间
2014-2-8
帖子
396
9
 楼主| 发表于 2014-3-13 19:44:24 | 只看该作者
guoyq1988 发表于 2014-3-12 21:58
学习合成的项目
$game_party.learn_recipe(
$game_temp.recipe_list[1])

还是不能召唤出来啊= -
刚接触RPG的新人们裤艾来这里!在这里能够帮助你们提高自身的能力,让大家来帮助每个人实现自己的创意、构想!
也许你只是正在看RPG教程的新人,或者是正在努力学着制作自己的RPG的制作者,或者是狂热的RPG游戏喜爱者,
但都不重要!
加入我们,我们会帮助你实现梦想,或者帮助你更好的运用RPG并且创造个人的一片天地!周末我们会不定时间开放RM技术讨论活动或者RM经验交流课!
加入我们,我们愿意与你共同创造奇迹,共同进步!
QQ群号:329443038  
或者联系QQ:573932914
我们和你站在同一线!
要求只有:常能上线
我们会用十分的热情接纳你!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
10
发表于 2014-3-13 22:52:24 | 只看该作者
]明天再发个范例给你吧

   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 19:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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