Qual o motivo deste tópico?
Estou tendo esse erro ao utilizar a Pokebar: Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/usesummon.lua:onSay
data/talkactions/scripts/usesummon.lua:4: attempt to index global 'ball' (a nil value)
stack traceback:
[C]: in function '__index'
data/talkactions/scripts/usesummon.lua:4: in function <data/talkactions/scripts/usesummon.lua:3>
Você tem o código disponível? Se tiver publique o aqui: Usesummons.lua:
function onSay(player, words, param)
print("Tentando invocar Pokémon com a ball ID: " .. ball:getId())
if player:isSummonBlocked() then return false end
if doReleaseSummon(player:getId(), player:getPosition(), balls[ballKey].effectRelease, true, balls[ballKey].missile) then
ball:transform(balls[ballKey].usedOff)
ball:setSpecialAttribute("isBeingUsed", 1)
else
player:sendTextMessage(MESSAGE_STATUS_SMALL, "Não foi possível usar este Pokémon.")
ball:setSpecialAttribute("isBeingUsed", 0) -- Reseta o status da ball para garantir que possa ser usada novamente
end
local index = tonumber(param)
if not index then return false end
local exhaust = Condition(CONDITION_EXHAUST_WEAPON)
if player:isDuelingWithNpc() then
exhaust:setParameter(CONDITION_PARAM_TICKS, 10000)
else
exhaust:setParameter(CONDITION_PARAM_TICKS, 1000)
end
if player:getCondition(CONDITION_EXHAUST_WEAPON) then
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
return false
end
local pokeballs = player:getPokeballs()
local ball = pokeballs[index]
-- local ball = player:getSpecialStorage("pokes")[index]
if not ball then
print("WARNING! Player " .. player:getName() .. " had problems trying to use pokebar: selected ball not found.")
player:refreshPokemonBar({}, {})
return false
end
if player:canReleaseSummon(ball:getSummonLevel(), ball:getSummonBoost(), ball:getSummonOwner()) then
if hasSummons(player) then
local usingBall = player:getUsingBall()
if not usingBall then
print("WARNING! Player " .. player:getName() .. " had problems trying to use pokebar: doRemoveSummon.")
player:refreshPokemonBar({}, {})
return false
end
if usingBall:getId() == ball:getId() then
local usingBallKey = getBallKey(usingBall:getId())
doRemoveSummon(player:getId(), balls[usingBallKey].effectRelease, false, true, balls[usingBallKey].missile)
usingBall:transform(balls[usingBallKey].usedOn)
player:addCondition(exhaust)
return false
end
local usingBallKey = getBallKey(usingBall:getId())
doRemoveSummon(player:getId(), balls[usingBallKey].effectRelease, false, true, balls[usingBallKey].missile)
usingBall:transform(balls[usingBallKey].usedOn)
player:addCondition(exhaust)
end
local ballKey = getBallKey(ball:getId())
ball:transform(balls[ballKey].usedOff)
ball:setSpecialAttribute("isBeingUsed", 1)
doReleaseSummon(player:getId(), player:getPosition(), balls[ballKey].effectRelease, true, balls[ballKey].missile)
player:addCondition(exhaust)
end
return false
end
Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.