Olá galera tou com dificuldade no seguinte script, esse script e de um npc que heala pokemons dentro de uma pokeball, gostaria de add todas as pokebals nesse mesmo script pq so pega a pokeball normal, ja tentei de tudo mas como sou meio leigo nem tive resultado o script e o:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'heal') then
if #getCreatureSummons(cid) >= 1 then
return selfSay('Voce precisa botar seus pokemons dentro da pokebola.', cid)
end
for slo = CONST_SLOT_FIRST, CONST_SLOT_LAST do
local item = getPlayerSlotItem(cid, slo)
if isContainer(item.uid) then
local items = getItemsInContainerById(item.uid, pokeout)
for i,x in pairs(items) do
local maxh = tonumber(getItemAttribute(x, "poke"):match("/(.+)]"))
doItemSetAttribute(x, "poke", getItemAttribute(x, "poke"):sub(1, findLetter(getItemAttribute(x, "poke"), ".")) .. " HP = ["..maxh.."/"..maxh.."]")
doTransformItem(x, pokein)
end
local items2 = getItemsInContainerById(item.uid, pokein)
for i,x in pairs(items2) do
local maxh = tonumber(getItemAttribute(x, "poke"):match("/(.+)]"))
doItemSetAttribute(x, "poke", getItemAttribute(x, "poke"):sub(1, findLetter(getItemAttribute(x, "poke"), ".")) .. " HP = ["..maxh.."/"..maxh.."]")
end
elseif item.itemid == pokeout or item.itemid == pokein then
local maxh = tonumber(getItemAttribute(item.uid, "poke"):match("/(.+)]"))
doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke"):sub(1, findLetter(getItemAttribute(item.uid, "poke"), ".")) .. " HP = ["..maxh.."/"..maxh.."]")
doTransformItem(item.uid, pokein)
end
end
selfSay('Pronto, voce e seus pokemons estao com a life maxima.', cid)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())