Eu recebo um erro no sistema de upgrade depois de usar o item de refinamento no item a ser refinado, isso acontece algumas vezes e nada acontece com o item de refinamento ou o item que está sendo refinado, mas há momentos em que o item refina normalmente.
Erro:
Lua Script Error: [Action Interface]
data/actions/scripts/upgrade.lua:onUse
data/actions/scripts/upgrade.lua:52: attempt to compare number with nil
Linha de Erro:
if(nLevel > level)then
Codigo:
Spoiler
local conf ={["level"]={--[item_level]={successPercent= CHANCE TO UPGRADE ITEM, downgradeLevel = ITEM GETS THIS LEVEL IF UPGRADE FAILS}[1]={successPercent =90},[2]={successPercent =80},[3]={successPercent =70},[4]={successPercent =60},[5]={successPercent =50},[6]={successPercent =40, downgradeLevel =5},[7]={successPercent =30, downgradeLevel =6},[8]={successPercent =25, downgradeLevel =7},[9]={successPercent =20, downgradeLevel =8},[10]={successPercent =15, downgradeLevel =9}},["upgrade"]={-- how many percent attributes are rised?
attack =2,-- attack %
defense =2,-- defense %
extraDefense =5,-- extra defense %
armor =2,-- armor %}}--// do not touch // ----Upgrading system byAzi[Ersiu]----Editedfor TFS 1.1byZbizu--local upgrading ={
upValue =function(value, level, percent)if value <0thenreturn0endif level ==0thenreturn value endlocal nVal = value
for i =1, level do
nVal = nVal +(math.ceil((nVal/100*percent)))endreturn nVal >0and nVal or value
end,
getLevel =function(item)local name =Item(item):getName():split('+')if(#name ==1)thenreturn0endreturn math.abs(name[2])end,}function onUse(cid, item, fromPosition, itemEx, toPosition)
player = cid
cid = cid:getId()local it =ItemType(itemEx.itemid)if(((it:getWeaponType()>0and it:getWeaponType()~= WEAPON_WAND)or getItemAttribute(itemEx.uid, ITEM_ATTRIBUTE_ARMOR)>0)andnot isItemStackable(itemEx.itemid))thenlocal level = upgrading.getLevel(itemEx.uid)if(level <#conf["level"])thenlocal nLevel =(conf["level"][(level+1)].successPercent >= math.random(1,100))and(level+1)or conf["level"][level].downgradeLevel
if(nLevel > level)then
doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Upgrade to level ".. nLevel .." successful!")else
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Upgrade failed. Your ".. it:getName().." is now on level ".. nLevel .."")end
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_NAME, it:getName()..((nLevel>0)and"+"..nLevel or""))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_ATTACK, upgrading.upValue(it:getAttack(), nLevel, conf["upgrade"].attack))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_DEFENSE, upgrading.upValue(it:getDefense(), nLevel, conf["upgrade"].defense))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_EXTRADEFENSE, upgrading.upValue(it:getExtraDefense(), nLevel, conf["upgrade"].extraDefense))
doItemSetAttribute(itemEx.uid, ITEM_ATTRIBUTE_ARMOR, upgrading.upValue(it:getArmor(), nLevel, conf["upgrade"].armor))
doRemoveItem(item.uid,1)else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Your ".. it:getName().." is on max level alredy.")endelse
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You cannot upgrade this item.")endend
Base: TFS 1.3 Custom
Eu recebo um erro no sistema de upgrade depois de usar o item de refinamento no item a ser refinado, isso acontece algumas vezes e nada acontece com o item de refinamento ou o item que está sendo refinado, mas há momentos em que o item refina normalmente.
Erro:
Lua Script Error: [Action Interface] data/actions/scripts/upgrade.lua:onUse data/actions/scripts/upgrade.lua:52: attempt to compare number with nil
Linha de Erro:
Codigo:
Adicionado linha de erro
Compartilhar este post
Link para o post
Compartilhar em outros sites