• 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!

[OTHire] A Dead Bureaucrat

Eldora

Banned User
Joined
Oct 19, 2009
Messages
604
Reaction score
26
This NPC (A Dead Bureaucrat) will not respond when I say "Pumin". WHY? :(


Here is the console Error:
1600154861610.png


Here is the script:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

 
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 config = {
    [1] = "wand",
    [2] = "rod",
    [3] = "bow",
    [4] = "sword"
}

function greetCallback(cid)
    if getPlayerStorageValue(cid,55874012) == 3 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    elseif getPlayerStorageValue(cid,55874012) == 5 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    elseif getPlayerStorageValue(cid,55874012) == 8 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    else
        npcHandler:setMessage(MESSAGE_GREET, "Hello " .. (getPlayerSex(cid) == 0 and "beautiful lady" or "handsome gentleman") .. ", welcome to the atrium of Pumin's Domain. We require some information from you before we can let you pass. Where do you want to go?")
    end
    return true
end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local vocationId = getPlayerVocation(cid)

    if msgcontains(msg, "pumin") then
        if getPlayerStorageValue(cid,55874013) < 1 and getPlayerStorageValue(cid,55874012) < 1 then
            npcHandler:say("Sure, where else. Everyone likes to meet my master, he is a great demon, isn't he? Your name is ...?", cid)
            npcHandlerfocus = 1
        elseif npcHandlerfocus == 3 then
            setPlayerStorageValue(cid,55874012, 1)
            npcHandler:say("How very interesting. I need to tell that to my master immediately. Please go to my colleagues and ask for Form 356. You will need it in order to proceed.", cid)
            npcHandlerfocus = 0
        end
    elseif msgcontains(msg, getPlayerName(cid)) then
        if npcHandlerfocus == 1 then
            npcHandler:say("Alright " .. getPlayerName(cid) ..". Vocation?", cid)
            npcHandlerfocus = 2
        end
    elseif msgcontains(msg, "druid") or msgcontains(msg, "knight") or msgcontains(msg, "sorcerer") or msgcontains(msg, "paladin") then
        if npcHandlerfocus == 2 then
            npcHandler:say("Huhu, please don't hurt me with your " .. config[vocationId] .. "! Reason of your visit?", cid)
            setPlayerStorageValue(cid,55874013, 1)
            npcHandlerfocus = 3
        end
    elseif msgcontains(msg, "411") then
        if getPlayerStorageValue(cid,55874012) == 3 then
            npcHandler:say("Form 411? You need Form 287 to get that! Do you have it?", cid)
            npcHandlerfocus = 5
        elseif getPlayerStorageValue(cid,55874012) == 5 then
            npcHandler:say("Form 411? You need Form 287 to get that! Do you have it?", cid)
            npcHandlerfocus = 7
        end
    elseif msgcontains(msg, "no") then
        if npcHandlerfocus == 5 then
            setPlayerStorageValue(cid,55874012, 4)
            npcHandler:say("Oh, what a pity. Go see one of my colleagues. I give you the permission to get Form 287. Bye!", cid)
        end
    elseif msgcontains(msg, "yes") then
        if npcHandlerfocus == 7 then
            setPlayerStorageValue(cid,55874012, 6)
            npcHandler:say("Great. Here you are. Form 411. Come back anytime you want to talk. Bye.", cid)
        end
    elseif msgcontains(msg, "356") then
        if getPlayerStorageValue(cid,55874012) == 8 then
            setPlayerStorageValue(cid,55874012, 9)
            npcHandler:say("INCREDIBLE, you did it!! Have fun at Pumin's Domain!", cid)
        end
        npcHandlerfocus = 0
    end
    return true
end

npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye and don't forget me!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye and don't forget me!")

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
You haven't got a function called 'isFocused'.

Try this:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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 config = {
    [1] = "wand",
    [2] = "rod",
    [3] = "bow",
    [4] = "sword"
}

local topic

function greetCallback(cid)
    if getPlayerStorageValue(cid,55874012) == 3 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    elseif getPlayerStorageValue(cid,55874012) == 5 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    elseif getPlayerStorageValue(cid,55874012) == 8 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    else
        npcHandler:setMessage(MESSAGE_GREET, "Hello " .. (getPlayerSex(cid) == 0 and "beautiful lady" or "handsome gentleman") .. ", welcome to the atrium of Pumin's Domain. We require some information from you before we can let you pass. Where do you want to go?")
    end
    topic = 0
    return true
end

local function creatureSayCallback(cid, type, msg)
    if npcHandler.focus ~= cid then
        return false
    end

    local vocationId, t = getPlayerVocation(cid)

    if msgcontains(msg, "pumin") then
        if getPlayerStorageValue(cid,55874013) < 1 and getPlayerStorageValue(cid,55874012) < 1 then
            npcHandler:say("Sure, where else. Everyone likes to meet my master, he is a great demon, isn't he? Your name is ...?", cid)
            t = 1
        elseif topic == 3 then
            setPlayerStorageValue(cid,55874012, 1)
            npcHandler:say("How very interesting. I need to tell that to my master immediately. Please go to my colleagues and ask for Form 356. You will need it in order to proceed.", cid)
        end
    elseif msgcontains(msg, getPlayerName(cid)) then
        if topic == 1 then
            npcHandler:say("Alright " .. getPlayerName(cid) ..". Vocation?", cid)
            t = 2
        end
    elseif msgcontains(msg, "druid") or msgcontains(msg, "knight") or msgcontains(msg, "sorcerer") or msgcontains(msg, "paladin") then
        if topic == 2 then
            npcHandler:say("Huhu, please don't hurt me with your " .. config[vocationId] .. "! Reason of your visit?", cid)
            setPlayerStorageValue(cid,55874013, 1)
            t = 3
        end
    elseif msgcontains(msg, "411") then
        if getPlayerStorageValue(cid,55874012) == 3 then
            npcHandler:say("Form 411? You need Form 287 to get that! Do you have it?", cid)
            t = 5
        elseif getPlayerStorageValue(cid,55874012) == 5 then
            npcHandler:say("Form 411? You need Form 287 to get that! Do you have it?", cid)
            t = 7
        end
    elseif msgcontains(msg, "no") then
        if topic == 5 then
            setPlayerStorageValue(cid,55874012, 4)
            npcHandler:say("Oh, what a pity. Go see one of my colleagues. I give you the permission to get Form 287. Bye!", cid)
        end
    elseif msgcontains(msg, "yes") then
        if topic == 7 then
            setPlayerStorageValue(cid,55874012, 6)
            npcHandler:say("Great. Here you are. Form 411. Come back anytime you want to talk. Bye.", cid)
        end
    elseif msgcontains(msg, "356") then
        if getPlayerStorageValue(cid,55874012) == 8 then
            setPlayerStorageValue(cid,55874012, 9)
            npcHandler:say("INCREDIBLE, you did it!! Have fun at Pumin's Domain!", cid)
        end
    end
    topic = t
    return true
end

npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye and don't forget me!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye and don't forget me!")

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
You haven't got a function called 'isFocused'.

Try this:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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 config = {
    [1] = "wand",
    [2] = "rod",
    [3] = "bow",
    [4] = "sword"
}

local topic

function greetCallback(cid)
    if getPlayerStorageValue(cid,55874012) == 3 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    elseif getPlayerStorageValue(cid,55874012) == 5 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    elseif getPlayerStorageValue(cid,55874012) == 8 then
        npcHandler:setMessage(MESSAGE_GREET, "You again. I told my master that you wish to end your stupid life in his domain but you need Form 356 to get there. What do you need this time?", cid)
    else
        npcHandler:setMessage(MESSAGE_GREET, "Hello " .. (getPlayerSex(cid) == 0 and "beautiful lady" or "handsome gentleman") .. ", welcome to the atrium of Pumin's Domain. We require some information from you before we can let you pass. Where do you want to go?")
    end
    topic = 0
    return true
end

local function creatureSayCallback(cid, type, msg)
    if npcHandler.focus ~= cid then
        return false
    end

    local vocationId, t = getPlayerVocation(cid)

    if msgcontains(msg, "pumin") then
        if getPlayerStorageValue(cid,55874013) < 1 and getPlayerStorageValue(cid,55874012) < 1 then
            npcHandler:say("Sure, where else. Everyone likes to meet my master, he is a great demon, isn't he? Your name is ...?", cid)
            t = 1
        elseif topic == 3 then
            setPlayerStorageValue(cid,55874012, 1)
            npcHandler:say("How very interesting. I need to tell that to my master immediately. Please go to my colleagues and ask for Form 356. You will need it in order to proceed.", cid)
        end
    elseif msgcontains(msg, getPlayerName(cid)) then
        if topic == 1 then
            npcHandler:say("Alright " .. getPlayerName(cid) ..". Vocation?", cid)
            t = 2
        end
    elseif msgcontains(msg, "druid") or msgcontains(msg, "knight") or msgcontains(msg, "sorcerer") or msgcontains(msg, "paladin") then
        if topic == 2 then
            npcHandler:say("Huhu, please don't hurt me with your " .. config[vocationId] .. "! Reason of your visit?", cid)
            setPlayerStorageValue(cid,55874013, 1)
            t = 3
        end
    elseif msgcontains(msg, "411") then
        if getPlayerStorageValue(cid,55874012) == 3 then
            npcHandler:say("Form 411? You need Form 287 to get that! Do you have it?", cid)
            t = 5
        elseif getPlayerStorageValue(cid,55874012) == 5 then
            npcHandler:say("Form 411? You need Form 287 to get that! Do you have it?", cid)
            t = 7
        end
    elseif msgcontains(msg, "no") then
        if topic == 5 then
            setPlayerStorageValue(cid,55874012, 4)
            npcHandler:say("Oh, what a pity. Go see one of my colleagues. I give you the permission to get Form 287. Bye!", cid)
        end
    elseif msgcontains(msg, "yes") then
        if topic == 7 then
            setPlayerStorageValue(cid,55874012, 6)
            npcHandler:say("Great. Here you are. Form 411. Come back anytime you want to talk. Bye.", cid)
        end
    elseif msgcontains(msg, "356") then
        if getPlayerStorageValue(cid,55874012) == 8 then
            setPlayerStorageValue(cid,55874012, 9)
            npcHandler:say("INCREDIBLE, you did it!! Have fun at Pumin's Domain!", cid)
        end
    end
    topic = t
    return true
end

npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye and don't forget me!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye and don't forget me!")

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

Now he answer to "pumin" but not to my name, which is next step in the dialogue.
 
Try change that segment to this then:
Lua:
    elseif msgcontains(msg, getCreatureName(cid):lower()) then
        if topic == 1 then
            npcHandler:say("Alright " .. getCreatureName(cid) ..". Vocation?", cid)
            t = 2
        end
 
Back
Top