• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPC doesn't answer?

GarQet

Own3d!
Joined
Feb 10, 2009
Messages
1,381
Solutions
14
Reaction score
81
Hello I made a simple script to my OT but unfortunately it doesn't work correctly.
NPC doesn't answer when i say 'mieszanka', behaves as if it froze. I don't see any bugs in the code as well as in the console. Maybe someone of you see trifle mistake?
This is the script:
Code:
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
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    local storage = getPlayerStorageValue(cid, 300)
    local storage1 = getPlayerStorageValue(cid, 301)
    local storage2 = getPlayerStorageValue(cid, 302)
    local storage3 = getPlayerStorageValue(cid, 303)
    local storage4 = getPlayerStorageValue(cid, 304)

    local storage10 = getPlayerStorageValue(cid, 400)
    local storageROT = getPlayerStorageValue(cid, 35003)
    local storageROTQ = getPlayerStorageValue(cid, 35008)
    local killedRotworm = getPlayerStorageValue(cid, 35003)
    local killedRotwormQ = getPlayerStorageValue(cid, 35008)
    
if(msgcontains(msg, 'vip access')) then
        selfSay('Widze ze juz troche wiesz na temat prywatnych expowisk i chcesz z nich korzystac do woli...?', cid)
        selfSay('Pamietaj! Musisz spelnic 10 misji aby otrzymac odemnie wspanialy vip access!', cid)
end
    if msgcontains(msg, 'tak') then
        selfSay('Pierwsza misja - {mieszanka}: Przynies mi 10 kawalkow miesa (ham), 10 skrzydelek kurczaka (chicken feathers) i 10 grudek brudu (lump of dirt)!', cid)
        talkState[cid] = 1    
    end

        if msgcontains(msg, 'mieszanka') then  
        if(storage == 1) then
            selfSay('Zakonczyles pierwsza misje - mieszanka, mozesz przejsc do kolejnej {spotkanie}.', cid)
        else
        end

    elseif(msg == 'mieszanka') then 
        if(talkState[cid] == 1) then
            if(doPlayerRemoveItem(cid, 2671, 10) == TRUE) and (doPlayerRemoveItem(cid, 5890, 10) == TRUE) and (doPlayerRemoveItem(cid, 10608, 10) == TRUE) then
                setPlayerStorageValue(cid, 300, 1)
                doPlayerAddExperience(cid, 3000)
                doPlayerAddItem(cid, 2160, 2)
                selfSay('Dziekuje za pomoc! Pierwsza misja zakonczona, mozesz przejsc do drugiej misji - {spotkanie}. Za ta misje dostales: 3000 experience oraz 2 crystal coins.', cid)
            else
                selfSay('Musisz miec wiecej przedmiotow, aktualna ich ilosc jest niewystarczaja!', cid)
                end
            end
            end
    return true
end
 
I would just try to use

Code:
if getPlayerStorageValue(cid, 300) == 1 then

No point in using a local if it's only going to get called once, I don't see what else would be the problem if it only freezes with that word
 
Back
Top