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

Project1

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

[已经解决] 物品合成脚本学习配方发生错误

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
52
在线时间
75 小时
注册时间
2011-5-27
帖子
27
跳转到指定楼层
1
发表于 2011-5-30 13:17:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  脚本是直接拿来用的,没有任何修改


#=========================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
# 欢迎访问www.66RPG.com
# 梦想世界,在你手中
#=========================================================  
#
# Sample master list for crafting script (物品分类增强版) v1.1
# written by Deke
# 增强:叶子
#
# 12-30-2005 v1.0
# 8-17-2006 v1.1
# 修正了返回界面时不显示成品的BUG
# 修正了材料大于8个不显示的BUG
# 描绘物品美化
# 自动检测能否合成
#=========================================================
# 简介:
# 这是一个很不错的合成物品系统,可以通过游戏的过程,不断学习可以合成的
# 物品方法。
# ------
# 增强版补充说明:
# 在这个增强版中,可以对成品进行手动分类。
# 成品增加了一个分类属性。
# 这个分类纯粹是按自己的意愿,没有规定第几类必须是什么。
# 召唤特定分类的界面,就只会看到特定分类的成品。
#
# 例如:
# 使用脚本$scene = Scene_Craft.new(1),
# 出来的界面就只会显示成品分类为1的东西
# 同样道理,使用脚本$scene = Scene_Craft.new(2),
# 出来的界面就只会显示成品分类为2的东西
#
# 如果使用脚本$scene = Scene_Craft.new或$scene = Scene_Craft.new(0)来召唤界面
# 就可以看到所有成品。
#
# 注意:不要弄混淆“成品种类”和“成品分类”
# 成品种类是指成品是普通物品(0),防具(1)或武器(2)
# 成品分类是指此物品的自定义分类
#
#
# 使用方法:
# 1、召唤界面:使用脚本$scene = Scene_Craft.new(分类的数字)
# 例如:使用脚本$scene = Scene_Craft.new(1),出来分类1的界面
#
# 2、学习合成:$game_party.learn_recipe(合成项目)
#
#  2.1、其实这个脚本可以使同一成品有不同配方
#
#    就这样说可能解释得不清楚,先来解释一下脚本学习配方的原理:
#    $game_party.learn_recipe(合成项目)的处理过程并不是直接学习这个配方,
#    而是在配方库中找到和合成项目成品相同的配方。
#
#    如果配方库中有两个配方成品相同的话,配方版本就变得重要。
#    $game_party.learn_recipe(合成项目,配方版本)
#    配方版本为1的话,学到的配方就是@recipe_list[xx]中与合成项目成品相同且数字最小的配方
#    配方版本为2的话,学到的配方就是数字第二小的配方
#    在上面这个脚本语句中,不填配方版本的话就默认为1
#
#  2.2、忘记配方:$game_party.forget_recipe(合成项目)
#   2.21、同样道理,这个语句也可以写配方版本
#    $game_party.forget_recipe(合成项目,配方版本)
#    配方版本定义见2.1
#
#  2.3、配方版本不能乱填!例如游戏中某一个配方的成品是唯一的,与所有其它配方的成品都不相同
#   那么学习的时候就不用填配方版本。
#   如果这时在配方版本填了2的话,就有可能学不到或者忘不了(-_-||)
#   
#
# 3、合成定义:
# 这个合成脚本可以定义两种合成物品。一种是预先定义好了的,就像下面这样,
# 直接写在这里就可以,另一种是在学习之前现场定义。
#
# 4、举例
#  4.1、学会recipe_list[1]定义的合成:$game_party.learn_recipe($game_temp.recipe_list[1])
#       注意,一行如果输入不下,在(的后面或[的后面按回车换行,否则可能出错
#
#  4.2、在游戏中临时定义一种合成,让玩家学会。使用事件中的脚本如下,   
#  脚本:
#    材料 = [$game_variables[1],$game_variables[2]]  #——材料编号是变量1、2的编号
#    材料种类 = [0,0]                                #——材料是物品
#    材料数量 = [$game_variables[3],$game_variables[4]]  #——需要材料数量是变量3、4的编号
#    成品 = $game_variables[5]                       #——获得结果编号是5
#    成品种类 = 1                                    #——成品是防具类
#    成品分类 = 1                                    #——这一项不写的话默认为0
#    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类,成品分类))
#    上面这条语句的成品分类这一项不写也行,这样它就默认为0了。
#    (也就是此物品没有分类,不会在分类菜单中出现)
#    省略成品分类的脚本语句可以像下面这样写:
#    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类))
#
#================================================================
class Game_Temp
  attr_reader :recipe_list  
  alias crafting_temp_initialize initialize
  def initialize
    crafting_temp_initialize
    @recipe_list=[]
    get_recipe_list
  end  
  def get_recipe_list   
    ################################################################
    # 1 号合成物品设定 (续命膏*5+青玉萝卜*5+小蛋糕*3=琼浆之露) 成品分类:1
    ##############################################################
    材料 = [5, 64,65]             # 需要材料的数据库编号
    材料种类 = [0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5,5,3]         # 需要材料的数量
    成品 = 27                # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
    ###############################################################
    # 2 号合成物品设定 (魔女泪*5+肥肥菇*5+朝天椒*3=魔龙之血) 成品分类:1
    ##########################################################
    材料 = [10, 66, 68]          # 需要材料的数据库编号
    材料种类 = [0, 0, 0]      # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5, 5, 3]      # 需要材料的数量
    成品 = 28                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    物品分类 = 1              # 获得成品分类
    @recipe_list[2] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
    ##############################################################
    # 3 号合成物品设定 (玉琼之露*3+魔龙之血*3+小金果*5=女神之吻) 成品分类:1
    ###########################################################
    材料 = [27,28,73]            # 需要材料的数据库编号
    材料种类 = [0, 0, 0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5, 5, 3]         # 需要材料的数量
    成品 = 29                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[3] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
    ##############################################################
    # 4 号合成物品设定 (回魂之泉*5+明酒*5+不明药丸*1=冥王恩典) 成品种类: 1
    ##############################################################
    材料 = [12,71,77]            # 需要材料的数据库编号
    材料种类 = [0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5,5,1]         # 需要材料的数量
    成品 = 30                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[4] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  
   #############################################################
    # 5 号合成物品设定 (女神之吻*1+冥王恩典*1+万灵圣水*9+达克樱果*9=远古之心) 成品种类: 1
    ##############################################################
    材料 = [29,30,26,70]            # 需要材料的数据库编号
    材料种类 = [0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,9,9]         # 需要材料的数量
    成品 = 31                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[5] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
    #############################################################
    # 6 号合成物品设定 (续命膏*8+野兽肉*5+小蛋糕*3+毒海螺*2=梦幻饮料) 成品种类: 1
    ##############################################################
    材料 = [5,67,65,72]            # 需要材料的数据库编号
    材料种类 = [0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [8,5,3,2]         # 需要材料的数量
    成品 = 55                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[6] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
     #############################################################
    # 7 号合成物品设定 (玉琼之露*4+地皇水*5+青玉萝卜*9+野兽肉*9+???叶*1=天堂彩虹) 成品种类: 1
    ##############################################################
    材料 = [27,75,64,67,79]            # 需要材料的数据库编号
    材料种类 = [0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [4,5,9,9,1]         # 需要材料的数量
    成品 = 56                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[7] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
      #############################################################
    # 8 号合成物品设定 (魔女泪*7+蜂浆酒*4+肥肥菇*7+薄荷叶*3=极乐雪莲子) 成品种类: 1
    ##############################################################
    材料 = [10,74,66,69]            # 需要材料的数据库编号
    材料种类 = [0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [5,4,7,3]         # 需要材料的数量
    成品 = 57                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[8] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
       #############################################################
    # 9 号合成物品设定 (魔龙之血*4+天麻星实*6+朝天椒*4+达克樱果*4+光明草*2=太古人参王) 成品种类: 1
    ##############################################################
    材料 = [28,76,68,70,78]            # 需要材料的数据库编号
    材料种类 = [0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [4,6,4,4,2]         # 需要材料的数量
    成品 = 58                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[9] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
       #############################################################
    # 10 号合成物品设定 (冥王恩典*4+鬼婆婆的汤药*3+不金果*6+明酒*2+玲珑珍菇*1=如来之花) 成品种类: 1
    ##############################################################
    材料 = [30,80,73,71,81]            # 需要材料的数据库编号
    材料种类 = [0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [4,3,6,2,1]         # 需要材料的数量
    成品 = 59                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[10] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
       #############################################################
    # 11 号合成物品设定 (万灵圣药*9+毒海螺*4+蜂浆酒*3+地皇水*2+天麻星实*3+光明草*2=上帝之血) 成品种类: 1
    ##############################################################
    材料 = [26,72,74,75,76,78]            # 需要材料的数据库编号
    材料种类 = [0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [9,4,3,2,3,2]         # 需要材料的数量
    成品 = 60                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[11] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
      #############################################################
    # 12 号合成物品设定 (远古之心*2+冰龙草*1+爱神的呵护*1+玲珑珍菇*3+鬼婆婆的汤药*3+???叶*3=永无终点的生命) 成品种类: 1
    ##############################################################
    材料 = [31,82,83,81,80,79]            # 需要材料的数据库编号
    材料种类 = [0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [2,1,1,3,3,3]         # 需要材料的数量
    成品 = 61                  # 获得物品编号
    成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 1              # 获得成品分类
    @recipe_list[12] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
       #############################################################
    # 13 号合成物品设定 (长法袍*1+水晶兰*1+黑硝石*3=术士影子) 成品种类: 2
    ##############################################################
    材料 = [1,110,86]            # 需要材料的数据库编号
    材料种类 = [1,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,3]         # 需要材料的数量
    成品 = 2                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[13] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
        #############################################################
    # 14 号合成物品设定 (轻披风*1+风羽*1+大毒牙*3=隐叶) 成品种类: 2
    ##############################################################
    材料 = [7,88,87]            # 需要材料的数据库编号
    材料种类 = [1,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,3]         # 需要材料的数量
    成品 = 8                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[14] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
        #############################################################
    # 15 号合成物品设定 (便身衣*1+水晶兰*1+冰晶石*2=通行者) 成品种类: 2
    ##############################################################
    材料 = [13,110,89]            # 需要材料的数据库编号
    材料种类 = [1,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,2]         # 需要材料的数量
    成品 = 14                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[15] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
         #############################################################
    # 16 号合成物品设定 (皮胸甲*1+大毒牙*2+黑硝石*9=牛角尖) 成品种类: 2
    ##############################################################
    材料 = [19,87,86]            # 需要材料的数据库编号
    材料种类 = [1,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,2,9]         # 需要材料的数量
    成品 = 20                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[16] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
         #############################################################
    # 17 号合成物品设定 (钢铁铠*1+迷志铃声*3+紫魄石=钢骨) 成品种类: 2
    ##############################################################
    材料 = [25,90,111]            # 需要材料的数据库编号
    材料种类 = [1,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,3,1]         # 需要材料的数量
    成品 = 26                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[17] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
    #############################################################
    # 18 号合成物品设定 (丝绸罗袍*1+紫魄石*5+雷音海星*2+山石之卵*3=长言羽) 成品种类: 2
    ##############################################################
    材料 = [3,111,91,92]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,5,2,3]         # 需要材料的数量
    成品 = 4                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[18] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
     #############################################################
    # 19 号合成物品设定 (云皮披风*1+蓝海之瞳*2+风羽*4+冰晶石*6=云兽碎魂) 成品种类: 2
    ##############################################################
    材料 = [9,112,88,89]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,4,3]         # 需要材料的数量
    成品 = 10                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[19] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
     #############################################################
    # 20 号合成物品设定 (武行之衣*1+紫魄石*1+水晶兰*7+山石之卵*2=修行的游士) 成品种类: 2
    ##############################################################
    材料 = [15,111,110,92]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,7,2]         # 需要材料的数量
    成品 = 16                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[20] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
     #############################################################
    # 21 号合成物品设定 (决战之甲*1+恶灵之羽*2+妖卵*3+紫魄石*3=不灭的战意) 成品种类: 2
    ##############################################################
    材料 = [21,97,95,111]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,2,3,3]         # 需要材料的数量
    成品 = 22                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[21] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
     #############################################################
    # 22 号合成物品设定 (荣耀重铠*1+天竺绿水*1+冰虎之牙*3+鬼灵炎*4=荣耀的牺牲品) 成品种类: 2
    ##############################################################
    材料 = [27,113,94,93]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,3,4]         # 需要材料的数量
    成品 = 28                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[22] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
      #############################################################
    # 23 号合成物品设定 (纹章咒袍*1+神之卵*1+金色梦幻*3+夺命珊瑚*2+魔蜥尾*6=被诅咒的灵魂) 成品种类: 2
    ##############################################################
    材料 = [5,105,114,98,96]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,3,2,6]         # 需要材料的数量
    成品 = 6                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[23] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
       #############################################################
    # 24 号合成物品设定 (梦幻披风*1+太阳鸟之灵*4+金色梦幻*7+战争号角*5+飞龙空翼*5=水晶的理想) 成品种类: 2
    ##############################################################
    材料 = [11,104,114,102,101]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,4,7,5,5]         # 需要材料的数量
    成品 = 12                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[24] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
        #############################################################
    # 25 号合成物品设定 (王者战衣*1+天竺绿水*9+彩虹之石*8+破灭神像*6+蓝海之瞳*9=战神的佐证) 成品种类: 2
    ##############################################################
    材料 = [17,113,100,103,112]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,9,8,6,9]         # 需要材料的数量
    成品 = 18                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[25] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
        #############################################################
    # 26 号合成物品设定 (神圣战甲*1+永恒的纯洁*1+太阳鸟之灵*1+破灭神像*2+美杜莎的恶灵*8=众神的愿望) 成品种类: 2
    ##############################################################
    材料 = [23,115,104,103,99]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,1,2,8]         # 需要材料的数量
    成品 = 24                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[26] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
       #############################################################
    # 27 号合成物品设定 (玄武真铠*1+神之卵*1+永恒纯洁*1+美杜莎的灵魂*2+天竺绿水*3=世界最强) 成品种类: 2
    ##############################################################
    材料 = [29,105,115,99,113]            # 需要材料的数据库编号
    材料种类 = [1,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
    材料数量 = [1,1,1,2,3]         # 需要材料的数量
    成品 = 30                  # 获得物品编号
    成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
    成品分类 = 2              # 获得成品分类
    @recipe_list[27] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
   
     
  end # of get_recipe_list method
end # of updates to Game_Temp Class

#================================
# CRAFTING PROGRAM
#-----------------------------------------------------
#-written by Deke
#-yes_no window code created by Phsylomortis
#-----------------------------------------------------
#================================

#updates to Game_Party class

class Game_Party
  
  attr_accessor       :recipes
  
  alias crafting_party_initialize initialize
  
  def initialize
    crafting_party_initialize
    @recipes=[]
  end
  
  #------------------------------------------------------
  def know?(recipe, version = 1)
    unless recipe.is_a?(Game_Recipe)
      recipe = get_recipe_from_master_list(recipe, version)
    end
    return $game_party.recipes.include?(recipe)
  end
  
#----------------------------------------------------
  def learn_recipe(recipe , version = 1)
    unless recipe.is_a?(Game_Recipe)
      recipe = get_recipe_from_master_list(recipe, version)
    end
    if recipe.is_a?(Game_Recipe)
      unless know?(recipe)
        @recipes.push(recipe)
      end
    end
  end
  
#------------------------------------------------------
  def forget_recipe(recipe , version = 1)
    if !recipe.is_a?(Game_Recipe)
      recipe = get_recipe_from_master_list(recipe, version)
    end
    if recipe.is_a?(Game_Recipe)
      for i in [email protected]
        if recipe == @recipes
          index = i
          break
        end
      end
      if index != nil
        @recipes.delete(@recipes[index])
      end
    end
  end
  
#---------------------------------------------------------
  def get_recipe_from_master_list(item, version)
    index = nil
    for i in 0...$game_temp.recipe_list.size
      if item[0] == $game_temp.recipe_list.result and item[1] ==$game_temp.recipe_list.result_type
        version -= 1
        if version == 0
          index = i
          break
        end
      end
    end
    if index.is_a?(Integer)
      return ($game_temp.recipe_list[index])
    else
      return false
    end
  end
  
end # of Game_Party updates

#================================
class Game_Recipe

  attr_reader :ingredients
  attr_reader :quantities
  attr_reader :result
  attr_reader :result_type
  attr_reader :ingredient_types
  attr_reader :craft_type  #物品分类
  
#---------------------------------------------------
  def initialize( ingredients, ingredient_types, quantities, result, result_type, craft_type=0)
    @ingredients = ingredients
    @ingredient_types = ingredient_types
    @quantities = quantities
    @result = result
    @result_type = result_type
    @craft_type = craft_type
  end
  
#---------------------------------------------------------
  def name
    case @result_type
      when 0
        name = $data_items[@result].name
      when 1
        name = $data_armors[@result].name
      when 2
        name = $data_weapons[@result].name
    end
    return name
  end
  
#--------------------------------------------------------

  def item
    case @result_type
      when 0
        item = $data_items[@result]
      when 1
        item = $data_armors[@result]
      when 2
        item = $data_weapons[@result]
    end
    return item
  end

#-----------------------------------------------------
  def have
    have_all = true
    for i in [email protected]
      case @ingredient_types
        when 0
          if $game_party.item_number(@ingredients) < @quantities
            have_all=false
          end
        when 1
          if $game_party.armor_number(@ingredients) < @quantities
            have_all=false
          end
        when 2
          if $game_party.weapon_number(@ingredients) < @quantities
            have_all=false
          end
      end
    end
    return have_all
  end

#---------------------------------------------------------
  def decrement
    for i in [email protected]
      case @ingredient_types
      when 0
        $game_party.lose_item(@ingredients, @quantities)
      when 1
        $game_party.lose_armor(@ingredients, @quantities)
      when 2
        $game_party.lose_weapon(@ingredients, @quantities)
      end
    end
  end

#-------------------------------------------------------
  def make
    if have
      case @result_type
      when 0
        $game_party.gain_item(@result, 1)
      when 1
        $game_party.gain_armor(@result, 1)
      when 2
        $game_party.gain_weapon(@result, 1)
      end
      decrement
    end
  end
  
#---------------------------------------------------------
  def == (recipe)
    if recipe.is_a?(Game_Recipe)
      equal = true
      if recipe.ingredients != self.ingredients
        equal = false
      end
      if recipe.ingredient_types != self.ingredient_types
        equal = false
      end
      if recipe.quantities != self.quantities
        equal = false
      end
      if recipe.result != self.result
        equal=false
      end
      if recipe.result_type != self.result_type
        equal = false
      end
    else
      equal = false
    end
    return equal
  end
  
end # of Game_Recipe class

#===================================

class Window_Craft < Window_Selectable
  attr_reader :data #声明数据
  #-------------------------------------------------------
  def initialize(craft_type=0)
    @craft_type = craft_type
    super(0, 64, 240, 416)
    @column_max = 1
    refresh
    self.index = 0
  end

  #----------------------------------------------------------
  def recipe
    return @data[self.index]
  end

  #----------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    for i in 0...$game_party.recipes.size
       #@craft_type为0时就显示全部物品
       #不为0时就显示对应物品
      if @craft_type == 0
        @data.push($game_party.recipes)
      elsif $game_party.recipes.craft_type == @craft_type
        @data.push($game_party.recipes)
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      self.contents.font.name = "黑体" # = "黑体"
      self.contents.font.size = 18 # = 18
      for i in 0...@item_max
        x = 16
        y = i * 32
        able = true
        for ingredient in 0...@data.ingredients.size
          case @data.ingredient_types[ingredient]
          when 0
            count = $game_party.item_number(@data.ingredients[ingredient])
          when 1
            count = $game_party.armor_number(@data.ingredients[ingredient])
          when 2
            count = $game_party.weapon_number(@data.ingredients[ingredient])
          end
          if count < @data.quantities[ingredient]
            able = false
            break
          end
        end
        draw_item_name(@data.item, x, y, able)
      end
    end
  end

  #------------------------------------------------------------
  #def draw_item(index)
  #  recipe = @data[index]
  #  self.contents.font.color = recipe.have ? normal_color : disabled_color
  #  x = 16
  #  y = index * 32
  #  self.contents.draw_text(x , y, self.width-32, 32, recipe.name, 0)
  #end
  
  #--------------------------------------------------------------
  # ● 描绘物品名
  #     item : 物品
  #     x    : 描画目标 X 坐标
  #     y    : 描画目标 Y 坐标
  #--------------------------------------------------------------
  def draw_item_name(item, x, y, able = true)
    if item == nil
      return
    end
    if !able
      self.contents.font.color = disabled_color
    end
    bitmap = RPG::Cache.icon(item.icon_name)
    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.draw_text(x + 28, y, 212, 32, item.name)
    self.contents.font.color = normal_color
  end
  
  #--------------------------------------------------------------
  def update_help
    current_recipe = recipe
    if current_recipe.is_a?(Game_Recipe)
    case current_recipe.result_type
      when 0
        description = $data_items[current_recipe.result].description
      when 1
        description = $data_armors[current_recipe.result].description
      when 2
        description = $data_weapons[current_recipe.result].description
      end
    else
      description = ""
    end
    @help_window.set_text(description)
    @help_window.update
  end
  
end # of Window_Craft

#=======================================
class Window_CraftResult < Window_Base

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

  #------------------------------------------------------------
  def refresh
    self.contents.clear
    case @type
      when 0
        item = $data_items[@result]
        if item.recover_hp_rate > item.recover_hp
          hp_string = "HP回复率:"
          hp_stat = item.recover_hp_rate
        else
          hp_string = "HP回复量:"
          hp_stat = item.recover_hp
        end
        if item.recover_sp_rate > item.recover_sp
          sp_string = "SP回复率:"
          sp_stat = item.recover_sp_rate
        else
          sp_string = "SP回复量:"
          sp_stat = item.recover_sp
        end
        @strings = [hp_string, sp_string, "物理防御:" , "魔法防御:", "命中率:", "分散度:"]
        @stats = [hp_stat, sp_stat, item. pdef_f, item.mdef_f, item.hit, item.variance,
                       $game_party.item_number(@result)]
        @bitmap = RPG::Cache.icon(item.icon_name)
      when 1
        item = $data_armors[@result]
        @strings = ["物理防御:", "魔法防御:", "回避修正:", "力量增加:", "灵巧增加:",
                       "速度增加:", "魔力增加:"]
        @stats = [item.pdef, item.mdef, item.eva, item.str_plus, item.dex_plus,
                    item.agi_plus, item.int_plus, $game_party.armor_number(@result) ]
        @bitmap = RPG::Cache.icon(item.icon_name)
      when 2
        item = $data_weapons[@result]
        @strings =["攻击力:", "物理防御:", "魔法防御:", "力量增加:", "灵巧增加:",
                    "速度增加:", "魔力增加:"]
        @stats = [item.atk, item.pdef, item.mdef, item.str_plus, item.dex_plus,
                    item.agi_plus, item.int_plus, $game_party.weapon_number(@result) ]
        @bitmap = RPG::Cache.icon(item.icon_name)
    end
    for i in [email protected]
      x = i%2 * 184
      y = i /2 *28 +32
      self.contents.font.color = normal_color
      self.contents.draw_text(x,y,100, 28,@strings)
      self.contents.font.color = system_color
      self.contents.draw_text(x + 110, y, 45, 28, @stats.to_s)
    end
    self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, 24, 24), 255)
    self.contents.font.color= normal_color
    self.contents.draw_text(40, 0, 300, 28, "待合成物品的现有数量:")
    self.contents.font.color = system_color
    count = @stats[@stats.size - 1].to_s
    self.contents.draw_text(294, 0, 45, 28, count )
  end
   
