查看: 2160|回复: 6

[已经过期] 为什么物品合成脚本545行出错

[复制链接]

【欧皇】

梦石
3
星屑
2055
在线时间
1004 小时
注册时间
2013-8-19
回帖
3040

开拓者

发表于 2016-3-6 20:45:35 | 显示全部楼层 |阅读模式

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

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

×
[pre lang="ruby"]#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================  

# Sample master list for crafting script
# written by Deke
#============================================================================================
# 简介:
# 这是一个很不错的合成物品系统,可以通过游戏的过程,不断学习可以合成的
# 物品方法。
#
# 使用方法:
# 1、召唤界面:使用脚本$scene = Scene_Craft.new
#
# 2、学习合成:$game_party.learn_recipe(合成项目)
#
# 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                                    #——成品是防具类
#    $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号物品合成设定    速度粉末*10+玻璃瓶*1=暂时加速剂              
   ##########################################################################
   材料 = [49,50]        # 需要材料的数据库编号
   材料种类 = [0,0]      # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [10,1]     # 需要材料的数量
   成品 = 34             # 获得物品编号
   成品种类 = 0          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   
   ##########################################################################
   ####2号物品合成设定    复活水晶*1+速度粉末*8+玻璃瓶*1=精神药水                     
   ##########################################################################
   材料 = [35,49,50]     # 需要材料的数据库编号
   材料种类 = [0,0,0]    # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [1,8,1]    # 需要材料的数量
   成品 = 51             # 获得物品编号
   成品种类 = 0          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[2] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ####3号物品合成设定    石头*30=石盾                       
   ##########################################################################
   材料 = [48]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [30]       # 需要材料的数量
   成品 = 79             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[3] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####4号物品合成设定    铝锭*20=铝质头饰                       
   ##########################################################################
   材料 = [47]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [20]       # 需要材料的数量
   成品 = 35             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[4] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####5号物品合成设定    铝锭*25=铝质胸甲                       
   ##########################################################################
   材料 = [47]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [25]       # 需要材料的数量
   成品 = 50             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[5] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####6号物品合成设定    铝锭*15=铝质鞋子                       
   ##########################################################################
   材料 = [47]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [15]       # 需要材料的数量
   成品 = 65             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[6] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####7号物品合成设定    铝锭*20=铝质小盾                       
   ##########################################################################
   材料 = [47]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [20]       # 需要材料的数量
   成品 = 80             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[7] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####8号物品合成设定    铁锭*22=铁质面具                       
   ##########################################################################
   材料 = [46]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [22]       # 需要材料的数量
   成品 = 36             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[8] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####9号物品合成设定    铁锭*28=铁质胸甲                       
   ##########################################################################
   材料 = [46]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [28]       # 需要材料的数量
   成品 = 51             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[9] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####10号物品合成设定   铁锭*16=铁质鞋子                       
   ##########################################################################
   材料 = [46]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [16]       # 需要材料的数量
   成品 = 66             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[10] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####11号物品合成设定   铁锭*23=铁质小盾                       
   ##########################################################################
   材料 = [46]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [23]       # 需要材料的数量
   成品 = 81             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[11] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####12号物品合成设定    铜锭*24=铜质头盔                       
   ##########################################################################
   材料 = [45]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [24]       # 需要材料的数量
   成品 = 37             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[12] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####13号物品合成设定    铜锭*31=黄铜护甲                     
   ##########################################################################
   材料 = [45]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [31]       # 需要材料的数量
   成品 = 52             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[13] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####14号物品合成设定   铜锭*17=黄铜跑鞋                       
   ##########################################################################
   材料 = [45]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [17]       # 需要材料的数量
   成品 = 67             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[14] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####15号物品合成设定   铜锭*26=黄铜盾牌                       
   ##########################################################################
   材料 = [45]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [26]       # 需要材料的数量
   成品 = 82             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[15] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####16号物品合成设定    银锭*26=白银头盔                       
   ##########################################################################
   材料 = [62]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [26]       # 需要材料的数量
   成品 = 38             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[16] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####17号物品合成设定    银锭*34=白银护甲                     
   ##########################################################################
   材料 = [62]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [34]       # 需要材料的数量
   成品 = 53             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[17] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####18号物品合成设定   银锭*18=白银跑鞋                       
   ##########################################################################
   材料 = [62]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [18]       # 需要材料的数量
   成品 = 68             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[18] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####19号物品合成设定   银锭*29=白银盾牌                       
   ##########################################################################
   材料 = [62]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [29]       # 需要材料的数量
   成品 = 83             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[19] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####20号物品合成设定    金锭*28=黄金战盔                       
   ##########################################################################
   材料 = [44]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [28]       # 需要材料的数量
   成品 = 39             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[20] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####21号物品合成设定    金锭*37=黄金铠甲                     
   ##########################################################################
   材料 = [44]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [37]       # 需要材料的数量
   成品 = 54             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[21] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####22号物品合成设定    金锭*19=黄金飞靴                       
   ##########################################################################
   材料 = [44]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [19]       # 需要材料的数量
   成品 = 69             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[22] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####23号物品合成设定    金锭*32=黄金盾牌                       
   ##########################################################################
   材料 = [44]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [32]       # 需要材料的数量
   成品 = 84             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[23] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####24号物品合成设定    钻石*30=金刚战盔                       
   ##########################################################################
   材料 = [43]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [30]       # 需要材料的数量
   成品 = 40             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[24] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####25号物品合成设定    钻石*40=金刚铠甲                     
   ##########################################################################
   材料 = [43]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [40]       # 需要材料的数量
   成品 = 55             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[25] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####26号物品合成设定    钻石*20=金刚飞靴                       
   ##########################################################################
   材料 = [43]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [20]       # 需要材料的数量
   成品 = 70             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
   @recipe_list[26] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
   ##########################################################################
   ##########################################################################
   ####27号物品合成设定    钻石*35=金刚盾牌                       
   ##########################################################################
   材料 = [43]           # 需要材料的数据库编号
   材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
   材料数量 = [35]       # 需要材料的数量
   成品 = 85             # 获得物品编号
   成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,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 0...@recipes.size
       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

