RGSS'Game_Party'的199行type Error发生错误
nil can't be coerced into Fixnum
取出装备就说199行有错,取出防具就说201行有错,这是他说的脚本
#--------------------------------------------------------------------------
# ● 增加物品(减少)
# item : 物品
# n : 个数
# include_equip : 包括装备
#--------------------------------------------------------------------------
def gain_item(item, n, include_equip = false)
number = item_number(item)
case item
when RPG::Item
@items[item.id] = [[number + n, 0].max, 99].min
when RPG::Weapon
++++199 @weapons[item.id] = [[number + n, 0].max, 99].min
++++200 when RPG::Armor
++++201 @armors[item.id] = [[number + n, 0].max, 99].min
end
n += number
if include_equip and n < 0
for actor in members
while n < 0 and actor.equips.include?(item)
actor.discard_equip(item)
n += 1
end
end
end
end
各位帮忙看看如何解决…… [LINE]1,#dddddd[/LINE]此贴于 2008-10-28 18:31:25 被版主八云紫提醒,请楼主看到后对本贴做出回应。 [LINE]1,#dddddd[/LINE]本贴由论坛斑竹八云紫结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^作者: 亿万星辰 时间: 2008-10-25 00:48
重新写了一下开头到201行,没看过item_number这个方法的定义,不确定是否是这个问题。
def gain_item(item, n, include_equip = false)
case item
when RPG::Item
number = item_number(item)
@items[item.id] = [[number + n, 0].max, 99].min
when RPG::Weapon
number = weapon_number(item)
@weapons[item.id] = [[number + n, 0].max, 99].min
when RPG::Armor
number = armor_number(item)
@armors[item.id] = [[number + n, 0].max, 99].min # 201