Ir para conteúdo

Posts Recomendados

Estou com um problema no go/backd o MatheusMkalo

 

Ele buga a pokebola as vezes e fica com HP=XXX A MAXH=-1

 

 

Com o maxhealth -1 a npc heal nao consegue healar a pokebola. Queria que alguem fizesse uma table nesse script para ao inves de pegar o hp da description da pokebola pegasse na table.

 

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, Seus pokemons estao com a vida maxima.', cid)  
   end
   return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Link para o comentário
https://xtibia.com/forum/topic/145058-bug-no-goback/
Compartilhar em outros sites

×
×
  • Criar Novo...