#----------------------------------------------------------------------
def initialize( ingredients, ingredient_types, quantities, result, result_type)
   @ingredients = ingredients
   @ingredient_types = ingredient_types
   @quantities = quantities
   @result = result
   @result_type = result_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 have
   have_all = true
   for i in 0...@ingredients.size
     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 0...@ingredients.size
     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

#--------------------------------------------------------------------------
def initialize
   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
       @data.push($game_party.recipes)
   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
       draw_item(i)
     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

#--------------------------------------------------------------------------
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]
      
         hp_string = "HP回复率:"
         hp_stat = item.recover_hp_rate
         hp_string2 = "HP回复量:"
         hp_stat2 = item.recover_hp
         sp_string = "SP回复率:"
         sp_stat = item.recover_sp_rate
         sp_string2 = "SP回复量:"
         sp_stat2 = item.recover_sp
       @strings = [hp_string, sp_string,hp_string2,sp_string2]
       @stats = [hp_stat, sp_stat,hp_stat2 ,sp_stat2,
                      $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.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 0...@strings.size
     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
end

#--------------------------------------------------------------------------
def refresh
   self.contents.clear
   for i in 0...@ingredients.size
     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
end

end # of Window_CraftIngredients

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

#--------------------------------------------------------------------------
def initialize(craft_index=0)
   @craft_index=craft_index
end

#--------------------------------------------------------------------------
def main
   @craft_window = Window_Craft.new
   @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
   @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 $game_party.recipes.size > 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
   if @craft_window.active
     update_craft
     return
   end
   if @yes_no_window.active
     confirm_update
     return
   end
end

#--------------------------------------------------------------------------
def update_craft
   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.have
       @yes_no_window.active = true
       @craft_window.active = false
     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_index)
     else
       $game_system.se_play($data_system.cancel_se)
       $scene=Scene_Craft.new(@craft_index)
     end
   end
   if Input.trigger?(Input::B)
     $game_system.se_play($data_system.cancel_se)
     $scene=Scene_Craft.new(@craft_index)
   end
end

end # of Scene_Craft

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================[/pre]
合成已经学习了

点评

NoMetHodError  发表于 2016-3-6 20:57
这样完全看不出什么错吧……弹了什么窗?  发表于 2016-3-6 20:48
QQ:2223942063
Q群:365819625
贪吃方1.4

梦石
0
星屑
9716
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2016-3-6 22:09:38 | 显示全部楼层
在544和545之间插入一行
  1. return unless recipe
复制代码
回复

使用道具 举报

【欧皇】

梦石
3
星屑
2055
在线时间
1004 小时
注册时间
2013-8-19
回帖
3040

开拓者

 楼主| 发表于 2016-3-7 12:12:23 | 显示全部楼层
本帖最后由 欧买歌 于 2016-3-7 17:58 编辑
cinderelmini 发表于 2016-3-6 22:09
在544和545之间插入一行


QQ截图20160307121130.png
插入之后打开合成界面还是错误,貌似是判断有没有这个材料然后改变颜色的吧




QQ截图20160307175506.png
原754行出错,我想知道脚本作者真的有测试过吗……

点评

那再改成【return unless recipe.is_a?(Game_Recipe)】  发表于 2016-3-7 13:16
QQ:2223942063
Q群:365819625
贪吃方1.4
回复

使用道具 举报

梦石
0
星屑
9716
在线时间
2775 小时
注册时间
2008-9-5
回帖
3458

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

发表于 2016-3-7 19:26:31 | 显示全部楼层
…….应该是坛子转码的锅……
代码框529行
  1. @data.push($game_party.recipes)
复制代码
后面的取数组位置的i被坛子吃了……
改成这样:
  1. @data.push($game_party.recipes[i])
复制代码

点评

还有663行的【 for i in [email]0...@ingredients.size[/email]】得把email代码去掉。  发表于 2016-3-7 19:28
回复

使用道具 举报

【欧皇】

梦石
3
星屑
2055
在线时间
1004 小时
注册时间
2013-8-19
回帖
3040

开拓者

 楼主| 发表于 2016-3-8 12:48:41 | 显示全部楼层
本帖最后由 欧买歌 于 2016-3-11 19:33 编辑
cinderelmini 发表于 2016-3-7 19:26
…….应该是坛子转码的锅……
代码框529行后面的取数组位置的i被坛子吃了……
改成这样: ...


QQ截图20160308124717.png
这……
还是有错误……
self.contents.draw_text(x,y,100, 28,@strings)

警察叔叔就是这一行





self.contents.blt(0, y, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), 255)

我并不知道要在什么地方加……于是我会一直这样伸手下去直到问题解决

点评

背锅银23333,捶地23333  发表于 2016-3-11 23:46
你不是触吗= =  发表于 2016-3-11 23:03
这个锅去找原作者和乱改代码的坛子背→_→  发表于 2016-3-11 21:14
除了把这行之上的【[email]0...@strings.size[/email]】去掉email代码,还得【(x,y,100, 28,@strings[i])】[i]依然是被坛子转为斜体代码了……  发表于 2016-3-8 15:02
QQ:2223942063
Q群:365819625
贪吃方1.4
回复

使用道具 举报

梦石
0
星屑
1036
在线时间
1691 小时
注册时间
2009-7-25
回帖
511

