Ir para conteúdo
  • 0

Erro Resposta do NPC


Faelzdanil

Pergunta

Olá Ekz,

 

Guys estou desenvolvendo um servidor Tibia Global 8.6 no TFS 1.3 do Nekiro, eu não sou profissional em scripts ou programação, mas sempre me virei bem e entendo rápido sobre o assunto. 
Muitos erros eu consegui resolver, mas esse erro não estou conseguindo identificar até por que não da erro no console. 


Bom o erro pelo o que fui testando e eliminando as possibilidades é que ao falar com algum NPC que ele vá me da alguma ação ( viagem - storage - missão ), ele não me responde mais, maioria das vezes é quando eu confirmo 'yes'.

 

Exemplo: NPC de viagem eu falo hi - thais - yes, ele me pergunta se quero ir pra cidade mas quando falo yes ele não responde nada, até se eu falar no ele também não responde nada.

 

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


-- OTServ event handling functions start
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
-- OTServ event handling functions end




-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'dragon land'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 20, cost = 500, destination = {x=32311, y=32211, z=6} })
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 20, cost = 500, destination = {x=32311, y=32211, z=6} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Boa sorte em suas viagens'})

local travelNode = keywordHandler:addKeyword({'south jungle'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você quer ir para a South Jungle por 500gps?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 500, destination = {x=193, y=107, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Boa sorte em suas viagens'})

local travelNode = keywordHandler:addKeyword({'dwarven hideout'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você quer ir para Dwarven Hideout por 500gps?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 10, cost = 500, destination = {x=169, y=131, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Boa sorte em suas viagens'})

local travelNode = keywordHandler:addKeyword({'elemental forest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você quer ir para a Elemental Forest por 500gps?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 30, cost = 500, destination = {x=52, y=108, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Boa sorte em suas viagens'})

local travelNode = keywordHandler:addKeyword({'hell port'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você quer ir para Hell Port por 1000gps?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 60, cost = 1000, destination = {x=47, y=202, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Boa sorte em suas viagens'})

local travelNode = keywordHandler:addKeyword({'central port'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você quer ir para Central Port por 200gps?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 200, destination = {x=119, y=60, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Boa sorte em suas viagens'})



keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso levá-lo a \'Dragon Land\', \'Dwarven Hideout\', \'Hell Port\', \'Elemental Forest\', \'Frozen Dungeon\', \'Central Port\', \'Hoover City\' ou  \'South Jungle\'.'})

Esse é meu script do NPC de viagem.

Outro exemplo que testei foi no Henricus e Jean Pierre, abaixo os scripts:

 

Spoiler

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 function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local player = Player(cid)
    
    if player:getLevel() < 30 then --calculate prize for blessing
        blessprize = 2000*5*1.1
    elseif player:getLevel() >= 30 and player:getLevel() <= 120 then
        blessprize = 200*(player:getLevel()-20)*5*1.1
    elseif player:getLevel() > 120 then
        blessprize = 20000*5*1.1
    end
    
    if(msgcontains(msg, "inquisitor")) then
        npcHandler:say("The churches of the gods entrusted me with the enormous and responsible task to lead the inquisition. I leave the field work to inquisitors who I recruit from fitting people that cross my way.", cid)
    elseif(msgcontains(msg, "join")) then
        if(player:getStorageValue(Storage.TheInquisition.Questline) < 1) then
            npcHandler:say("Do you want to join the inquisition?", cid)
            npcHandler.topic[cid] = 2
        end
    elseif(msgcontains(msg, "blessing") or msgcontains(msg, "bless")) then
        if(player:getStorageValue(Storage.TheInquisition.Questline) == 25) then --if quest is done
            npcHandler:say("Do you want to receive the blessing of the inquisition - which means all five available blessings - for "..blessprize.." gold?", cid)
            npcHandler.topic[cid] = 7
        else
            npcHandler:say("You cannot get this blessing unless you have completed The Inquisition Quest.", cid)
            npcHandler.topic[cid] = 0
        end
    elseif(msgcontains(msg, "mission") or msgcontains(msg, "report")) then
        if(player:getStorageValue(Storage.TheInquisition.Questline) == 1) then
            npcHandler:say({"Let's see if you are worthy. Take an inquisitor's field guide from the box in the back room. ...","Follow the instructions in the guide to talk to the Thaian guards that protect the walls and gates of the city and test their loyalty. Then report to me about your {mission}."}, cid, 0, 1, 3000)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 2)
            player:setStorageValue(Storage.TheInquisition.Mission01, 1) -- The Inquisition Questlog- "Mission 1: Interrogation"
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 2) then
            npcHandler:say("Your current mission is to investigate the reliability of certain guards. Are you done with that mission? ", cid)
            npcHandler.topic[cid] = 3
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 3) then
            npcHandler:say({"Listen, we have information about a heretic coven that hides in a mountain called the Big Old One. The witches reach this cursed place on flying brooms and think they are safe there. ...","I've arranged a flying carpet that will bring you to their hideout. Travel to Femor Hills and tell the carpet pilot the codeword 'eclipse' ...","He'll bring you to your destination. At their meeting place, you'll find a cauldron in which they cook some forbidden brew ...","Use this vial of holy water to destroy the brew. Also steal their grimoire and bring it to me."}, cid, 0, 1, 3500)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 4)
            player:setStorageValue(Storage.TheInquisition.Mission02, 1) -- The Inquisition Questlog- "Mission 2: Eclipse"
            player:addItem(7494, 1)
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 5) then
            if (player:removeItem(8702, 1)) then
                npcHandler:say({"I think it's time to truly test your abilities. One of our allies has requested assistance. I think you are just the right person to help him ...","Storkus is an old and grumpy dwarf who works as a vampire hunter since many, many decades. He's quite successful but even hehas his limits. ...","So occasionally, we send him help. In return he trains and tests our recruits. It's an advantageous agreement for both sides ...","You'll find him in his cave at the mountain outside of Kazordoon. He'll tell you about your next mission."}, cid, 0, 1, 3000)
                npcHandler.topic[cid] = 0
                player:setStorageValue(Storage.TheInquisition.Questline, 6)
                player:setStorageValue(Storage.TheInquisition.Mission02, 3) -- The Inquisition Questlog- "Mission 2: Eclipse"
                player:setStorageValue(Storage.TheInquisition.Mission03, 1) -- The Inquisition Questlog- "Mission 3: Vampire Hunt"
            else
                npcHandler:say("You need bring me the witches' grimoire.", cid)
            end
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) > 5 and player:getStorageValue(Storage.TheInquisition.Questline) < 11) then
            npcHandler:say("Your current mission is to help the vampire hunter Storkus. Are you done with that mission? ", cid)
            npcHandler.topic[cid] = 4
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 11) then
            npcHandler:say({"We've got a report about an abandoned and haunted house in Liberty Bay. I want you to examine this house. It's the only ruin in Liberty Bay so you should have no trouble finding it. ...","There's an evil being somewhere. I assume that it will be easier to find the right spot at night. Use this vial of holy water on that spot to drive out the evil being."}, cid, 0, 1, 3500)
            player:setStorageValue(Storage.TheInquisition.Questline, 12)
            player:setStorageValue(Storage.TheInquisition.Mission04, 1) -- The Inquisition Questlog- "Mission 4: The Haunted Ruin"
            player:addItem(7494, 1)
            npcHandler.topic[cid] = 0
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 12 or player:getStorageValue(Storage.TheInquisition.Questline) == 13) then
            npcHandler:say("Your current mission is to exorcise an evil being from a house in Liberty Bay. Are you done with that mission? ", cid)
            npcHandler.topic[cid] = 5
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 14) then
            npcHandler:say({"You've handled heretics, witches, vampires and ghosts. Now be prepared to face the most evil creatures we are fighting - demons. Your new task is extremely simple, though far from easy. ...","Go and slay demonic creatures wherever you find them. Bring me 20 of their essences as a proof of your accomplishments."}, cid, 0, 1, 3000)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 15)
            player:setStorageValue(Storage.TheInquisition.Mission05, 1) -- The Inquisition Questlog- "Mission 5: Essential Gathering"
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 15) then
            if(player:getItemCount(6500) >= 20) then
                npcHandler:say({"You're indeed a dedicated protector of the true believers. Don't stop now. Kill as many of these creatures as you can. ...","I also have a reward for your great efforts. Talk to me about your {demon hunter outfit} anytime from now on. Afterwards, let's talk about the next mission that's awaiting you."}, cid, 0, 1, 3000)
                player:setStorageValue(Storage.TheInquisition.Questline, 16)
                player:setStorageValue(Storage.TheInquisition.Mission05, 2) -- The Inquisition Questlog- "Mission 5: Essential Gathering"
                player:removeItem(6500, 20)
            else
                npcHandler:say("You need 20 of them.", cid)
            end
            npcHandler.topic[cid] = 0
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 17) then
            npcHandler:say({"We've got information about something very dangerous going on on the isle of Edron. The demons are preparing something there ...","Something that is a threat to all of us. Our investigators were able to acquire vital information before some of them were slain by a demon named Ungreez. ...","It'll be your task to take revenge and to kill that demon. You'll find him in the depths of Edron. Good luck."}, cid, 0, 1, 3200)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 18)
            player:setStorageValue(Storage.TheInquisition.Mission06, 1) -- The Inquisition Questlog- "Mission 6: The Demon Ungreez"
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 19) then
            npcHandler:say({"So the beast is finally dead! Thank the gods. At least some things work out in our favour ...","Our other operatives were not that lucky, though. But you will learn more about that in your next {mission}."}, cid, 0, 1, 3000)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 20)
            player:setStorageValue(Storage.TheInquisition.Mission06, 3) -- The Inquisition Questlog- "Mission 6: The Demon Ungreez"
            player:addOutfitAddon(288, 1)
            player:addOutfitAddon(289, 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 20) then
            npcHandler:say("Destroy the shadow nexus using this vial of holy water and kill all demon lords.", cid)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 21)
            player:setStorageValue(Storage.TheInquisition.Mission07, 1) -- The Inquisition Questlog- "Mission 7: The Shadow Nexus"
            player:addItem(7494, 1)
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 21 or player:getStorageValue(Storage.TheInquisition.Questline) == 22) then
            npcHandler:say("Your current mission is to destroy the shadow nexus in the Demon Forge. Are you done with that mission?", cid)
            npcHandler.topic[cid] = 6
        end
    elseif(msgcontains(msg, "yes")) then
        if(npcHandler.topic[cid] == 2) then
            npcHandler:say("So be it. Now you are a member of the inquisition. You might ask me for a {mission} to raise in my esteem.", cid)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 1)
        elseif(npcHandler.topic[cid] == 3) then
            if(player:getStorageValue(Storage.TheInquisition.WalterGuard) == 1 and player:getStorageValue(Storage.TheInquisition.KulagGuard) == 1 and player:getStorageValue(Storage.TheInquisition.GrofGuard) == 1 and player:getStorageValue(Storage.TheInquisition.MilesGuard) == 1 and player:getStorageValue(Storage.TheInquisition.TimGuard) == 1) then
                npcHandler:say({"Indeed, this is exactly what my other sources told me. Of course I knew the outcome of this investigation in advance. This was just a test. ...","Well, now that you've proven yourself as useful, you can ask me for another mission. Let's see if you can handle some field duty, too."}, cid, 0, 1, 3000)
                npcHandler.topic[cid] = 0
                player:setStorageValue(Storage.TheInquisition.Questline, 3)
                player:setStorageValue(Storage.TheInquisition.Mission01, 7) -- The Inquisition Questlog- "Mission 1: Interrogation"
            else
                npcHandler:say("You haven't done your mission yet.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif(npcHandler.topic[cid] == 4) then
            if(player:getStorageValue(Storage.TheInquisition.Questline) == 10) then
                npcHandler:say("Good, you've returned. Your skill in practical matters seems to be useful. If you're ready for a further mission, just ask. ", cid)
                player:setStorageValue(Storage.TheInquisition.Questline, 11)
                player:setStorageValue(Storage.TheInquisition.Mission03, 6) -- The Inquisition Questlog- "Mission 3: Vampire Hunt"
            else
                npcHandler:say("You haven't done your mission with {Storkus} yet.", cid)
            end
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 5) then
            if(player:getStorageValue(Storage.TheInquisition.Questline) == 13) then
                npcHandler:say("Well, this was an easy task, but your next mission will be much more challenging. ", cid)
                player:setStorageValue(Storage.TheInquisition.Questline, 14)
                player:setStorageValue(Storage.TheInquisition.Mission04, 3) -- The Inquisition Questlog- "Mission 4: The Haunted Ruin"
            else
                npcHandler:say("You haven't done your mission with {Storkus} yet.", cid)
            end
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 6) then
            if (player:getStorageValue(Storage.TheInquisition.Questline) == 22) then
                npcHandler:say({"Incredible! You're a true defender of faith! I grant you the title of a High Inquisitor for your noble deeds. From now on you can obtain the blessing of the inquisition which makes the pilgrimage of ashes obsolete ...","The blessing of the inquisition will bestow upon you all available blessings for the price of 60000 gold. Also, don't forget to ask me about your {outfit} to receive the final addon as demon hunter."}, cid, 0, 1, 4000)
                player:setStorageValue(Storage.TheInquisition.Questline, 23)
                player:setStorageValue(Storage.TheInquisition.Mission07, 3) -- The Inquisition Questlog- "Mission 7: The Shadow Nexus"
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Come back when you have destroyed the shadow nexus.", cid)
            end
            npcHandler.topic[cid] = 0
        elseif(npcHandler.topic[cid] == 7) then
            if player:hasBlessing(1) or player:hasBlessing(2) or player:hasBlessing(3) or player:hasBlessing(4) or player:hasBlessing(5) then
                npcHandler:say("You already have been blessed!", cid)
            else
                if player:removeMoney(blessprize) then
                    npcHandler:say("You have been blessed by all of five gods!, " .. player:getName() .. ".", cid)
                    player:addBlessing(1)
                    player:addBlessing(2)
                    player:addBlessing(3)
                    player:addBlessing(4)
                    player:addBlessing(5)
                    player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
                    npcHandler.topic[cid] = 0
                else
                    npcHandler:say("Come back when you have enough money.", cid)
                end
            end
            npcHandler.topic[cid] = 0
        end
    elseif(msgcontains(msg, "no")) then
        if(npcHandler.topic[cid] > 0) then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    elseif(msgcontains(msg, "outfit")) then
        if(player:getStorageValue(Storage.TheInquisition.Questline) == 16) then
            npcHandler:say("Here is your demon hunter outfit. You deserve it. Unlock more addons by completing more missions. ", cid)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 17)
            player:setStorageValue(Storage.TheInquisition.Mission05, 3) -- The Inquisition Questlog- "Mission 5: Essential Gathering"
            player:addOutfit(288, 0)
            player:addOutfit(289, 0)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
        elseif(player:getStorageValue(Storage.TheInquisition.Questline) == 23) then
            npcHandler:say("Here is the final addon for your demon hunter outfit. Congratulations! ", cid)
            npcHandler.topic[cid] = 0
            player:setStorageValue(Storage.TheInquisition.Questline, 24)
            player:setStorageValue(Storage.TheInquisition.Mission07, 4) -- The Inquisition Questlog- "Mission 7: The Shadow Nexus"
            player:addOutfitAddon(288, 2)
            player:addOutfitAddon(289, 2)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
        end
    elseif msgcontains(msg, 'name') then
        npcHandler:say('I\'m Henricus, the Lord Inquisitor.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'job') then
        npcHandler:say('By edict of the churches I\'m the Lord Inquisitor.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'believer') then
        npcHandler:say('Belive on the gods and they will show you the path.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'inquisitor') then
        npcHandler:say('The churches of the gods entrusted me with the enormous and responsible task to lead the inquisition. I leave the field work to inquisitors who I recruit from fitting people that cross my way.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'church') then
        npcHandler:say('The churches of the gods united to fight heresy and dark magic. They are the shield of the true believers, while the inquisition is the sword that fights all enemies of virtuousness.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'gods') then
        npcHandler:say('We owe to the gods of good our creation and continuing existence. If it weren\'t for them, we would surely fall prey to the minions of the vile and dark gods.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'dark') then
        npcHandler:say('The dark powers are always present. If a human shows only the slightest weakness, they try to corrupt him and to lure him into their service. ...', cid)
        npcHandler:say('We must be constantly aware of evil that comes in many disguises.', cid, 3000)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'king') then
        npcHandler:say('The Thaian kings are crowned by a representative of the churches. This means they reign in the name of the gods of good and are part of the godly plan for humanity. ...', cid)
        npcHandler:say('As nominal head of the church of Banor, the kings aren\'t only worldly but also spiritual authorities. ...', cid, 4000)
        npcHandler:say('The kings fund the inquisition and sometimes provide manpower in matters of utmost importance. The inquisition, in return, protects the realm from heretics and individuals that aim to undermine the holy reign of the kings.', cid, 7000)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'banor') then
        npcHandler:say('In the past, the order of Banor was the only order of knighthood in existence. In the course of time,  the order concentrated more and more on spiritual matters rather than on worldly ones. ...', cid)
        npcHandler:say('Nowadays, the order of Banor sanctions new orders and offers spiritual guidance to the fighters of good.', cid, 4000)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'fardos') then
        npcHandler:say('The priests of Fardos are often mystics who have secluded themselves from worldly matters. Others provide guidance and healing to people in need in the temples.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'uman') then
        npcHandler:say('The church of Uman oversees the education of the masses as well as the doings of the sorcerer and druid guilds. It decides which lines of research are in accordance with the will of Uman and which are not. ...', cid)
        npcHandler:say('Concerned, the inquisition watches the attempts of these guilds to become more and more independent and to make own decisions. ...', cid, 4000)
        npcHandler:say('Unfortunately, the sorcerer guild has become dangerously influential and so the hands of our priests are tied due to political matters ...', cid, 7000)
        npcHandler:say('The druids lately claim that they are serving Crunor\'s will and not Uman\'s. Such heresy could only become possible with the independence of Carlin from the Thaian kingdom. ...', cid, 10000)
        npcHandler:say('The spiritual centre of the druids switched to Carlin where they have much influence and cannot be supervised by the inquisition.', cid, 13500)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'crunor') then
        npcHandler:say('The church of Crunor works closely together with the druid guild. This makes a cooperation sometimes difficult.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'zathroth') then
        npcHandler:say('We can see his evil influence almost everywhere. Keep your eyes open or the dark one will lead you on the wrong way and destroy you.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'fafnar') then
        npcHandler:say('Fafnar is mostly worshipped by the peasants and farmers in rural areas. ...', cid)
        npcHandler:say('The inquisition has a close eye on these activities. Simply people tend to mix local superstitions with the teachings of the gods. This again may lead to heretical subcults.', cid, 2500)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'carlin') then
        npcHandler:say('Carlin is a city of sin and heresy. After the reunion of Carlin with the kingdom, the inquisition will have much work to purify the city and its inhabitants.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'demon') then
        npcHandler:say('Demons exist in many different shapes and levels of power. In general, they are servants of the dark gods and command great powers of destruction.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'darashia') then
        npcHandler:say('Darashia is a godless town full of mislead fools. One day, it will surely share the fate of its sister town Drefia.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'drefia') then
        npcHandler:say('Drefia used to be a city of sin and heresy, just like Carlin nowadays. One day, the gods decided to destroy this town and to erase all evil there.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'venore') then
        npcHandler:say('Venore is somewhat difficult to handle. The merchants have a close eye on our activities in their city and our authority is limited there. However, we will use all of our influence to prevent a second Carlin.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'edron') then
        npcHandler:say('Edron illustrates perfectly why the inquisition is needed and why we need more funds and manpower. ...', cid)
        npcHandler:say('Our agents were on their way to investigate certain occurrences there when some faithless knights fled to some unholy ruins. ...', cid, 3000)
        npcHandler:say('We were unable to wipe them out and the local order of knighthood was of little help. ...', cid, 6000)
        npcHandler:say('It\'s almost sure that something dangerous is going on there, so we have to continue our efforts.', cid, 9000)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'ankrahmun') then
        npcHandler:say('Even though they claim differently, this city is in the firm grip of Zathroth and his evil minions. Their whole twisted religion is a mockery of the teachings of our gods ...', cid)
        npcHandler:say('As soon as we have gathered the strength, we should crush this city once and for all.', cid, 4000)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'elves') or msgcontains(msg, 'ab\'dendriel') then
        npcHandler:say('Those elves are hardly any more civilised than orcs. They can become a threat to mankind at any time.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'dwarf') or msgcontains(msg, 'kazordoon') then
        npcHandler:say('The dwarfs are allied with Thais but follow their own obscure religion. Although dwarfs keep mostly to themselves, we have to observe this alliance closely.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'druid') then
        npcHandler:say('The druids here still follow the old rules. Sadly, the druids of Carlin have left the right path in the last years.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'sorcerer') then
        npcHandler:say('Those who wield great power have to resist great temptations. We have the burden to eliminate all those who give in to the temptations.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'knight') then
        npcHandler:say('Nowadays, most knights seem to have forgotten the noble cause to which all knights were bound in the past. Only a few have remained pious, serve the gods and follow their teachings.', cid)
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, 'paladin') then
        npcHandler:say('It\'s a shame that only a few paladins still use their abilities to further the cause of the gods of good. Too many paladins have become selfish and greedy.', cid)
        npcHandler.topic[cid] = 0
    end
    return true
end

npcHandler:setMessage(MESSAGE_GREET, "Greetings, fellow {believer} |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Always be on guard, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "This ungraceful haste is most suspicious!") 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 

 

Jean Pierre:
 

Spoiler

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 cfg_ingredients = {
    [1] = {{2666, 2}, {8838, 20}, {8843, 1}, {9114, 1}, {2692, 5}, {2006, 2, 3}},
    [2] = {{7250, 2}, {2685, 2}, {8842, 1}, {2328, 2}, {2805, 5}, {2006, 1, 15}},
    [3] = {{4298, 1}, {8844, 3}, {2691, 5}, {2328, 2}, {2803, 3}, {2788, 5}},
    [4] = {{4265, 1}, {8841, 2}, {2675, 2}, {5907, 2}, {2006, 2, 14}, {2799, 1}},
    [5] = {{6574, 1}, {7966, 1}, {2676, 2}, {2006, 2, 6}, {2802, 1}, {2800, 1}},
    [6] = {{2684, 2}, {2685, 2}, {2686, 2}, {8842, 2}, {8843, 1}, {9114, 1}, {2696, 1}, {2787, 20}, {2789, 5}},
    [7] = {{8844, 10}, {2696, 2}, {2805, 1}, {2804, 1}, {2006, 1, 43}, {2328, 2}},
    [8] = {{2671, 1}, {8839, 5}, {8843, 1}, {8845, 2}, {2683, 1}, {8844, 2}},
    [9] = {{2669, 1}, {7158, 1}, {7159, 1}, {2670, 5}, {2690, 2}, {2801, 1}},
    [10] = {{2684, 5}, {2006, 1, 6}, {8841, 1}, {2692, 10}, {2695, 2}, {2687, 10}, {7910, 2}},
    [11] = {{2006, 5, 14}, {2789, 5}, {2788, 5}, {11246, 10}, {2670, 10}},
    [12] = {{11373, 5}, {2006, 2, 1}, {2684, 20}, {8838, 10}, {8844, 3}},
    [13] = {{6569, 3}, {2688, 3}, {6574, 2}, {6501, 15}, {6558, 1}},
    [14] = {{2695, 40}, {5097, 20}, {5902, 10}, {9674, 1}, {5942, 1}}
}

local function playerHasIngredients(cid)
    local player = Player(cid)
    local table = cfg_ingredients[player:getStorageValue(50023)]
    if table ~= nil then
        for i = 1, #table do
            local itemCount = player:getItemCount(table[1], table[3] or -1)
                if itemCount < table[2] then
                        itemCount = table[2] - itemCount
                return false
            end
               end
    end
    for i = 1, #table do
            player:removeItem(unpack(table))
    end
    return true
end


local function greetCallback(cid)
    local player = Player(cid)
    if player:getStorageValue(50022) < 1 then
        npcHandler:setMessage(MESSAGE_GREET, "Greetings, "..player:getName()..". What are you doing out here?")
    else
        npcHandler:setMessage(MESSAGE_GREET, "Hello there again, "..player:getName().."! I guess you're back for some cooking - let's get going then!")
    end    
    return true
end

local function creatureSayCallback(cid, type, msg)
    local player = Player(cid)
    if not npcHandler:isFocused(cid) then
        return false
    elseif msgcontains(msg, "cook") then
        if player:getStorageValue(50022) < 1 then
            npcHandler:say("Well, I'm not a simple cook. I travel the whole Tibian continent for the most artfully seasoned {recipes} and constantly develop new ones.", cid)
            npcHandler.topic[cid] = 1    
        end
    elseif msgcontains(msg, "recipe") or msgcontains(msg, "menu") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say("You're interested in my recipes? Well. They are not for sale, but if you want to become my {apprentice}, I'll share my knowledge with you.", cid)
            npcHandler.topic[cid] = 2
        end
        if player:getStorageValue(50022) == 1 then
            if player:getStorageValue(50023) == 1 then
                npcHandler:say({"The first dish we are going to prepare together is called {Rotworm Stew}. Now, don't be scared off. Of course we won't eat those nasty and dirty earth-crawlers! ...",
                        "The name is just for the effect it has on people. <winks> Bring me the following ingredients and I'll show you how it's done. ...",
                        "Two pieces of meat, two vials of beer, twenty potatoes, one onion, one bulb of garlic and five ounces of flour. Make sure that the ingredients are fresh and smell good."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 4
            elseif player:getStorageValue(50023) == 2 then
                npcHandler:say({"The next dish we are going to prepare together is called {Hydra Tongue Salad}. The common hydra tongue is a pest plant with an surprisingly aromatic taste. ...",
                        "We'll add some other vegetables and spices for the delicate and distinctive taste. Bring me the following ingredients and I'll show you how it's done. ...",
                        "Two hydra tongue plants, two tomatoes, one cucumber, two eggs, one troll green and one vial of wine."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 6
            elseif player:getStorageValue(50023) == 3 then
                npcHandler:say({"The next dish we are going to prepare together is called {Roasted Dragon Wings}. Oh, don't give me that look! Of course you don't have to bring a whole dragon up here. ...",
                        "The 'dragon' part derives from the fiery afterburn of this meal, but the wings we use are much smaller, though similar in shape. Bring me the following ingredients and I'll show you how it's done. ...",
                        "One fresh dead bat, three jalapeño peppers, five brown breads, two eggs, one powder herb and five red mushrooms."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 8    
            elseif player:getStorageValue(50023) == 4 then
                npcHandler:say({"The next dish we are going to prepare together is called {Tropical Fried Terrorbird}. You might have guessed it, we're not going to use a terrorbird. But! ...",
                        "The dish is quite fried and tropical. Bring me the following ingredients and we're going to prepare it: One fresh dead chicken, two lemons, two oranges, two mangos, one stone herb and two vials of coconut milk."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 10
            elseif player:getStorageValue(50023) == 5 then
                npcHandler:say({"The next dish we are going to prepare together is called {Banana Chocolate Shake}. After all those spicy dishes you should treat your guests with a sweet surprise. ...",
                        "Bring me the following ingredients and we'll make one hell of a drink: one bar of chocolate, one cream cake, two bananas, two vials of milk, one sling herb and one star herb."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 12
            elseif player:getStorageValue(50023) == 6 then
                npcHandler:say({"The next dish we are going to prepare together is called {Veggie Casserole}. This one is going to be your masterpiece so far, I'm telling you. ...",
                        "It's also quite healthy! - Well, that's what I keep telling me when I eat the third serving, hehehe. Bring me the following ingredients and I'll show you how it's done. ...",
                        "Two carrots, two tomatoes, two corncobs, two cucumbers, one onion, one bulb of garlic, one piece of cheese, twenty white mushrooms and five brown mushrooms."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 14
            elseif player:getStorageValue(50023) == 7 then
                npcHandler:say({"The next dish we are going to prepare together is called {Filled Jalapeño Peppers}. It's a great snack and quite spicy, for those who like it hot. ...",
                        "Bring me the following ingredients and I'll show you how it's done: Ten jalapeño peppers, two pieces of cheese, one troll green, one shadow herb, one vial of mead and two eggs."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 16
            elseif player:getStorageValue(50023) == 8 then
                npcHandler:say({"The next dish we are going to prepare together is called {Blessed Steak}. <giggles> I'm sorry, I couldn't resist the pun with this one. ...",
                        "Don't worry, there's no temple trip awaiting you. Just bring me the following: one piece of ham, five plums, one onion, two beetroots, one pumpkin and two jalapeño peppers."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 18
            elseif player:getStorageValue(50023) == 9 then
                npcHandler:say({"The next dish we are going to prepare together is called {Northern Fishburger}. I hope you like fish, not everyone does. This one is a specialty I picked up in Svargrond. ...",
                        "Bring me the following ingredients and I'll show you how it's done: one northern pike, one rainbow trout, one green perch, five shrimps, two rolls and one fern."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 20
            elseif player:getStorageValue(50023) == 10 then
                npcHandler:say({"The last dish we are going to prepare together is called {Carrot Cake}. Yes, it's a real cake, we need a tasty desert to complete our cooking course. ...",
                        "Bring me the following ingredients and I'll lead you through it: five carrots, one vial of milk, one lemon, ten ounces of flour, two eggs, ten cookies and two peanuts."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 22
            elseif player:getStorageValue(50023) == 11 then
                npcHandler:say({"Yes, you heard that right! Even though I was laying sick on my divan for weeks, I have some new dishes for you. Ehem. Of course I couldn't have done it without my little helpers travelling around the world and discovering recipes. ...",
                        "So... <rubs hands together> ... each good menu needs an amazing starter to awaken and stimulate all the little taste buds on your tongue. We're going to cook a nice portion of {Coconut Shrimp Bake}! ...",
                        "This is an exotic rice dish with hints of mushrooms and shrimps, topped with sweet coconut goodness - brought to me by a beautiful druid lady a few days ago. My mouth starts watering already! ...",
                        "... because of the dish, I mean, of course. Ehem. Bring me the following ingredients and we'll get started: Five vials of coconut milk, five brown mushrooms, five red mushrooms, ten rice balls and ten shrimps."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 24
            elseif player:getStorageValue(50023) == 12 then
                npcHandler:say({"After this wonderful and tasty starter we're all set for a special dish I learnt from a brave adventurer who almost starved when he got lost in the mountains between Ankrahmun and Port Hope, or so he told me. ...",
                        "Luckily, he was saved by nomads - can you imagine? - and they fed him a special local dish that's very cheap and easy to prepare, yet rich in vitamins and spending energy for hours. ...",
                        "Now don't be shocked, but - they do put sandcrawlers in there. When I tried to prepare that dish at first, I was repelled by its awful appearance, but since it smelled so good I did take a sip and was pleasantly surprised of the great taste. ...",
                        "According to the adventurer, this meal works well with any kind of vegetables or any kind of edible creepy-crawlers, depending on what the nomads get their hands on, but we'll stick to the original for now! ...",
                        "Bring me the following ingredients - if you dare - and I'll show you the secret of {Blackjack}: Five sandcrawler shells, two vials of water, twenty carrots, ten potatoes and three jalapeño peppers."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 26
            elseif player:getStorageValue(50023) == 13 then
                npcHandler:say({"Weren't you surprised by the great taste of our main dish? In case you still have some space left in your tummy, we're in for a sweet and fun dessert - but beware unwanted side effects! ...",
                        "It was introduced to me by a fearless knight who invented this recipe rather by accident when a bottle of demonic blood broke in his backpack and spilled its contents over his bag of candy balls. ...",
                        "Curiously, he tried one and red steam came out of his ears - but it tasted so great that he instantly popped another one in his mouth, and then another, and another. ...",
                        "Each one seemed to cause a different effect and he was never really sure what the next one would do. Seems safer to be careful with them and not to eat them in dangerous situations! ...",
                        "In any case, bring me the following ingredients and we'll make some {Demonic Candy Balls}, if you like: Three candies, three candy canes, two bars of chocolate, fifteen gingerbread men and one concentrated demonic blood."
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 28
            elseif player:getStorageValue(50023) == 14 then
                npcHandler:say({"Did you dare eat all of your Demonic Candy Balls...? Hehehe! Well, I almost forgot one of the most essential parts for a perfect dinner. A drink! I have one for you, almost a designer drink you could say. ...",
                        "Its inventor seems to have done some scientific research in order to achieve his desired effect, which is - charging magical rings. You have to drink it while you're wearing one for a miraculous effect! ...",
                        "Bring me the following ingredients and we'll get started: Fourty eggs, twenty mangos, ten honeycombs, one bottle of bug milk and one blessed wooden stake. ...",
                        "Oh yes, I understand your worries about the eggs, but just make sure they're fresh and all should be fine for our {Sweet Mangonaise Elixir}!"
                        }, cid, 0, 1, 4000)
                npcHandler.topic[cid] = 30
            end
        elseif player:getStorageValue(50022) == 2 then
            npcHandler:say("You can now cook any dish you want from this list: {Rotworm Stew, Hydra Tongue Salad, Roasted Dragon Wings, Tropical Fried Terrorbird, Banana Chocolate Shake, Veggie Casserole, Filled Jalapeno Peppers, Blessed Steak, Northern Fishburger, Carrot Cake, Coconut Shrimp Bake, Blackjack, Demonic Candy Balls, Sweet Mangonaise Elixir}.", cid)
        end
    elseif msgcontains(msg, "apprentice") then
        if npcHandler.topic[cid] == 2 then
            npcHandler:say("Hmm. You look quite promising. Can't hurt to give it a try, I guess. Would you like to become my apprentice, "..player:getName().."?", cid)
            npcHandler.topic[cid] = 3
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 3 then
            npcHandler:say("Fine, young human. Ask me for a {recipe} anytime and I'll teach you what I know.", cid)
            player:setStorageValue(50022, 1)
            player:setStorageValue(50023, 1)
            player:setStorageValue(50024, 1) --QuestLog
        elseif npcHandler.topic[cid] == 5 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Aah, so let's see! <prepares the food quickly while he explains it to you> We cook the meat in a large pot together with the chopped onion until it's separated from the bones. Now we also have a fine meat broth! ...",
                        "Cut the potatoes into small pieces and add them to the pot. Add some flour to thicken the stew. Finally, spice it up with some garlic and add beer for the typical dwarvish taste! ...",
                        "And voilà, we're done. I developed this recipe while talking to Maryza in the Jolly Axeman. She said to eat it when one's health is low. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 2)
                player:setStorageValue(50024, 2) --QuestLog    
                player:addItem(9992, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 7 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Okay, here we go! <cuts the ingredients so fast that his hands seem almost blurry> This one is easy, just chop the hydra tongues, tomatoes and cucumber into tiny pieces. ...",
                        "Now for the sauce - our base is wine, in which we mix the raw eggs until it got a nice smooth consistency. Add grinded troll green, whose flavour is quite similar to basil and shake the sauce in a mug. ...",
                        "Pour it over the salad, and voilà, we're done! This is a Venorean recipe and very tasty. I recommend eating it when you're suffering from some kind of dangerous condition. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 3)
                player:setStorageValue(50024, 3) --QuestLog
                player:addItem(9993, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 9 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Let's get started! <starts grinding and chopping at amazing speed> The trick with this one is the crunchy crust around the wings. ...",
                        "First, we grate the dry brown bread into very small crumbs and mix that with the two eggs. Add grinded peppers for the spicy taste and the powder herb for a hint of curry flavour. ...",
                        "Carefully separate the bat wings, clean them of any possible hairs and coat them in our mixture. Roast them in a pan together with sliced mushrooms and serve. ...",
                        "Voilà, we're done! This recipe is from the area around Thais and should help you protect yourself in your battles. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 4)
                player:setStorageValue(50024, 4) --QuestLog
                player:addItem(9994, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 11 then
            if playerHasIngredients(cid) then
                npcHandler:say({"This is a recipe right from the jungles of Tiquanda! <grinds and chops during his talk> Grind the stone herb and mix it with the coconut milk, then bathe the chicken in it for a while. ...",
                        "In the meantime, peel the oranges and mangos, chop them into pieces and add them to the mix. Take the chicken out of its bath and fry it, preferably over open fire. ...",
                        "Take the fruits out of the spicy coconut milk and heat them on an oven. Once the chicken is fried, add the fruits and spray some squeezed lemon over it. ...",
                        "Voilà, we're done! They say that this dish has magical abilities and can awaken secret powers in you during your battles. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 5)
                player:setStorageValue(50024, 5) --QuestLog
                player:addItem(9995, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 13 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Great! Let's get it done! <mixes and shakes faster than any human could> An easy one again, but you'll get right into holiday mood, like the Meriana beach dwellers I got that recipe from. ...",
                        "Melt the chocolate in a hot-water bath and add the grinded herbs - did you know, those herbs have a flavour like cinnamon and vanilla, yummy! Keep at gentle heat and add the milk. ...",
                        "Mash the banana and stir it really well into the chocolate-milk mixture. Gosh, do you smell that? Pure goodness! Now finally, we take just a bit of the creamcake and fold it in. ...",
                        "Voilà, we're done! To be honest, I don't know what this drink does, but at least it makes me really happy. Drink together with a loved one and enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 6)
                player:setStorageValue(50024, 6) --QuestLog
                player:addItem(9996, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 15 then
            if playerHasIngredients(cid) then
                npcHandler:say({"So let's start! <rubs hands together and chops the vegetables> This is a dish especially famous in the area around Ab'Dendriel! Chop the onions into little cubes and sweat them in a pan until they are glassy. ...",
                        "Add garlic and mushrooms and fry gently until the mushrooms have shrunk up. Now, we add the peeled tomatoes and corn and have it all nicely cook together. ...",
                        "Put in carrot pieces and cucumber at the very end, so they will stay crisp! Finally put the cheese over it like a little blanket have it melt on the oven until it's slightly brownish. ...",
                        "And voilà, we're done! This dish will help you in your battles and supply you with enough power to hit really hard! Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 7)
                player:setStorageValue(50024, 7) --QuestLog
                player:addItem(9997, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 17 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Okay! So after all of these heavy dishes, we're going to create a fast little snack. <starts preparing the peppers as he speaks> ...",
                        "First of all, remove the top of the jalapeño peppers and clean their inside, so that you have space for the filling. Now for the filling, we grate the cheese and mix it with the mead and the eggs, until it has a nice consistency. ...",
                        "We add the grinded herbs and blend it well. Push a spoonful in each jalapeño pepper until they are nicely stuffed. Now, we shortly fry the jalapeño peppers in a pan to heat them up. ...",
                        "The filling will melt nicely, just be careful that it doesn't drip out! And voilà, we're done! ...",
                        "This famous dish from Ankrahmun is quite hot and spicy, so only eat one at a time. It's also possible that you get the urge to run really fast afterwards. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, ?
                player:setStorageValue(50024, ? --QuestLog
                player:addItem(9998, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 19 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Here we go! <pounds with his bare hands on the steak> This will break through the meat fibres, making our steak more tender for this fine Daramanian dish. ...",
                        "It's easy to prepare, just chop and sweat the onions and add small pieces of pumpkin, beetroot, plums and peppers. Put the steak into the pan too to let it absorb some of the sweet and fruity flavour. ...",
                        "Finally, remove the fruits and onions from the pan and fry the steak from both sides until it's crisp and crusty. Put on a plate and decorate with the fruit mix. ...",
                        "The people of Darashia say that it has magical abilities and will help you if you feel totally drained. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 9)
                player:setStorageValue(50024, 9) --QuestLog
                player:addItem(9999, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 21 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Great! After all this meat, we shouldn't neglect to prepare some fish. <carefully removes heads, tails and bones from the fishes and peels shrimps at incredible speed> ...",
                        "This easy dish from Svargrond is what you'd call fast food, but its outstanding taste justifies to put it in my book about {Hot Cuisine}. ...",
                        "Simply cut the rolls in half, shortly fry one slice of each fish type, put in the shrimps and spice up with grinded fern, which, by the way, tastes slightly like dill. ...",
                        "Nicely decorate it on a plate, and voilr, we're done already! Can't tell you much about the effects, but fishermen in Svargrond seem to love it. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 10)
                player:setStorageValue(50024, 10) --QuestLog
                player:addItem(10001, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 23 then
            if playerHasIngredients(cid) then
                npcHandler:say({"So, now for our final dish - a grand dessert from the amazon girls at Carlin! <grates carrots during his explanations> ...",
                        "It's easy as it can be - mix a normal cake dough with milk, flour and eggs, then add some cookie crumbs for the crunchy effect later on. ...",
                        "Stir in the grated carrots and tiny peanut pieces and bake it for about thirty minutes! Now we'll make a great topping with sugar and lemon juice, pour it over the cake and decorate it. ...",
                        "And voilà, we're done! The girls of Carlin swear that it sharpens their eyesight, at least for a while. I'm sure it will somehow aid you in your battles. Enjoy! ...",
                        "Oh, which reminds me - my little apprentice, we are finished with our cooking course. I think you did great and if it was my decision, you could open your own tavern. ...",
                        "But anyway, it's up to you what you make of your newly discovered skills! In case you forget my recipes, please feel free to take a copy of the cookbook upstairs. ...",
                        "You can drop by and practice cooking those dishes, at least during the time that I'm at home. I promise that I will cook each dish once with you, but then I have to take care of my other apprentices. Cheers to you!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 11)
                player:setStorageValue(50024, 11) --QuestLog
                player:setStorageValue(50028, 1) --Able to obtain the cookbook
                player:addItem(10000, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 25 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Yum! Just the thought of it makes me drool. <tosses the shrimps into a bowl and soaks them in coconut milk as he goes on chopping all mushrooms in the blink of an eye> ...",
                        "I see you brought real Zaoan rice balls! That saves us a lot of time as we don't have to cook the rice anymore. Now we just flatten them out nice and medium thick on this baking tray. <squeezes and smoothes the rice piles with his fingers> ...",
                        "In the meantime, our shrimps have absorbed some of the coconut milk and we can now add them on top of the rice. <spreads them evenly across the rice and pours the coconut milk from the bowl over the rice> ...",
                        "Now we just need to add the mushrooms <tosses them all over the tray>, pour the rest of the coconut milk over it and put it into the oven! ...",
                        "... dum di dum ... <waits> ...",
                        "Aaaaaaand there you go! Sweet coconut goodness! And psst - the shrimps add some submarine flavour to this dish. You should definitely eat it while walking underwater and wearing a helmet of the deep. Just in case. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 12)
                player:setStorageValue(50024, 13) --QuestLog
                player:addItem(12540, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 27 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Awesome! Let's go! Let's start with preparing the sandcrawlers <starts boiling water on a stove and tosses the sandcrawler shells in there> ...",
                        "I understand your scepticism, but believe me, all will be well! As you can see, they change colour from dark to light red, and that's when they also start turning soft. <stirs with one hand while he slices carrots and peppers with the other hand> ...",
                        "Now add whole potatoes and let everything cook at high temperature until the potatoes are so soft they're basically falling apart. <mashes really fast, creating something of a dark brownish colour that doesn't really look tasty> ...",
                        "Yes yes, I know, don't give me that look! You'll be surprised! Now just add the chopped carrots and chili for a healthy portion of vitamins and spices, keep stiring and mashing and let it simmer for about an hour. ...",
                        "You're wondering why I chose a simple recipe like that for my famous menu? You'll know when you taste it! ...",
                        "Heeeeeere you are - just a few spoons of this great stew make you so full that the bowl I give you will last for a long time until it's finally depleted. Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 13)
                player:setStorageValue(50024, 14) --QuestLog
                player:addItem(12542, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 29 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Very nice! I'm ready for action! <quickly grabs all the candies, candy canes and gingerbread men and crushes them with amazing speed> ...",
                        "After having crushed all those sweets, we need to melt the chocolate into a thick liquid... <creates a magical flame by snapping his fingers and melts the chocolate so fast over the sweets that it's amazing he didn't spill it everywhere> ...",
                        "... and form little balls together with the sweets! <shapes candy balls about the size of rice balls faster and more perfectly than any mortal ever could> ...",
                        "Now, carefully, we add the demonic blood... <and time seems to stand still as seemingly for the first time ever he does something slowly, pouring a single drop of concentrated demonic blood onto each ball> ...",
                        "Here you go, but beware possible side effects! You never know for sure what will happen and so far all of those I tried had awesome effects, so of course I don't hope for nasty surprises! Enjoy!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50023, 14)
                player:setStorageValue(50024, 15) --QuestLog
                player:addItem(12543, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end
        elseif npcHandler.topic[cid] == 31 then
            if playerHasIngredients(cid) then
                npcHandler:say({"Time to have a sweet drink! Let's pour the bug milk into my cauldron and heat it over fire until it's boiling... <starts slicing mangoes in the meantime> there! ...",
                        "Now we're breaking all of the eggs into there - 1, 2, 10, 20, 40 <ticktickcrack> crumble the honeycombs and toss the sliced mangoes into the hot mix. ...",
                        "Now we just have to let it simmer and stir using a blessed wooden stake <stirs so vigorously that you can barely see his arms anymore> for thirty minutes. ...",
                        "By now, the power of the blessed wooden stake will have been transferred into our elixir, so let's put out the fire and let it cool down. ...",
                        "<carefully pours the cooled elixir into a small bottle or glass> There! Its inventor said it had amazing effects on the ring you're wearing, as long as the ring is based on time, not on charges. Enjoy! ...",
                        "And by the way... since those were all the recipes from this year and you cooked them so nicely, you may take the cookbook containing them from upstairs, if you like!"
                        }, cid, 0, 1, 4000)
                player:setStorageValue(50022, 2)
                player:setStorageValue(50023, 15)
                player:setStorageValue(50024, 16) --QuestLog
                player:addItem(12544, 1)
                npcHandler.topic[cid] = 0
            else
                npcHandler:say("Make sure that you have all the ingredients, with you.", cid)
                npcHandler.topic[cid] = 0
            end    
        end
    --Dishes first time
    elseif msgcontains(msg, "rotworm stew") then    
        if npcHandler.topic[cid] == 4 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to cook Rotworm Stew with me?", cid)
            player:setStorageValue(50023, 1)
            npcHandler.topic[cid] = 5
        end
    elseif msgcontains(msg, "hydra tongue salad") then
        if npcHandler.topic[cid] == 6 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to prepare a Hydra Tongue Salad with me?", cid)
            player:setStorageValue(50023, 2)
            npcHandler.topic[cid] = 7
        end
    elseif msgcontains(msg, "roasted dragon wings") then
        if npcHandler.topic[cid] == 8 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to prepare Roasted Dragon Wings with me?", cid)
            player:setStorageValue(50023, 3)
            npcHandler.topic[cid] = 9
        end
    elseif msgcontains(msg, "tropical fried terrorbird") then
        if npcHandler.topic[cid] == 10 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to prepare a Tropical Fried Terrorbird with me?", cid)
            player:setStorageValue(50023, 4)
            npcHandler.topic[cid] = 11
        end
    elseif msgcontains(msg, "banana chocolate shake") then
        if npcHandler.topic[cid] == 12 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to make a Banana Chocolate Shake with me?", cid)
            player:setStorageValue(50023, 5)
            npcHandler.topic[cid] = 13
        end
    elseif msgcontains(msg, "veggie casserole") then
        if npcHandler.topic[cid] == 14 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to cook a Veggie Casserole with me?", cid)
            player:setStorageValue(50023, 6)
            npcHandler.topic[cid] = 15
        end
    elseif msgcontains(msg, "filled jalapeño peppers") then
        if npcHandler.topic[cid] == 16 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to prepare Filled Jalapeño Peppers with me?", cid)
            player:setStorageValue(50023, 7)
            npcHandler.topic[cid] = 17
        end
    elseif msgcontains(msg, "blessed steak") then
        if npcHandler.topic[cid] == 18 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to prepare a Blessed Steak with me?", cid)
            player:setStorageValue(50023, ?
            npcHandler.topic[cid] = 19
        end
    elseif msgcontains(msg, "northern fishburger") then
        if npcHandler.topic[cid] == 20 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to make a Northern Fishburger with me?", cid)
            player:setStorageValue(50023, 9)
            npcHandler.topic[cid] = 21
        end
    elseif msgcontains(msg, "carrot cake") then
        if npcHandler.topic[cid] == 22 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to bake a Carrot Cake with me?", cid)
            player:setStorageValue(50023, 10)
            npcHandler.topic[cid] = 23
        end
    elseif msgcontains(msg, "coconut shrimp bake") then
        if npcHandler.topic[cid] == 24 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to prepare a Coconut Shrimp Bake with me?", cid)
            player:setStorageValue(50023, 11)
            npcHandler.topic[cid] = 25
        end
    elseif msgcontains(msg, "blackjack") then
        if npcHandler.topic[cid] == 26 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to cook a Blackjack with me?", cid)
            player:setStorageValue(50023, 12)
            npcHandler.topic[cid] = 27
        end
    elseif msgcontains(msg, "demonic candy ball") then
        if npcHandler.topic[cid] == 28 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to make Demonic Candy Balls with me?", cid)
            player:setStorageValue(50023, 13)
            npcHandler.topic[cid] = 29
        end
    elseif msgcontains(msg, "sweet mangonaise elixir") then
        if npcHandler.topic[cid] == 30 or player:getStorageValue(50022) == 2 then
            npcHandler:say("Did you gather all necessary ingredients to mix Sweet Mangonaise Elixir with me?", cid)
            player:setStorageValue(50023, 14)
            npcHandler.topic[cid] = 31
        end
    elseif msgcontains(msg, "no") then
        npcHandler:say("No?, come back when you are ready to cook.", cid)
        npcHandler.topic[cid] = 0    
    end
    return true
end

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

 

Esses são só exemplo de NPCs que testei isso.

 

No Henricus consigo falar até hi - inquisitor - join, depois teria que falar yes mas ele não responde mais

No Jean Pierre consigo falar até hi - cook, depois teria que falar recipe ou menu mas ele não responde mais

 

Não sei se existe alguma coisa bloqueando eu continuar a conversa com os NPCs, nunca vi esse tipo de erro e como eu disse não da erro no console.

Os NPCs de Trade funciona perfeitamente.

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...