Criei um NPC pra uma Quest com 5 tasks, mas não ta funcionando direito, e não consegui encontrar o erro no script. Provavelmente é algum erro nas talkState ou nas storage. Poderiam me ajudar? 
	Servidor 8.6.
 
	Segue o lua do NPC:
 
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
local storage = 5000
function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        if msg == "hi" or msg == "hello" then
            if getPlayerStorageValue(cid, storage) == -1 then
                selfSay("Hello " .. getPlayerName ..
                            ". I am kind of busy right now. But, 50 points to gryffindor, anyways.", cid)
                talkState[talkUser] = 1
            elseif getPlayerStorageValue(cid, storage) == 1 then
                selfSay("Did you find it already? By now, Mr Potter would've brought it to me already..", cid)
                talkState[talkUser] = 2
            elseif getPlayerStorageValue(cid, storage) == 3 then
                selfSay("Did you find it already? By now, Mr Potter would've brought it to me already..", cid)
                talkState[talkUser] = 3
            elseif getPlayerStorageValue(cid, storage) == 5 then
                selfSay("Did you find it already? By now, Mr Potter would've brought it to me already..", cid)
                talkState[talkUser] = 4
            elseif getPlayerStorageValue(cid, storage) == 7 then
                selfSay("Did you find it already? By now, Mr Potter would've brought it to me already..", cid)
                talkState[talkUser] = 5
            elseif getPlayerStorageValue(cid, storage) == 9 then
                selfSay("Did you find it already? By now, Mr Potter would've brought it to me already..", cid)
                talkState[talkUser] = 6
            else
                selfSay("Thank you for helping me, " .. getPlayerName .. ".", cid)
            end
            npcHandler:addFocus(cid)
        else
            return false
        end
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 1 or cid
    if msgcontains(msg, "job") or msgcontains(msg, "quest") or msgcontains(msg, "mission") or msgcontains(msg, "help") then
        if getPlayerStorageValue(cid, storage) == -1 then
            selfSay(
                "Ah, so you'd like to help me?! It looks like I misplaced some important items. Would you like to help me finding them?",
                cid)
            talkState[talkUser] = 1
        elseif getPlayerStorageValue(cid, storage) == 10 then
            selfSay("I don't have more missions for you right now.", cid)
            talkState[talkUser] = 1
        end
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
        if getPlayerStorageValue(cid, storage) == -1 then
            selfSay(
                "Good. The first item is Rowena Ravenclaw's Diadem. Look for the {Grey Lady} in Ravenclaw's Common Room and ask her about this {horcrux}, and she might help you. Come back once you have it",
                cid)
            setPlayerStorageValue(cid, storage, 1)
        else
            if doPlayerRemoveItem(cid, 2139, 1) then
                selfSay("You found it, " .. getPlayerName .. "! 50 points to your house. And... a few galeons too, so you can buy some candy at Honeydukes. Are you ready for the next task?",
                    cid)
                doPlayerAddItem(cid, 2160, 3)
                doPlayerAddExp(cid, 250000)
                setPlayerStorageValue(cid, storage, 2)
                talkState[talkUser] = 2
            end
        end
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 2 then
        if getPlayerStorageValue(cid, storage) == 2 then
            selfSay(
                "The next artifact is Tom Riddle's Diary. Look for a statue in Slytheryn's Common Room, and it should lead you to it's location.",
                cid)
            setPlayerStorageValue(cid, storage, 3)
        else
            if doPlayerRemoveItem(cid, 10563, 1) then
                selfSay(
                    "Ah, about time! 50 more points to your house, and a few more galeons.. yada yada. Ready for the next task?",
                    cid)
                doPlayerAddItem(cid, 2160, 2)
                doPlayerAddItem(cid, 2152, 50)
                doPlayerAddExp(cid, 250000)
                setPlayerStorageValue(cid, storage, 4)
                talkState[talkUser] = 3
            end
        end
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 3 then
        if getPlayerStorageValue(cid, storage) == 4 then
            selfSay(
                "The third item is Helga Hufflepuff's Cup. Maybe {Bogrod} knows something about it. You can find him at the Depot, to the west of the Castle.",
                cid)
            setPlayerStorageValue(cid, storage, 5)
        else
            if doPlayerRemoveItem(cid, 7369, 1) then
                selfSay("Great, " .. getPlayerName ..
                            "! Although.. I ran out of galeons... I'll give you a little more experience points this time. Ready for the next task?",
                    cid)
                doPlayerAddExp(cid, 500000)
                setPlayerStorageValue(cid, storage, 6)
                talkState[talkUser] = 4
            end
        end
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 4 then
        if getPlayerStorageValue(cid, storage) == 6 then
            selfSay(
                "The fourth item is Salazar Slytherin's Locket. The {Bloody Baron} might have some information about it. You can find him at Slytherin's Common Room. Don't forget to ask him about the {horcrux}, or he won't give you any leads.",
                cid)
            setPlayerStorageValue(cid, storage, 7)
        else
            if doPlayerRemoveItem(cid, 7889, 1) then
                selfSay("Good, good. More galeons to your account, " .. getPlayerName .. ". Ready for the last task?",
                    cid)
                doPlayerAddItem(cid, 2160, 5)
                doPlayerAddItem(cid, 2152, 75)
                doPlayerAddExp(cid, 500000)
                setPlayerStorageValue(cid, storage, 8)
                talkState[talkUser] = 5
            end
        end
    elseif msgcontains(msg, "yes") and talkState[talkUser] == 5 then
        if getPlayerStorageValue(cid, storage) == 8 then
            selfsay(
                "The last item is Marvolo Gaunt's Ring. It's guarded by.. an.. creature. You might have to talk to Hagrid in order to locate it. Don't forget to ask him about the {horcrux}, or he won't give you any leads. And, " ..
                    getPlayerName .. ", good luck!", cid)
            setPlayerStorageValue(cid, storage, 9)
        else
            if doPlayerRemoveItem(cid, 2121, 1) then
                selfSay("" .. getPlayerName ..
                            ", you made it alive! I mean.. I knew you would. *coughs*. Thank you very much for helping me. 100 points to your house, " ..
                            getPlayerName .. ". And my last galeons too.", cid)
                doPlayerAddItem(cid, 2160, 10)
                doPlayerAddExp(cid, 7500)
                setPlayerStorageValue(cid, storage, 10)
                talkState[talkUser] = 6
            end
        end
    elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
        selfSay("Nevermind. -10 points to your house.", cid)
        talkState[talkUser] = 0
    end
    return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())