#-------------------------------------------------------------
  def set_result(result , type)
    @result = result
    @type = type
    refresh
  end

end #of Window_CraftResult

#=======================================
class Window_CraftIngredients < Window_Base

  #----------------------------------------------------------------
  def initialize
    super(240, 248, 400, 232)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
    self.contents.font.size = 18 # = 20
    @ingredients = []
    @types = []
    @quantities = []
    @item = nil
    @count = 0
    @counter = 0
    @real_oy = 0
  end

  #-----------------------------------------------------------------
  def refresh
    @counter = 0
    self.contents.clear
    self.contents = Bitmap.new(width - 32, @ingredients.size * 26)
    for i in [email protected]
      case @types
      when 0
        @item = $data_items[@ingredients]
        @count = $game_party.item_number(@ingredients)
      when 1
        @item = $data_armors[@ingredients]
        @count = $game_party.armor_number(@ingredients)
      when 2
        @item = $data_weapons[@ingredients]
        @count = $game_party.weapon_number(@ingredients)
      end
      y = i *26
      self.contents.blt(0, y, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), 255)
      self.contents.font.color = @count >= @quantities ? normal_color : disabled_color
      self.contents.draw_text(30, y, 280, 28, @item.name)
      self.contents.draw_text(300, y, 45, 28, @quantities.to_s)
      self.contents.font.color = system_color
      self.contents.draw_text(245, y, 45, 28, @count.to_s )     
    end
  end
      
  #-------------------------------------------------------------
  def set_ingredients(ingredients , types, quantities)
    @ingredients = ingredients
    @types = types
    @quantities = quantities
    refresh
    if @ingredients.size > 7
      self.oy = -52
      @real_oy = 0
    else
      self.oy = 0
    end
  end

  def update
    super
    @counter += 1
    if @ingredients.size > 7 and @counter > 30
      @real_oy = (@real_oy + 1) % ((@ingredients.size - 3) * 26)
      self.oy = @real_oy - 52
    end
  end
   
