kito2
www.masteria.net
ok, I'll test it when I have 0.4_DEV compiled.
http://otland.net/f249/forgotten-server-0-4-3706-compiled-d__war_system__-always-updated-80932/
ok, I'll test it when I have 0.4_DEV compiled.
[19:56:04.857] [Error - CreatureScript Interface]
[19:56:04.857] data/creaturescripts/scripts/monster_weapon_upgrade.lua:onKill
[19:56:04.858] Description:
[19:56:04.858] ...a/creaturescripts/scripts/monster_weapon_upgrade.lua:68: attem
pt to compare nil with number
[19:56:04.858] stack traceback:
[19:56:04.859] ...a/creaturescripts/scripts/monster_weapon_upgrade.lua:68: in f
unction <...a/creaturescripts/scripts/monster_weapon_upgrade.lua:42>
--[[
** Monster weapon upgrader by slawkens **
kills - how much monsters must be killed
extraAttack - how much extraAttack points will this weapon get
extraAttackLimit - you can set limit of extraAttack points added
]]--
local monsters = {
['rat'] = {
[2395] = {
kills = 3,
extraAttack = 1,
extraAttackLimit = 3,
storage = 19332
}
},
['dragon'] = {
[2383] = {
kills = 500,
extraAttack = 1,
extraAttackLimit = 20,
storage = 34001
}
}
}
function onKill(cid, target, damage, flags)
if not isMonster(target) or not isInArray({1,2,3},flags) then
return true
end
if not monsters[getCreatureName(target):lower()] then
return true
end
local playerWeapon = getPlayerWeapon(cid, true)
if playerWeapon.itemid == 0 then
return true
end
if not monsters[getCreatureName(target):lower()][playerWeapon.itemid] then
return true
end
doSendAnimatedText(getThingPos(cid), 'CHECK1!', COLOR_LIGHTBLUE)
local weapon = monsters[getCreatureName(target):lower()][playerWeapon.itemid]
local currentExtraAttack = getItemAttribute(playerWeapon.uid, 'extraattack') == nil and 0 or getItemAttribute(playerWeapon.uid, 'extraattack')
doCreatureSetStorage(cid, weapon.storage, math.max(1,getCreatureStorage(cid, weapon.storage)+1))
doSendAnimatedText(getThingPos(cid), 'CHECK2!', COLOR_LIGHTBLUE)
if getCreatureStorage(cid, weapon.storage) >= weapon.kills and currentExtraAttack < weapon.extraAttackLimit then
doCreatureSetStorage(cid, weapon.storage, 0)
doSendAnimatedText(getThingPos(cid), 'CHECK3!', COLOR_LIGHTBLUE)
doItemSetAttribute(playerWeapon.uid, 'extraattack', currentExtraAttack + weapon.extraAttack)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations! Your weapon received +' .. weapon.extraAttack .. ' attack points and now have total extra damage of +' .. (currentExtraAttack + weapon.extraAttack) .. ' points!')
end
return true
end
Nil means nothing right?
So if it is attempting to compare nothing with a number... Maybe look back over it one more time, that line is comparing something that has no value to something that does, so problem could be with that line, or problem could also be before that line....
0.4 fix
Code:--[[ ** Monster weapon upgrader by slawkens ** kills - how much monsters must be killed extraAttack - how much extraAttack points will this weapon get extraAttackLimit - you can set limit of extraAttack points added ]]-- local monsters = { ['rat'] = { [2395] = { kills = 3, extraAttack = 1, extraAttackLimit = 3, storage = 19332 } }, ['dragon'] = { [2383] = { kills = 500, extraAttack = 1, extraAttackLimit = 20, storage = 34001 } } } function onKill(cid, target, damage, flags) if not isMonster(target) or not isInArray({1,2,3},flags) then return true end if not monsters[getCreatureName(target):lower()] then return true end local playerWeapon = getPlayerWeapon(cid, true) if playerWeapon.itemid == 0 then return true end if not monsters[getCreatureName(target):lower()][playerWeapon.itemid] then return true end doSendAnimatedText(getThingPos(cid), 'CHECK1!', COLOR_LIGHTBLUE) local weapon = monsters[getCreatureName(target):lower()][playerWeapon.itemid] local currentExtraAttack = getItemAttribute(playerWeapon.uid, 'extraattack') == nil and 0 or getItemAttribute(playerWeapon.uid, 'extraattack') doCreatureSetStorage(cid, weapon.storage, math.max(1,getCreatureStorage(cid, weapon.storage)+1)) doSendAnimatedText(getThingPos(cid), 'CHECK2!', COLOR_LIGHTBLUE) if getCreatureStorage(cid, weapon.storage) >= weapon.kills and currentExtraAttack < weapon.extraAttackLimit then doCreatureSetStorage(cid, weapon.storage, 0) doSendAnimatedText(getThingPos(cid), 'CHECK3!', COLOR_LIGHTBLUE) doItemSetAttribute(playerWeapon.uid, 'extraattack', currentExtraAttack + weapon.extraAttack) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations! Your weapon received +' .. weapon.extraAttack .. ' attack points and now have total extra damage of +' .. (currentExtraAttack + weapon.extraAttack) .. ' points!') end return true end