开拓者

发表于 2016-3-11 23:42:23 | 显示全部楼层
本帖最后由 烁灵 于 2016-3-12 00:26 编辑

测试
[pre lang="ruby"]测试[/pre]

正经脸。

你使用的脚本如果是从站内直接复制得到的话,如你所见,@被解析为[email],同时,
  1. [i]
复制代码
被当做编辑器代码未匹配到
[pre lang="ruby"]
[/pre]而消失掉了,所以建议找原作者要一份或者再搜索一下其他地方有没有这份脚本。

点评

你想表达什么  发表于 2016-3-11 23:54
233333333333333333333333333333  发表于 2016-3-11 23:43

评分

参与人数 1星屑 +266 收起 理由
cinderelmini + 266 大师球!

查看全部评分

回复

使用道具 举报

【欧皇】

梦石
3
星屑
2055
在线时间
1004 小时
注册时间
2013-8-19
回帖
3040

开拓者

 楼主| 发表于 2016-3-16 13:26:58 | 显示全部楼层
cinderelmini 发表于 2016-3-7 19:26
…….应该是坛子转码的锅……
代码框529行后面的取数组位置的i被坛子吃了……
改成这样: ...


找到了原脚本 能用了
点击展开/收起
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. # 欢迎访问[url]www.66RPG.com[/url]
  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号物品合成设定    速度粉末*10+玻璃瓶*1=暂时加速剂              
  104.    ##########################################################################
  105.    材料 = [49,50]        # 需要材料的数据库编号
  106.    材料种类 = [0,0]      # 需要材料的种类,0是普通物品,1是防具,2是武器
  107.    材料数量 = [10,1]     # 需要材料的数量
  108.    成品 = 34             # 获得物品编号
  109.    成品种类 = 0          # 获得物品种类,0是普通物品,1是防具,2是武器
  110.    @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  111.    
  112.    ##########################################################################
  113.    ####2号物品合成设定    复活水晶*1+速度粉末*8+玻璃瓶*1=精神药水                     
  114.    ##########################################################################
  115.    材料 = [35,49,50]     # 需要材料的数据库编号
  116.    材料种类 = [0,0,0]    # 需要材料的种类,0是普通物品,1是防具,2是武器
  117.    材料数量 = [1,8,1]    # 需要材料的数量
  118.    成品 = 51             # 获得物品编号
  119.    成品种类 = 0          # 获得物品种类,0是普通物品,1是防具,2是武器
  120.    @recipe_list[2] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  121.    ##########################################################################
  122.    ####3号物品合成设定    石头*30=石盾                       
  123.    ##########################################################################
  124.    材料 = [48]           # 需要材料的数据库编号
  125.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  126.    材料数量 = [30]       # 需要材料的数量
  127.    成品 = 79             # 获得物品编号
  128.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  129.    @recipe_list[3] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  130.    ##########################################################################
  131.    ##########################################################################
  132.    ####4号物品合成设定    铝锭*20=铝质头饰                       
  133.    ##########################################################################
  134.    材料 = [47]           # 需要材料的数据库编号
  135.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  136.    材料数量 = [20]       # 需要材料的数量
  137.    成品 = 35             # 获得物品编号
  138.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  139.    @recipe_list[4] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  140.    ##########################################################################
  141.    ##########################################################################
  142.    ####5号物品合成设定    铝锭*25=铝质胸甲                       
  143.    ##########################################################################
  144.    材料 = [47]           # 需要材料的数据库编号
  145.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  146.    材料数量 = [25]       # 需要材料的数量
  147.    成品 = 50             # 获得物品编号
  148.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  149.    @recipe_list[5] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  150.    ##########################################################################
  151.    ##########################################################################
  152.    ####6号物品合成设定    铝锭*15=铝质鞋子                       
  153.    ##########################################################################
  154.    材料 = [47]           # 需要材料的数据库编号
  155.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  156.    材料数量 = [15]       # 需要材料的数量
  157.    成品 = 65             # 获得物品编号
  158.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  159.    @recipe_list[6] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  160.    ##########################################################################
  161.    ##########################################################################
  162.    ####7号物品合成设定    铝锭*20=铝质小盾                       
  163.    ##########################################################################
  164.    材料 = [47]           # 需要材料的数据库编号
  165.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  166.    材料数量 = [20]       # 需要材料的数量
  167.    成品 = 80             # 获得物品编号
  168.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  169.    @recipe_list[7] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  170.    ##########################################################################
  171.    ##########################################################################
  172.    ####8号物品合成设定    铁锭*22=铁质面具                       
  173.    ##########################################################################
  174.    材料 = [46]           # 需要材料的数据库编号
  175.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  176.    材料数量 = [22]       # 需要材料的数量
  177.    成品 = 36             # 获得物品编号
  178.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  179.    @recipe_list[8] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  180.    ##########################################################################
  181.    ##########################################################################
  182.    ####9号物品合成设定    铁锭*28=铁质胸甲                       
  183.    ##########################################################################
  184.    材料 = [46]           # 需要材料的数据库编号
  185.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  186.    材料数量 = [28]       # 需要材料的数量
  187.    成品 = 51             # 获得物品编号
  188.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  189.    @recipe_list[9] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  190.    ##########################################################################
  191.    ##########################################################################
  192.    ####10号物品合成设定   铁锭*16=铁质鞋子                       
  193.    ##########################################################################
  194.    材料 = [46]           # 需要材料的数据库编号
  195.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  196.    材料数量 = [16]       # 需要材料的数量
  197.    成品 = 66             # 获得物品编号
  198.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  199.    @recipe_list[10] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  200.    ##########################################################################
  201.    ##########################################################################
  202.    ####11号物品合成设定   铁锭*23=铁质小盾                       
  203.    ##########################################################################
  204.    材料 = [46]           # 需要材料的数据库编号
  205.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  206.    材料数量 = [23]       # 需要材料的数量
  207.    成品 = 81             # 获得物品编号
  208.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  209.    @recipe_list[11] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  210.    ##########################################################################
  211.    ##########################################################################
  212.    ####12号物品合成设定    铜锭*24=铜质头盔                       
  213.    ##########################################################################
  214.    材料 = [45]           # 需要材料的数据库编号
  215.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  216.    材料数量 = [24]       # 需要材料的数量
  217.    成品 = 37             # 获得物品编号
  218.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  219.    @recipe_list[12] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  220.    ##########################################################################
  221.    ##########################################################################
  222.    ####13号物品合成设定    铜锭*31=黄铜护甲                     
  223.    ##########################################################################
  224.    材料 = [45]           # 需要材料的数据库编号
  225.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  226.    材料数量 = [31]       # 需要材料的数量
  227.    成品 = 52             # 获得物品编号
  228.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  229.    @recipe_list[13] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  230.    ##########################################################################
  231.    ##########################################################################
  232.    ####14号物品合成设定   铜锭*17=黄铜跑鞋                       
  233.    ##########################################################################
  234.    材料 = [45]           # 需要材料的数据库编号
  235.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  236.    材料数量 = [17]       # 需要材料的数量
  237.    成品 = 67             # 获得物品编号
  238.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  239.    @recipe_list[14] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  240.    ##########################################################################
  241.    ##########################################################################
  242.    ####15号物品合成设定   铜锭*26=黄铜盾牌                       
  243.    ##########################################################################
  244.    材料 = [45]           # 需要材料的数据库编号
  245.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  246.    材料数量 = [26]       # 需要材料的数量
  247.    成品 = 82             # 获得物品编号
  248.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  249.    @recipe_list[15] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  250.    ##########################################################################
  251.    ##########################################################################
  252.    ####16号物品合成设定    银锭*26=白银头盔                       
  253.    ##########################################################################
  254.    材料 = [62]           # 需要材料的数据库编号
  255.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  256.    材料数量 = [26]       # 需要材料的数量
  257.    成品 = 38             # 获得物品编号
  258.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  259.    @recipe_list[16] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  260.    ##########################################################################
  261.    ##########################################################################
  262.    ####17号物品合成设定    银锭*34=白银护甲                     
  263.    ##########################################################################
  264.    材料 = [62]           # 需要材料的数据库编号
  265.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  266.    材料数量 = [34]       # 需要材料的数量
  267.    成品 = 53             # 获得物品编号
  268.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  269.    @recipe_list[17] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  270.    ##########################################################################
  271.    ##########################################################################
  272.    ####18号物品合成设定   银锭*18=白银跑鞋                       
  273.    ##########################################################################
  274.    材料 = [62]           # 需要材料的数据库编号
  275.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  276.    材料数量 = [18]       # 需要材料的数量
  277.    成品 = 68             # 获得物品编号
  278.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  279.    @recipe_list[18] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  280.    ##########################################################################
  281.    ##########################################################################
  282.    ####19号物品合成设定   银锭*29=白银盾牌                       
  283.    ##########################################################################
  284.    材料 = [62]           # 需要材料的数据库编号
  285.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  286.    材料数量 = [29]       # 需要材料的数量
  287.    成品 = 83             # 获得物品编号
  288.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  289.    @recipe_list[19] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  290.    ##########################################################################
  291.    ##########################################################################
  292.    ####20号物品合成设定    金锭*28=黄金战盔                       
  293.    ##########################################################################
  294.    材料 = [44]           # 需要材料的数据库编号
  295.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  296.    材料数量 = [28]       # 需要材料的数量
  297.    成品 = 39             # 获得物品编号
  298.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  299.    @recipe_list[20] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  300.    ##########################################################################
  301.    ##########################################################################
  302.    ####21号物品合成设定    金锭*37=黄金铠甲                     
  303.    ##########################################################################
  304.    材料 = [44]           # 需要材料的数据库编号
  305.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  306.    材料数量 = [37]       # 需要材料的数量
  307.    成品 = 54             # 获得物品编号
  308.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  309.    @recipe_list[21] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  310.    ##########################################################################
  311.    ##########################################################################
  312.    ####22号物品合成设定    金锭*19=黄金飞靴                       
  313.    ##########################################################################
  314.    材料 = [44]           # 需要材料的数据库编号
  315.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  316.    材料数量 = [19]       # 需要材料的数量
  317.    成品 = 69             # 获得物品编号
  318.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  319.    @recipe_list[22] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  320.    ##########################################################################
  321.    ##########################################################################
  322.    ####23号物品合成设定    金锭*32=黄金盾牌                       
  323.    ##########################################################################
  324.    材料 = [44]           # 需要材料的数据库编号
  325.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  326.    材料数量 = [32]       # 需要材料的数量
  327.    成品 = 84             # 获得物品编号
  328.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  329.    @recipe_list[23] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  330.    ##########################################################################
  331.    ##########################################################################
  332.    ####24号物品合成设定    钻石*30=金刚战盔                       
  333.    ##########################################################################
  334.    材料 = [43]           # 需要材料的数据库编号
  335.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  336.    材料数量 = [30]       # 需要材料的数量
  337.    成品 = 40             # 获得物品编号
  338.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  339.    @recipe_list[24] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  340.    ##########################################################################
  341.    ##########################################################################
  342.    ####25号物品合成设定    钻石*40=金刚铠甲                     
  343.    ##########################################################################
  344.    材料 = [43]           # 需要材料的数据库编号
  345.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  346.    材料数量 = [40]       # 需要材料的数量
  347.    成品 = 55             # 获得物品编号
  348.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  349.    @recipe_list[25] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  350.    ##########################################################################
  351.    ##########################################################################
  352.    ####26号物品合成设定    钻石*20=金刚飞靴                       
  353.    ##########################################################################
  354.    材料 = [43]           # 需要材料的数据库编号
  355.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  356.    材料数量 = [20]       # 需要材料的数量
  357.    成品 = 70             # 获得物品编号
  358.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  359.    @recipe_list[26] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  360.    ##########################################################################
  361.    ##########################################################################
  362.    ####27号物品合成设定    钻石*35=金刚盾牌                       
  363.    ##########################################################################
  364.    材料 = [43]           # 需要材料的数据库编号
  365.    材料种类 = [0]        # 需要材料的种类,0是普通物品,1是防具,2是武器
  366.    材料数量 = [35]       # 需要材料的数量
  367.    成品 = 85             # 获得物品编号
  368.    成品种类 = 1          # 获得物品种类,0是普通物品,1是防具,2是武器
  369.    @recipe_list[27] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类)
  370.    ##########################################################################
  371.    end # of get_recipe_list method
  372. end # of updates to Game_Temp Class

  373. #================================
  374. # CRAFTING PROGRAM
  375. #----------------------------------------------------------------
  376. #-written by Deke
  377. #-yes_no window code created by Phsylomortis
  378. #----------------------------------------------------------------
  379. #================================

  380. #updates to Game_Party class

  381. class Game_Party
  382.   
  383.   attr_accessor       :recipes
  384.   
  385.   alias crafting_party_initialize initialize
  386.   
  387.   def initialize
  388.     crafting_party_initialize
  389.     @recipes=[]
  390.   end
  391.   
  392.   #----------------------------------------------------------------------
  393.   def know?(recipe, version = 1)
  394.     unless recipe.is_a?(Game_Recipe)
  395.       recipe = get_recipe_from_master_list(recipe, version)
  396.     end
  397.     return $game_party.recipes.include?(recipe)
  398.   end
  399.   
  400. #----------------------------------------------------------------------
  401.   def learn_recipe(recipe , version = 1)
  402.     unless recipe.is_a?(Game_Recipe)
  403.       recipe = get_recipe_from_master_list(recipe, version)
  404.     end
  405.     if recipe.is_a?(Game_Recipe)
  406.       unless know?(recipe)
  407.         @recipes.push(recipe)
  408.       end
  409.     end
  410.   end
  411.   
  412. #----------------------------------------------------------------------
  413.   def forget_recipe(recipe , version = 1)
  414.     if !recipe.is_a?(Game_Recipe)
  415.       recipe = get_recipe_from_master_list(recipe, version)
  416.     end
  417.     if recipe.is_a?(Game_Recipe)
  418.       for i in [email]0...@recipes.size[/email]
  419.         if recipe == @recipes[i]
  420.           index = i
  421.           break
  422.         end
  423.       end
  424.       if index != nil
  425.         @recipes.delete(@recipes[index])
  426.       end
  427.     end
  428.   end
  429.   
  430. #----------------------------------------------------------------------
  431.   def get_recipe_from_master_list(item, version)
  432.     index = nil
  433.     for i in 0...$game_temp.recipe_list.size
  434.       if item[0] == $game_temp.recipe_list[i].result and item[1] ==$game_temp.recipe_list[i].result_type
  435.         version -= 1
  436.         if version == 0
  437.           index = i
  438.           break
  439.         end
  440.       end
  441.     end
  442.     if index.is_a?(Integer)
  443.       return ($game_temp.recipe_list[index])
  444.     else
  445.       return false
  446.     end
  447.   end
  448.   
  449. end # of Game_Party updates

  450. #================================
  451. class Game_Recipe

  452.   attr_reader :ingredients
  453.   attr_reader :quantities
  454.   attr_reader :result
  455.   attr_reader :result_type
  456.   attr_reader :ingredient_types
  457.   attr_reader :craft_type  #物品分类
  458.   
  459. #----------------------------------------------------------------------
  460.   def initialize( ingredients, ingredient_types, quantities, result, result_type, craft_type=0)
  461.     @ingredients = ingredients
  462.     @ingredient_types = ingredient_types
  463.     @quantities = quantities
  464.     @result = result
  465.     @result_type = result_type
  466.     @craft_type = craft_type
  467.   end
  468.   
  469. #----------------------------------------------------------------------
  470.   def name
  471.     case @result_type
  472.       when 0
  473.         name = $data_items[@result].name
  474.       when 1
  475.         name = $data_armors[@result].name
  476.       when 2
  477.         name = $data_weapons[@result].name
  478.     end
  479.     return name
  480.   end
  481.   
  482. #----------------------------------------------------------------------

  483.   def item
  484.     case @result_type
  485.       when 0
  486.         item = $data_items[@result]
  487.       when 1
  488.         item = $data_armors[@result]
  489.       when 2
  490.         item = $data_weapons[@result]
  491.     end
  492.     return item
  493.   end

  494. #----------------------------------------------------------------------
  495.   def have
  496.     have_all = true
  497.     for i in [email]0...@ingredients.size[/email]
  498.       case @ingredient_types[i]
  499.         when 0
  500.           if $game_party.item_number(@ingredients[i]) < @quantities[i]
  501.             have_all=false
  502.           end
  503.         when 1
  504.           if $game_party.armor_number(@ingredients[i]) < @quantities[i]
  505.             have_all=false
  506.           end
  507.         when 2
  508.           if $game_party.weapon_number(@ingredients[i]) < @quantities[i]
  509.             have_all=false
  510.           end
  511.       end
  512.     end
  513.     return have_all
  514.   end

  515. #----------------------------------------------------------------------
  516.   def decrement
  517.     for i in [email]0...@ingredients.size[/email]
  518.       case @ingredient_types[i]
  519.       when 0
  520.         $game_party.lose_item(@ingredients[i], @quantities[i])
  521.       when 1
  522.         $game_party.lose_armor(@ingredients[i], @quantities[i])
  523.       when 2
  524.         $game_party.lose_weapon(@ingredients[i], @quantities[i])
  525.       end
  526.     end
  527.   end

  528. #----------------------------------------------------------------------
  529.   def make
  530.     if have
  531.       case @result_type
  532.       when 0
  533.         $game_party.gain_item(@result, 1)
  534.       when 1
  535.         $game_party.gain_armor(@result, 1)
  536.       when 2
  537.         $game_party.gain_weapon(@result, 1)
  538.       end
  539.       decrement
  540.     end
  541.   end
  542.   
  543. #----------------------------------------------------------------------
  544.   def == (recipe)
  545.     if recipe.is_a?(Game_Recipe)
  546.       equal = true
  547.       if recipe.ingredients != self.ingredients
  548.         equal = false
  549.       end
  550.       if recipe.ingredient_types != self.ingredient_types
  551.         equal = false
  552.       end
  553.       if recipe.quantities != self.quantities
  554.         equal = false
  555.       end
  556.       if recipe.result != self.result
  557.         equal=false
  558.       end
  559.       if recipe.result_type != self.result_type
  560.         equal = false
  561.       end
  562.     else
  563.       equal = false
  564.     end
  565.     return equal
  566.   end
  567.   
  568. end # of Game_Recipe class

  569. #===================================

  570. class Window_Craft < Window_Selectable
  571.   attr_reader :data #声明数据
  572.   #--------------------------------------------------------------------------
  573.   def initialize(craft_type=0)
  574.     @craft_type = craft_type
  575.     super(0, 64, 240, 416)
  576.     @column_max = 1
  577.     refresh
  578.     self.index = 0
  579.   end

  580.   #--------------------------------------------------------------------------
  581.   def recipe
  582.     return @data[self.index]
  583.   end

  584.   #--------------------------------------------------------------------------
  585.   def refresh
  586.     if self.contents != nil
  587.       self.contents.dispose
  588.       self.contents = nil
  589.     end
  590.     @data = []
  591.     for i in 0...$game_party.recipes.size
  592.        #@craft_type为0时就显示全部物品
  593.        #不为0时就显示对应物品
  594.       if @craft_type == 0
  595.         @data.push($game_party.recipes[i])
  596.       elsif $game_party.recipes[i].craft_type == @craft_type
  597.         @data.push($game_party.recipes[i])
  598.       end
  599.     end
  600.     @item_max = @data.size
  601.     if @item_max > 0
  602.       self.contents = Bitmap.new(width - 32, row_max * 32)
  603.       self.contents.font.name = "黑体" # = "黑体"
  604.       self.contents.font.size = 18 # = 18
  605.       for i in 0...@item_max
  606.         x = 16
  607.         y = i * 32
  608.         able = true
  609.         for ingredient in 0...@data[i].ingredients.size
  610.           case @data[i].ingredient_types[ingredient]
  611.           when 0
  612.             count = $game_party.item_number(@data[i].ingredients[ingredient])
  613.           when 1
  614.             count = $game_party.armor_number(@data[i].ingredients[ingredient])
  615.           when 2
  616.             count = $game_party.weapon_number(@data[i].ingredients[ingredient])
  617.           end
  618.           if count < @data[i].quantities[ingredient]
  619.             able = false
  620.             break
  621.           end
  622.         end
  623.         draw_item_name(@data[i].item, x, y, able)
  624.       end
  625.     end
  626.   end

  627.   #--------------------------------------------------------------------------
  628.   #def draw_item(index)
  629.   #  recipe = @data[index]
  630.   #  self.contents.font.color = recipe.have ? normal_color : disabled_color
  631.   #  x = 16
  632.   #  y = index * 32
  633.   #  self.contents.draw_text(x , y, self.width-32, 32, recipe.name, 0)
  634.   #end
  635.   
  636.   #--------------------------------------------------------------------------
  637.   # ● 描绘物品名
  638.   #     item : 物品
  639.   #     x    : 描画目标 X 坐标
  640.   #     y    : 描画目标 Y 坐标
  641.   #--------------------------------------------------------------------------
  642.   def draw_item_name(item, x, y, able = true)
  643.     if item == nil
  644.       return
  645.     end
  646.     if !able
  647.       self.contents.font.color = disabled_color
  648.     end
  649.     bitmap = RPG::Cache.icon(item.icon_name)
  650.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  651.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  652.     self.contents.font.color = normal_color
  653.   end
  654.   
  655.   #--------------------------------------------------------------------------
  656.   def update_help
  657.     current_recipe = recipe
  658.     if current_recipe.is_a?(Game_Recipe)
  659.     case current_recipe.result_type
  660.       when 0
  661.         description = $data_items[current_recipe.result].description
  662.       when 1
  663.         description = $data_armors[current_recipe.result].description
  664.       when 2
  665.         description = $data_weapons[current_recipe.result].description
  666.       end
  667.     else
  668.       description = ""
  669.     end
  670.     @help_window.set_text(description)
  671.     @help_window.update
  672.   end
  673.   
  674. end # of Window_Craft

  675. #=======================================
  676. class Window_CraftResult < Window_Base

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

  686.   #--------------------------------------------------------------------------
  687.   def refresh
  688.     self.contents.clear
  689.     case @type
  690.       when 0
  691.         item = $data_items[@result]
  692.         if item.recover_hp_rate > item.recover_hp
  693.           hp_string = "HP回复率:"
  694.           hp_stat = item.recover_hp_rate
  695.         else
  696.           hp_string = "HP回复量:"
  697.           hp_stat = item.recover_hp
  698.         end
  699.         if item.recover_sp_rate > item.recover_sp
  700.           sp_string = "SP回复率:"
  701.           sp_stat = item.recover_sp_rate
  702.         else
  703.           sp_string = "SP回复量:"
  704.           sp_stat = item.recover_sp
  705.         end
  706.         @strings = [hp_string, sp_string, "物理防御:" , "魔法防御:", "命中率:", "分散度:"]
  707.         @stats = [hp_stat, sp_stat, item. pdef_f, item.mdef_f, item.hit, item.variance,
  708.                        $game_party.item_number(@result)]
  709.         @bitmap = RPG::Cache.icon(item.icon_name)
  710.       when 1
  711.         item = $data_armors[@result]
  712.         @strings = ["物理防御:", "魔法防御:", "回避修正:", "力量增加:", "灵巧增加:",
  713.                        "速度增加:", "魔力增加:"]
  714.         @stats = [item.pdef, item.mdef, item.eva, item.str_plus, item.dex_plus,
  715.                     item.agi_plus, item.int_plus, $game_party.armor_number(@result) ]
  716.         @bitmap = RPG::Cache.icon(item.icon_name)
  717.       when 2
  718.         item = $data_weapons[@result]
  719.         @strings =["攻击力:", "物理防御:", "魔法防御:", "力量增加:", "灵巧增加:",
  720.                     "速度增加:", "魔力增加:"]
  721.         @stats = [item.atk, item.pdef, item.mdef, item.str_plus, item.dex_plus,
  722.                     item.agi_plus, item.int_plus, $game_party.weapon_number(@result) ]
  723.         @bitmap = RPG::Cache.icon(item.icon_name)
  724.     end
  725.     for i in [email]0...@strings.size[/email]
  726.       x = i%2 * 184
  727.       y = i /2 *28 +32
  728.       self.contents.font.color = normal_color
  729.       self.contents.draw_text(x,y,100, 28,@strings[i])
  730.       self.contents.font.color = system_color
  731.       self.contents.draw_text(x + 110, y, 45, 28, @stats[i].to_s)
  732.     end
  733.     self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, 24, 24), 255)
  734.     self.contents.font.color= normal_color
  735.     self.contents.draw_text(40, 0, 300, 28, "待合成物品的现有数量:")
  736.     self.contents.font.color = system_color
  737.     count = @stats[@stats.size - 1].to_s
  738.     self.contents.draw_text(294, 0, 45, 28, count )
  739.   end
  740.    
  741. #----------------------------------------------------------------------
  742.   def set_result(result , type)
  743.     @result = result
  744.     @type = type
  745.     refresh
  746.   end

  747. end #of Window_CraftResult

  748. #=======================================
  749. class Window_CraftIngredients < Window_Base

  750.   #--------------------------------------------------------------------------
  751.   def initialize
  752.     super(240, 248, 400, 232)
  753.     self.contents = Bitmap.new(width - 32, height - 32)
  754.     self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
  755.     self.contents.font.size = 18 # = 20
  756.     @ingredients = []
  757.     @types = []
  758.     @quantities = []
  759.     @item = nil
  760.     @count = 0
  761.     @counter = 0
  762.     @real_oy = 0
  763.   end

  764.   #--------------------------------------------------------------------------
  765.   def refresh
  766.     @counter = 0
  767.     self.contents.clear
  768.     self.contents = Bitmap.new(width - 32, @ingredients.size * 26)
  769.     for i in [email]0...@ingredients.size[/email]
  770.       case @types[i]
  771.       when 0
  772.         @item = $data_items[@ingredients[i]]
  773.         @count = $game_party.item_number(@ingredients[i])
  774.       when 1
  775.         @item = $data_armors[@ingredients[i]]
  776.         @count = $game_party.armor_number(@ingredients[i])
  777.       when 2
  778.         @item = $data_weapons[@ingredients[i]]
  779.         @count = $game_party.weapon_number(@ingredients[i])
  780.       end
  781.       y = i *26
  782.       self.contents.blt(0, y, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), 255)
  783.       self.contents.font.color = @count >= @quantities[i] ? normal_color : disabled_color
  784.       self.contents.draw_text(30, y, 280, 28, @item.name)
  785.       self.contents.draw_text(300, y, 45, 28, @quantities[i].to_s)
  786.       self.contents.font.color = system_color
  787.       self.contents.draw_text(245, y, 45, 28, @count.to_s )     
  788.     end
  789.   end
  790.       
  791.   #--------------------------------------------------------------------------
  792.   def set_ingredients(ingredients , types, quantities)
  793.     @ingredients = ingredients
  794.     @types = types
  795.     @quantities = quantities
  796.     refresh
  797.     if @ingredients.size > 7
  798.       self.oy = -52
  799.       @real_oy = 0
  800.     else
  801.       self.oy = 0
  802.     end
  803.   end

  804.   def update
  805.     super
  806.     @counter += 1
  807.     if @ingredients.size > 7 and @counter > 30
  808.       @real_oy = (@real_oy + 1) % ((@ingredients.size - 3) * 26)
  809.       self.oy = @real_oy - 52
  810.     end
  811.   end
  812.    
  813. end # of Window_CraftIngredients

  814. #======================================
  815. class Scene_Craft

  816.   #--------------------------------------------------------------------------
  817.   # @craft_type:物品种类,0就是全部
  818.   def initialize(craft_type=0,craft_index=0)
  819.     @craft_index=craft_index
  820.     @craft_type = craft_type
  821.   end
  822.   
  823.   #--------------------------------------------------------------------------
  824.   def main
  825.     @craft_window = Window_Craft.new(@craft_type)
  826.     @craft_window.index=@craft_index
  827.     @confirm_window = Window_Base.new(120, 188, 400, 64)
  828.     @confirm_window.contents = Bitmap.new(368, 32)
  829.     @confirm_window.contents.font.name = "黑体"
  830.     @confirm_window.contents.font.size = 20
  831.     @help_window = Window_Help.new
  832.     @craft_window.help_window = @help_window
  833.     @result_window=Window_CraftResult.new
  834.     @ingredients_window=Window_CraftIngredients.new
  835.     if @craft_window.data.size > 0 #本类窗口物品大于0的话
  836.       @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
  837.       @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
  838.                                                           @craft_window.recipe.ingredient_types,
  839.                                                           @craft_window.recipe.quantities)
  840.     end
  841.     @yes_no_window = Window_Command.new(100, ["确定", "放弃"])
  842.     @confirm_window.visible = false
  843.     @confirm_window.z = 1500
  844.     @yes_no_window.visible = false
  845.     @yes_no_window.active = false
  846.     @yes_no_window.index = 1
  847.     @yes_no_window.x = 270
  848.     @yes_no_window.y = 252
  849.     @yes_no_window.z = 1500
  850.     @label_window = Window_Base.new(450,200,190,52)
  851.     @label_window.contents=Bitmap.new(@label_window.width - 32,@label_window.height - 32)
  852.     @label_window.contents.font.size=20
  853.     @label_window.contents.font.color = @label_window.normal_color
  854.     @label_window.contents.font.name = "黑体"
  855.     @label_window.contents.draw_text(0, 0, @label_window.contents.width, 20, "  现有   需要")
  856.     Graphics.transition
  857.     loop do
  858.       Graphics.update
  859.       Input.update
  860.       update
  861.       if $scene != self
  862.         break
  863.       end
  864.     end
  865.     Graphics.freeze
  866.     @help_window.dispose
  867.     @craft_window.dispose
  868.     @result_window.dispose
  869.     @ingredients_window.dispose
  870.     @confirm_window.dispose
  871.     @yes_no_window.dispose
  872.     @label_window.dispose
  873.   end

  874.   #--------------------------------------------------------------------------
  875.   def update
  876.     @craft_window.update
  877.     @ingredients_window.update
  878.     if @craft_window.active
  879.       update_craft
  880.       return
  881.     end
  882.     if @yes_no_window.active
  883.       confirm_update
  884.       return
  885.     end
  886.   end

  887.   #--------------------------------------------------------------------------
  888.   def update_craft
  889.     if Input.dir4 != 0
  890.       if @craft_window.data.size > 0 #本类窗口物品大于0的话
  891.         @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
  892.         @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
  893.                                                            @craft_window.recipe.ingredient_types,
  894.                                                            @craft_window.recipe.quantities)
  895.       end
  896.     end
  897.     if Input.trigger?(Input::B)
  898.       $game_system.se_play($data_system.cancel_se)
  899.       $scene = Scene_Map.new
  900.       return
  901.     end
  902.     if Input.trigger?(Input::C) and $game_party.recipes.size != 0
  903.       @recipe = @craft_window.recipe
  904.       if @recipe != nil
  905.         if @recipe.have
  906.           @yes_no_window.active = true
  907.           @craft_window.active = false
  908.         else
  909.           $game_system.se_play($data_system.buzzer_se)
  910.           return
  911.         end
  912.       else
  913.         $game_system.se_play($data_system.buzzer_se)
  914.         return
  915.       end
  916.     end
  917.   end

  918.   #--------------------------------------------------------------------------
  919.   def confirm_update
  920.     @craft_index = @craft_window.index
  921.     @confirm_window.visible = true
  922.     @confirm_window.z = 1500
  923.     @yes_no_window.visible = true
  924.     @yes_no_window.active = true
  925.     @yes_no_window.z = 1500
  926.     @yes_no_window.update
  927.     string = "合成 " + @recipe.name + "?"
  928.     cw = @confirm_window.contents.text_size(string).width
  929.     center = @confirm_window.contents.width/2 - cw /2
  930.     unless @drawn
  931.       @confirm_window.contents.draw_text(center, 0, cw, 30, string)
  932.       @drawn = true
  933.     end
  934.     if Input.trigger?(Input::C)
  935.       if @yes_no_window.index == 0
  936.         $game_system.se_play($data_system.decision_se)
  937.         @recipe.make
  938.         $game_system.se_play($data_system.save_se)
  939.         $scene=Scene_Craft.new(@craft_type,@craft_index)
  940.       else
  941.         $game_system.se_play($data_system.cancel_se)
  942.         $scene=Scene_Craft.new(@craft_type,@craft_index)
  943.       end
  944.     end
  945.     if Input.trigger?(Input::B)
  946.       $game_system.se_play($data_system.cancel_se)
  947.       $scene=Scene_Craft.new(@craft_type,@craft_index)
  948.     end
  949.   end

  950. end # of Scene_Craft

  951. #==============================================================================
  952. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  953. # 欢迎访问[url]www.66RPG.com[/url]
  954. # 梦想世界,在你手中
  955. #==============================================================================
复制代码

为什么物品合成脚本545行出错 - RPG Maker XP 提问区 - 66RPG - Powered by Discuz!.p.png 首页.png
懒癌中期由于现在的我看不懂脚本了所以想再伸一下手把划红线的去掉
QQ:2223942063
Q群:365819625
贪吃方1.4
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部