Olá pessoal, eu tenho um sistema de level system para pokemons, só que quando um player mata um pokemon sem estar com seu pokemon para fora, da esse erro
datapack/creaturescripts/scripts/pokelevel.lua:onKill
(luaGetItemAttribute) Item not found
Como faço para quando o player não tiver com o poke pra fora e matar outro pokemon (no soco) não acontecer esse erro?
script:
function onKill(cid, target)
------------------ VARIAVEIS ------------------------------------------------------------------------------------------------------------
local posss = getCreaturePosition(cid)
local exppp = math.random(15, 75)
local feet = getPlayerSlotItem(cid, CONST_SLOT_FEET)
local chck = getItemAttribute(feet.uid, "exp")
local chckc = getItemAttribute(feet.uid, "level")
local mypoke = getCreatureSummons(cid)[1]
local boostlevel = getItemAttribute(feet.uid, "boost") or 0
-----------------------------------------------------------------------------------------------------------------------------------------
if isPlayer(target) == false and getItemAttribute(feet.uid, "level") == 100 then
--doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Limite de Level do Pokemon Atingido !")
return true
end
if isPlayer(cid) == true and isSummon(target) == true then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your Pokemon dont gain experience in Duel")
return true
end
---------------------------------------------------------------- level 1 ----------------------------------------------------------------
if isPlayer(target) == FALSE and getItemAttribute(feet.uid, "level") == False then
return true
end
if isPlayer(target) == FALSE and getItemAttribute(feet.uid, "level") == 1 and getItemAttribute(feet.uid, "exp") >= 0 and getItemAttribute(feet.uid, "exp") <= 250 then
doItemSetAttribute(feet.uid, "exp", chck +exppp) doSendAnimatedText(getThingPos(mypoke), ""..exppp.." (EXP)", 215)
return true
end
if isPlayer(target) == FALSE and getItemAttribute(feet.uid, "exp") >= 250 and getItemAttribute(feet.uid, "level") == 1 then
doPlayerSendTextMessage(cid, 25, "Seu "..getCreatureName(mypoke).." avançou do nível 1 para o nível 2!")
doItemSetAttribute(feet.uid, "level", chckc +1) doSendAnimatedText(getCreaturePosition(getCreatureSummons(cid)[1]), "LEVEL UP!", 215) doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 211) doSendAnimatedText(getCreaturePosition(getCreatureSummons(cid)[1]), "LEVEL UP!", 215) doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 211)
doItemSetAttribute(feet.uid, "exp", 1) local nick = ""..getCreatureName(getCreatureSummons(cid)[1]).." ["..getItemAttribute(feet.uid, "level").."]" doCreatureSetNick(getCreatureSummons(cid)[1], nick)
return true
end
------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------- level 2 ----------------------------------------------------------------
if isPlayer(target) == FALSE and getItemAttribute(feet.uid, "level") == False then
return true
end
if isPlayer(target) == FALSE and getItemAttribute(feet.uid, "level") == 2 and getItemAttribute(feet.uid, "exp") >= 0 and getItemAttribute(feet.uid, "exp") <= 500 then
doItemSetAttribute(feet.uid, "exp", chck +exppp) doSendAnimatedText(getThingPos(mypoke), ""..exppp.." (EXP)", 215)
return true
end
if isPlayer(target) == FALSE and getItemAttribute(feet.uid, "exp") >= 500 and getItemAttribute(feet.uid, "level") == 2 then
doPlayerSendTextMessage(cid, 25, "Seu "..getCreatureName(mypoke).." avançou do nível 2 para o nível 3!")
doItemSetAttribute(feet.uid, "level", chckc +1) doSendAnimatedText(getCreaturePosition(getCreatureSummons(cid)[1]), "LEVEL UP!", 215) doSendMagicEffect(getCreaturePosition(getCreatureSummons(cid)[1]), 211)
doItemSetAttribute(feet.uid, "exp", 1) local nick = ""..getCreatureName(getCreatureSummons(cid)[1]).." ["..getItemAttribute(feet.uid, "level").."]" doCreatureSetNick(getCreatureSummons(cid)[1], nick)
return true
end
end