end # of Window_CraftIngredients

#======================================
class Scene_Craft

  #--------------------------------------------------------------------
  # @craft_type:物品种类,0就是全部
  def initialize(craft_type=0,craft_index=0)
    @craft_index=craft_index
    @craft_type = craft_type
  end
  
  #--------------------------------------------------------------------
  def main
    @craft_window = Window_Craft.new(@craft_type)
    @craft_window.index=@craft_index
    @confirm_window = Window_Base.new(120, 188, 400, 64)
    @confirm_window.contents = Bitmap.new(368, 32)
    @confirm_window.contents.font.name = "黑体"
    @confirm_window.contents.font.size = 20
    @help_window = Window_Help.new
    @craft_window.help_window = @help_window
    @result_window=Window_CraftResult.new
    @ingredients_window=Window_CraftIngredients.new
    if @craft_window.data.size > 0 #本类窗口物品大于0的话
      @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
      @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
                                                          @craft_window.recipe.ingredient_types,
                                                          @craft_window.recipe.quantities)
    end
    @yes_no_window = Window_Command.new(100, ["确定", "放弃"])
    @confirm_window.visible = false
    @confirm_window.z = 1500
    @yes_no_window.visible = false
    @yes_no_window.active = false
    @yes_no_window.index = 1
    @yes_no_window.x = 270
    @yes_no_window.y = 252
    @yes_no_window.z = 1500
    @label_window = Window_Base.new(450,200,190,52)
    @label_window.contents=Bitmap.new(@label_window.width - 32,@label_window.height - 32)
    @label_window.contents.font.size=20
    @label_window.contents.font.color = @label_window.normal_color
    @label_window.contents.font.name = "黑体"
    @label_window.contents.draw_text(0, 0, @label_window.contents.width, 20, "  现有   需要")
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @help_window.dispose
    @craft_window.dispose
    @result_window.dispose
    @ingredients_window.dispose
    @confirm_window.dispose
    @yes_no_window.dispose
    @label_window.dispose
  end

  #--------------------------------------------------------------------
  def update
    @craft_window.update
    @ingredients_window.update
    if @craft_window.active
      update_craft
      return
    end
    if @yes_no_window.active
      confirm_update
      return
    end
  end

  #-------------------------------------------------------------------
  def update_craft
    if Input.dir4 != 0
      if @craft_window.data.size > 0 #本类窗口物品大于0的话
        @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
        @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
                                                           @craft_window.recipe.ingredient_types,
                                                           @craft_window.recipe.quantities)
      end
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C) and $game_party.recipes.size != 0
      @recipe = @craft_window.recipe
      if @recipe != nil
        if @recipe.have
          @yes_no_window.active = true
          @craft_window.active = false
        else
          $game_system.se_play($data_system.buzzer_se)
          return
        end
      else
        $game_system.se_play($data_system.buzzer_se)
        return
      end
    end
  end

  #-------------------------------------------------------------------
  def confirm_update
    @craft_index = @craft_window.index
    @confirm_window.visible = true
    @confirm_window.z = 1500
    @yes_no_window.visible = true
    @yes_no_window.active = true
    @yes_no_window.z = 1500
    @yes_no_window.update
    string = "合成 " + @recipe.name + "?"
    cw = @confirm_window.contents.text_size(string).width
    center = @confirm_window.contents.width/2 - cw /2
    unless @drawn
      @confirm_window.contents.draw_text(center, 0, cw, 30, string)
      @drawn = true
    end
    if Input.trigger?(Input::C)
      if @yes_no_window.index == 0
        $game_system.se_play($data_system.decision_se)
        @recipe.make
        $game_system.se_play($data_system.save_se)
        $scene=Scene_Craft.new(@craft_type,@craft_index)
      else
        $game_system.se_play($data_system.cancel_se)
        $scene=Scene_Craft.new(@craft_type,@craft_index)
      end
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene=Scene_Craft.new(@craft_type,@craft_index)
    end
  end

