• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

NPC Hanna problem with "addon"

skic

Member
Joined
Aug 15, 2020
Messages
58
Reaction score
13
Hey guys, I'm using TFS 1.2 with Realera Map and NPC Hanna is not answering on 'addon' message.

Here's the NPC 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
 
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a jeweler. Maybe you want to have a look at my wonderful offers."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Hanna."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'have'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'gem'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You can buy and sell small diamonds, sapphires, rubies, emeralds, and amethysts."})
keywordHandler:addKeyword({'pearl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There are white and black pearls you can buy or sell."})
keywordHandler:addKeyword({'jewl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Currently you can purchase wedding rings, golden amulets, and ruby necklaces."})
keywordHandler:addKeyword({'talon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't trade or work with these magic gems. It's better you ask a mage about this."})

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 5)
        if math.random(100) < 25 then
            Npc():say("Gems and jewellery! Best prices in town!", TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

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

    local player = Player(cid)
    if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then
        if getCreatureStorage(cid, 1045) < 1 then
            npcHandler:say("Pretty, isn't it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?", cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, "hat") then
        if player:getStorageValue(1045) == 1 then
            npcHandler:say("Oh, you're back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say({
                "Okay, here we go, listen closely! I need a few things...",
                "a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers...",
                "and 50 honeycombs as glue. That's it, come back to me once you gathered it!"
            }, cid)
            player:setStorageValue(1045, 1)
            player:setStorageValue(1033, 1) --this for default start of Outfit and Addon Quests
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 2 then
            if player:removeItem(5890, 100) and player:removeItem(5902, 50) and player:removeItem(2480, 1) then
                npcHandler:say("Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!", cid)
                player:setStorageValue(1045, 2)
                player:addOutfitAddon(136, 2)
                player:addOutfitAddon(128, 2)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("You don't have it...", cid)
            end
        end
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] > 0 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Oh, please come in, |PLAYERNAME|. What do you need? Have a look at my wonderful offers in gems and jewellery.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
npcHandler:addModule(FocusModule:new())

First Citizen Addon is working just fine and code is pretty much similar.

Here's the Lubo NPC script:

Code:
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

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am selling equipment for adventurers. Do you need anything?"})
keywordHandler:addKeyword({'lubo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Lubo, the owner of this shop."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "No idea."})
keywordHandler:addKeyword({'mountain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is said that once there lived a great magician on the top of this mountain."})
keywordHandler:addKeyword({'magician'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't remember his name, but it's said that his banner was the black eye."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell the best apples in Tibia."})
keywordHandler:addKeyword({'map'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Oh! I'm sorry, I sold the last one just five minutes ago."})
keywordHandler:addKeyword({'magic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There's a lot of magic flowing in the mountain to the north."})
keywordHandler:addKeyword({'weapon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want to buy weapons, you'll have to go to a town or city."})
keywordHandler:addKeyword({'dog'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This is Ruffy my dog, please don't do him any harm."})
keywordHandler:addKeyword({'pet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There are some strange stories about a magicians pet names. Ask Hoggle about it."})
keywordHandler:addKeyword({'finger'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Oh, you sure mean this old story about the mage Dago, who lost two fingers when he conjured a dragon."})
keywordHandler:addKeyword({'inn'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Frodo runs a nice inn in the near town Thais."})
keywordHandler:addKeyword({'crunor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ah yes, I remember my grandfather talking about that name. This house used to be an inn a long time ago. My family bought it from some of these flower guys."})
keywordHandler:addKeyword({'flower'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Oh, I mean druids of course. They sold the cottage to my family after some of them died in an accident or something like that."})
keywordHandler:addKeyword({'accident'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "As far as I can remember the story, a pet escaped its stable behind the inn. It got somehow involved with powerfull magic at a ritual and was transformed in some way."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})
keywordHandler:addKeyword({'goods'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})
keywordHandler:addKeyword({'have'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 5)
        if math.random(100) < 25 then
            Npc():say('Stop by and rest a while, tired adventurer! Have a look at my wares!', TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

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

    local player = Player(cid)
    if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then
        if player:getStorageValue(1043) < 1 then
            npcHandler:say("Sorry, the backpack I wear is not for sale. It's handmade from rare minotaur leather.", cid)
            npcHandler.topic[cid] = 1
        elseif player:getStorageValue(1043) == 2 then
            if player:getStorageValue(1044) < os.time() then
                npcHandler:say("Just in time! Your backpack is finished. Here you go, I hope you like it.", cid)
                player:setStorageValue(1043, 3)
                player:addOutfitAddon(136, 1)
                player:addOutfitAddon(128, 1)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Uh... I didn't expect you to return that early. Sorry, but I'm not finished yet with your backpack. I'm doing the best I can, promised.", cid)
                npcHandler.topic[cid] = 0
            end
        end
    elseif msgcontains(msg, "minotaur leather") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say("Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif msgcontains(msg, "backpack") then
        if player:getStorageValue(1043) == 1 then
            npcHandler:say("Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?", cid)
            npcHandler.topic[cid] = 3
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 2 then
            npcHandler:say("Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!", cid)
            npcHandler.topic[cid] = 0
            player:setStorageValue(1043, 1)
            player:setStorageValue(1033, 1) --this for default start of Outfit and Addon Quests
        elseif npcHandler.topic[cid] == 3 then
            if player:removeItem(5878, 100) then
                npcHandler:say("Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay?", cid)
                player:setStorageValue(1043, 2)
                player:setStorageValue(1044, os.time() + 2 * 60 * 60) -- 2 hour
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("You don't have it...", cid)
            end
        end
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] > 1 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Welcome to my adventurer shop, |PLAYERNAME|! What do you need? Ask me for a {trade} to look at my wares.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")

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

Anyone know what is the issue here?

Thanks
 
Solution
X
Oh I see.

There you go.
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
 
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a jeweler. Maybe you want to have a look at my wonderful offers."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus...
Hey guys, I'm using TFS 1.2 with Realera Map and NPC Hanna is not answering on 'addon' message.

Here's the NPC 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

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a jeweler. Maybe you want to have a look at my wonderful offers."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Hanna."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'have'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'gem'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You can buy and sell small diamonds, sapphires, rubies, emeralds, and amethysts."})
keywordHandler:addKeyword({'pearl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There are white and black pearls you can buy or sell."})
keywordHandler:addKeyword({'jewl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Currently you can purchase wedding rings, golden amulets, and ruby necklaces."})
keywordHandler:addKeyword({'talon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't trade or work with these magic gems. It's better you ask a mage about this."})

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 5)
        if math.random(100) < 25 then
            Npc():say("Gems and jewellery! Best prices in town!", TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

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

    local player = Player(cid)
    if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then
        if getCreatureStorage(cid, 1045) < 1 then
            npcHandler:say("Pretty, isn't it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?", cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, "hat") then
        if player:getStorageValue(1045) == 1 then
            npcHandler:say("Oh, you're back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say({
                "Okay, here we go, listen closely! I need a few things...",
                "a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers...",
                "and 50 honeycombs as glue. That's it, come back to me once you gathered it!"
            }, cid)
            player:setStorageValue(1045, 1)
            player:setStorageValue(1033, 1) --this for default start of Outfit and Addon Quests
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 2 then
            if player:removeItem(5890, 100) and player:removeItem(5902, 50) and player:removeItem(2480, 1) then
                npcHandler:say("Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!", cid)
                player:setStorageValue(1045, 2)
                player:addOutfitAddon(136, 2)
                player:addOutfitAddon(128, 2)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("You don't have it...", cid)
            end
        end
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] > 0 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Oh, please come in, |PLAYERNAME|. What do you need? Have a look at my wonderful offers in gems and jewellery.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
npcHandler:addModule(FocusModule:new())

First Citizen Addon is working just fine and code is pretty much similar.

Here's the Lubo NPC script:

Code:
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

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am selling equipment for adventurers. Do you need anything?"})
keywordHandler:addKeyword({'lubo'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Lubo, the owner of this shop."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "No idea."})
keywordHandler:addKeyword({'mountain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "It is said that once there lived a great magician on the top of this mountain."})
keywordHandler:addKeyword({'magician'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't remember his name, but it's said that his banner was the black eye."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell the best apples in Tibia."})
keywordHandler:addKeyword({'map'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Oh! I'm sorry, I sold the last one just five minutes ago."})
keywordHandler:addKeyword({'magic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There's a lot of magic flowing in the mountain to the north."})
keywordHandler:addKeyword({'weapon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want to buy weapons, you'll have to go to a town or city."})
keywordHandler:addKeyword({'dog'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "This is Ruffy my dog, please don't do him any harm."})
keywordHandler:addKeyword({'pet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There are some strange stories about a magicians pet names. Ask Hoggle about it."})
keywordHandler:addKeyword({'finger'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Oh, you sure mean this old story about the mage Dago, who lost two fingers when he conjured a dragon."})
keywordHandler:addKeyword({'inn'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Frodo runs a nice inn in the near town Thais."})
keywordHandler:addKeyword({'crunor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Ah yes, I remember my grandfather talking about that name. This house used to be an inn a long time ago. My family bought it from some of these flower guys."})
keywordHandler:addKeyword({'flower'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Oh, I mean druids of course. They sold the cottage to my family after some of them died in an accident or something like that."})
keywordHandler:addKeyword({'accident'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "As far as I can remember the story, a pet escaped its stable behind the inn. It got somehow involved with powerfull magic at a ritual and was transformed in some way."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})
keywordHandler:addKeyword({'goods'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})
keywordHandler:addKeyword({'have'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sell torches, fishing rods, sixpacks of worms, ropes, water hoses, backpacks, apples, and maps."})

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 5)
        if math.random(100) < 25 then
            Npc():say('Stop by and rest a while, tired adventurer! Have a look at my wares!', TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

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

    local player = Player(cid)
    if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then
        if player:getStorageValue(1043) < 1 then
            npcHandler:say("Sorry, the backpack I wear is not for sale. It's handmade from rare minotaur leather.", cid)
            npcHandler.topic[cid] = 1
        elseif player:getStorageValue(1043) == 2 then
            if player:getStorageValue(1044) < os.time() then
                npcHandler:say("Just in time! Your backpack is finished. Here you go, I hope you like it.", cid)
                player:setStorageValue(1043, 3)
                player:addOutfitAddon(136, 1)
                player:addOutfitAddon(128, 1)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Uh... I didn't expect you to return that early. Sorry, but I'm not finished yet with your backpack. I'm doing the best I can, promised.", cid)
                npcHandler.topic[cid] = 0
            end
        end
    elseif msgcontains(msg, "minotaur leather") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say("Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif msgcontains(msg, "backpack") then
        if player:getStorageValue(1043) == 1 then
            npcHandler:say("Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?", cid)
            npcHandler.topic[cid] = 3
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 2 then
            npcHandler:say("Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!", cid)
            npcHandler.topic[cid] = 0
            player:setStorageValue(1043, 1)
            player:setStorageValue(1033, 1) --this for default start of Outfit and Addon Quests
        elseif npcHandler.topic[cid] == 3 then
            if player:removeItem(5878, 100) then
                npcHandler:say("Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay?", cid)
                player:setStorageValue(1043, 2)
                player:setStorageValue(1044, os.time() + 2 * 60 * 60) -- 2 hour
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("You don't have it...", cid)
            end
        end
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] > 1 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Welcome to my adventurer shop, |PLAYERNAME|! What do you need? Ask me for a {trade} to look at my wares.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye, |PLAYERNAME|.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")

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

Anyone know what is the issue here?

Thanks
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
 
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a jeweler. Maybe you want to have a look at my wonderful offers."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Hanna."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'have'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'gem'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You can buy and sell small diamonds, sapphires, rubies, emeralds, and amethysts."})
keywordHandler:addKeyword({'pearl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There are white and black pearls you can buy or sell."})
keywordHandler:addKeyword({'jewl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Currently you can purchase wedding rings, golden amulets, and ruby necklaces."})
keywordHandler:addKeyword({'talon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't trade or work with these magic gems. It's better you ask a mage about this."})

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 5)
        if math.random(100) < 25 then
            Npc():say("Gems and jewellery! Best prices in town!", TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    
    local player = Player(cid)
    if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then
        if getCreatureStorage(cid, 1045) < 1 then
            npcHandler:say("Pretty, isn't it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?", cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, "hat") then
        if player:getStorageValue(1045) == 1 then
            npcHandler:say("Oh, you're back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say({
                "Okay, here we go, listen closely! I need a few things...",
                "a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers...",
                "and 50 honeycombs as glue. That's it, come back to me once you gathered it!"
            }, cid)
            player:setStorageValue(1045, 1)
            player:setStorageValue(1033, 1) --this for default start of Outfit and Addon Quests
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 2 then
            if player:removeItem(5890, 100) and player:removeItem(5902, 50) and player:removeItem(2480, 1) then
                npcHandler:say("Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!", cid)
                player:setStorageValue(1045, 2)
                player:addOutfitAddon(136, 2)
                player:addOutfitAddon(128, 2)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("You don't have it...", cid)
            end
        end
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] > 0 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Oh, please come in, |PLAYERNAME|. What do you need? Have a look at my wonderful offers in gems and jewellery.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
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

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a jeweler. Maybe you want to have a look at my wonderful offers."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Hanna."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'have'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'gem'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You can buy and sell small diamonds, sapphires, rubies, emeralds, and amethysts."})
keywordHandler:addKeyword({'pearl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There are white and black pearls you can buy or sell."})
keywordHandler:addKeyword({'jewl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Currently you can purchase wedding rings, golden amulets, and ruby necklaces."})
keywordHandler:addKeyword({'talon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't trade or work with these magic gems. It's better you ask a mage about this."})

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 5)
        if math.random(100) < 25 then
            Npc():say("Gems and jewellery! Best prices in town!", TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
  
    local player = Player(cid)
    if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then
        if getCreatureStorage(cid, 1045) < 1 then
            npcHandler:say("Pretty, isn't it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?", cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, "hat") then
        if player:getStorageValue(1045) == 1 then
            npcHandler:say("Oh, you're back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say({
                "Okay, here we go, listen closely! I need a few things...",
                "a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers...",
                "and 50 honeycombs as glue. That's it, come back to me once you gathered it!"
            }, cid)
            player:setStorageValue(1045, 1)
            player:setStorageValue(1033, 1) --this for default start of Outfit and Addon Quests
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 2 then
            if player:removeItem(5890, 100) and player:removeItem(5902, 50) and player:removeItem(2480, 1) then
                npcHandler:say("Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!", cid)
                player:setStorageValue(1045, 2)
                player:addOutfitAddon(136, 2)
                player:addOutfitAddon(128, 2)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("You don't have it...", cid)
            end
        end
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] > 0 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Oh, please come in, |PLAYERNAME|. What do you need? Have a look at my wonderful offers in gems and jewellery.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Still not working.
1597882681080.png
1597882795894.png
 
Oh I see.

There you go.
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
 
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a jeweler. Maybe you want to have a look at my wonderful offers."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Hanna."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'have'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'gem'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You can buy and sell small diamonds, sapphires, rubies, emeralds, and amethysts."})
keywordHandler:addKeyword({'pearl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There are white and black pearls you can buy or sell."})
keywordHandler:addKeyword({'jewl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Currently you can purchase wedding rings, golden amulets, and ruby necklaces."})
keywordHandler:addKeyword({'talon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't trade or work with these magic gems. It's better you ask a mage about this."})

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 5)
        if math.random(100) < 25 then
            Npc():say("Gems and jewellery! Best prices in town!", TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    
    local player = Player(cid)
    if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then
        if player:getStorageValue(1045) < 1 then
            npcHandler:say("Pretty, isn't it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?", cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, "hat") then
        if player:getStorageValue(1045) == 1 then
            npcHandler:say("Oh, you're back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say({
                "Okay, here we go, listen closely! I need a few things...",
                "a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers...",
                "and 50 honeycombs as glue. That's it, come back to me once you gathered it!"
            }, cid)
            player:setStorageValue(1045, 1)
            player:setStorageValue(1033, 1) --this for default start of Outfit and Addon Quests
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 2 then
            if player:removeItem(5890, 100) and player:removeItem(5902, 50) and player:removeItem(2480, 1) then
                npcHandler:say("Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!", cid)
                player:setStorageValue(1045, 2)
                player:addOutfitAddon(136, 2)
                player:addOutfitAddon(128, 2)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("You don't have it...", cid)
            end
        end
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] > 0 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Oh, please come in, |PLAYERNAME|. What do you need? Have a look at my wonderful offers in gems and jewellery.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Solution
Oh I see.

There you go.
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

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am a jeweler. Maybe you want to have a look at my wonderful offers."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am Hanna."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'sell'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'have'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can offer you various gems, pearls or some wonderful jewels."})
keywordHandler:addKeyword({'gem'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You can buy and sell small diamonds, sapphires, rubies, emeralds, and amethysts."})
keywordHandler:addKeyword({'pearl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "There are white and black pearls you can buy or sell."})
keywordHandler:addKeyword({'jewl'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Currently you can purchase wedding rings, golden amulets, and ruby necklaces."})
keywordHandler:addKeyword({'talon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I don't trade or work with these magic gems. It's better you ask a mage about this."})

local lastSound = 0
function onThink()
    if lastSound < os.time() then
        lastSound = (os.time() + 5)
        if math.random(100) < 25 then
            Npc():say("Gems and jewellery! Best prices in town!", TALKTYPE_SAY)
        end
    end
    npcHandler:onThink()
end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
   
    local player = Player(cid)
    if msgcontains(msg, "addon") or msgcontains(msg, "outfit") then
        if player:getStorageValue(1045) < 1 then
            npcHandler:say("Pretty, isn't it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?", cid)
            npcHandler.topic[cid] = 1
        end
    elseif msgcontains(msg, "hat") then
        if player:getStorageValue(1045) == 1 then
            npcHandler:say("Oh, you're back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say({
                "Okay, here we go, listen closely! I need a few things...",
                "a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers...",
                "and 50 honeycombs as glue. That's it, come back to me once you gathered it!"
            }, cid)
            player:setStorageValue(1045, 1)
            player:setStorageValue(1033, 1) --this for default start of Outfit and Addon Quests
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 2 then
            if player:removeItem(5890, 100) and player:removeItem(5902, 50) and player:removeItem(2480, 1) then
                npcHandler:say("Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!", cid)
                player:setStorageValue(1045, 2)
                player:addOutfitAddon(136, 2)
                player:addOutfitAddon(128, 2)
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("You don't have it...", cid)
            end
        end
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] > 0 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Oh, please come in, |PLAYERNAME|. What do you need? Have a look at my wonderful offers in gems and jewellery.")
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Works finally !! Thank you brother :)
 
Back
Top