end # of Scene_Craft

#=============================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
# 欢迎访问www.66RPG.com
# 梦想世界,在你手中
#=============================================================


但是使用之后,设置了某公共事件学会配方一


之后直接黑屏显示错误

求高手帮助啊~~~~

Lv1.梦旅人

梦石
0
星屑
52
在线时间
75 小时
注册时间
2011-5-27
帖子
27
2
 楼主| 发表于 2011-5-30 13:18:25 | 只看该作者
额,不是设置之后直接错误,而是进入游戏,触发了这个学习配方1的脚本,然后直接黑屏提示错误
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
22 小时
注册时间
2011-5-8
帖子
62
3
发表于 2011-5-31 12:41:56 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
253
在线时间
574 小时
注册时间
2006-8-25
帖子
969
4
发表于 2011-5-31 23:45:06 | 只看该作者
"之后直接黑屏显示错误"之后直接显示该图片只限百度用户交流使用.
#       注意,一行如果输入不下,在(的后面或[的后面按回车换行,否则可能出错
  1. #例子:
  2. $game_party.learn_recipe(
  3. $game_temp.recipe_list[1])
复制代码
你确定自己没输入错误?

评分

参与人数 1星屑 +200 梦石 +2 收起 理由
「旅」 + 200 + 2

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
52
在线时间
75 小时
注册时间
2011-5-27
帖子
27
5
 楼主| 发表于 2011-6-3 21:10:47 | 只看该作者
谢谢了= =
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 01:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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