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

[0.4 / OTX 2] Barbarian Outfit Quest 99%

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
Here is the Barbarian Outfit Quest almost 100%.
What is missing? Only the correct lines of the NPCs are missing when the player does not have the item.

I spent almost 2 hours to make it, hope it helps someone :)
Ah, if you use TFS 1.0 or higher, I'm sure it will be simple to convert.

PS.: I took some care in case the player's server or internet goes down, so the steps are saved by storage.
PS 2.: I recommend adding the achievement "Brutal Politeness" after winning the first addon.

For more details, visit: Barbarian Outfits Quest/Spoiler (https://tibia.fandom.com/wiki/Barbarian_Outfits_Quest/Spoiler)

Bron.xml
XML:
<?xml version="1.0"?>
<npc name="Bron" script="data/npc/scripts/Carlin/Bron.lua" walkinterval="2000">
  <mana now="800" max="800" />
  <health now="200" max="200" />
  <look type="143" head="95" body="94" legs="132" feet="86" addons="2"/>
  <parameters>
    <parameter key="message_farewell" value="Take care, |PLAYERNAME|!" />
    <parameter key="message_walkaway" value="Take care!" />
  </parameters>
</npc>

Ajax.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Ajax" script="data/npc/scripts/Carlin/Ajax.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
    <look type="143" head="78" body="82" legs="120" feet="94" addons="1"/>
</npc>

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

local Topic = {}

function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    local storageFirstAddonBarbarian = 900443
    local storageSecondAddonBarbarian = 900444

    if (msgcontains(msg, "hi") or msgcontains(msg, "hello")) and (not npcHandler:isFocused(cid)) then
        if getCreatureStorage(cid, storageSecondAddonBarbarian) == 6 then
            npcHandler:say("Oh no! Was that really me? This is so embarassing, I have no idea what has gotten into me. Was that the fighting spirit you gave me?", cid)
            setPlayerStorageValue(cid, storageSecondAddonBarbarian, 7)
        else
            npcHandler:say("Welcome to my humble hut, "..getPlayerName(cid)..".", cid)
        end
        npcHandler:addFocus(cid)
        Topic[cid] = nil
        return true
    end

    if(not npcHandler:isFocused(cid)) then
        return false
    end
 
    --[ BARBARIAN OUTFIT 2 ]--
    if msgcontains(msg, "violence") and getCreatureStorage(cid, storageSecondAddonBarbarian) == -1 then
        npcHandler:say("Convincing Ajax that it is not always necessary to use brute force... this would be such an achievement. Definitely a hard task though. ...", cid)
        npcHandler:say("Listen, I simply have to ask, maybe a stranger can influence him better than I can. Would you help me with my brother?", cid, 2000)
        Topic[cid] = 1
    elseif msgcontains(msg, "yes") and Topic[cid] == 1 and getCreatureStorage(cid, storageSecondAddonBarbarian) == -1 then
        npcHandler:say("Really! That is such an incredibly nice offer! I already have a plan. You have to teach him that sometimes words are stronger than fists. ...", cid)
        npcHandler:say("Maybe you can provoke him with something to get angry, like saying... 'MINE!' or something. But beware, I'm sure that he will try to hit you. ...", cid, 2000)
        npcHandler:say("Don't do this if you feel weak or ill. He will probably want to make you leave by using violence, but just stay strong and refuse to give up. ...", cid, 4000)
        npcHandler:say("If he should ask what else is necessary to make you leave, tell him to 'say please'. Afterwards, do leave and return to him one hour later. ...", cid, 6000)
        npcHandler:say("This way he might learn that violence doesn't always help, but that a friendly word might just do the trick. ...", cid, 8000)
        npcHandler:say("Have you understood everything I told you and are really willing to take this risk?", cid, 10000)
        Topic[cid] = 2
    elseif msgcontains(msg, "yes") and Topic[cid] == 2 and getCreatureStorage(cid, storageSecondAddonBarbarian) == -1 then
        npcHandler:say("You are indeed not only well educated, but also very courageous. I wish you good luck, you are my last hope.", cid)
        setPlayerStorageValue(cid, storageSecondAddonBarbarian, 1)
        doPlayerSave(cid)
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
        Topic[cid] = nil

    elseif msgcontains(msg, "brother is right. fist not always good") and getCreatureStorage(cid, storageSecondAddonBarbarian) == 3 then
        npcHandler:say("Oh! He really said that? I am so proud of you, "..getPlayerName(cid)..". These are really good news. Everything would be great... if only there wasn't this person near my house.", cid)
        Topic[cid] = 3
    elseif msgcontains(msg, "person") and Topic[cid] == 3 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 3 then
        npcHandler:say("This... person... makes me want to... say something bad... must... control myself. <sweats> I really don't know what to do anymore....", cid)
        npcHandler:say("I wonder if Ajax has an idea. Could you ask him about Gelagos?", cid, 2000)
        Topic[cid] = 4
    elseif msgcontains(msg, "yes") and Topic[cid] == 4 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 3 then
        npcHandler:say("Again, I have to thank you for your selfless offer to help me. I hope that Ajax can come up with something, now that he has experienced the power of words.", cid)
        setPlayerStorageValue(cid, storageSecondAddonBarbarian, 4)
        doPlayerSave(cid)
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
        Topic[cid] = nil


    elseif msgcontains(msg, "fighting spirit") and getCreatureStorage(cid, storageSecondAddonBarbarian) == 5 then
        if getPlayerItemCount(cid, 5884) >= 1 then
            if doPlayerRemoveItem(cid, 5884, 1) then
                npcHandler:say("Fighting spirit? What am I supposed to do with this fi... - oh! I feel strange... ME MIGHTY! ME WILL CHASE OFF ANNOYING KIDS!GROOOAARR!! RRRRRRRRRRRRAAAAAAAGE!!", cid)
                setPlayerStorageValue(cid, storageSecondAddonBarbarian, 6)
                doPlayerSave(cid)
                npcHandler:releaseFocus(cid)
                npcHandler:resetNpc(cid)
            end
        else
            npcHandler:say("Where is it?", cid)
        end
        Topic[cid] = nil

    elseif (msgcontains(msg, "yes") or msgcontains(msg, "help")) and Topic[cid] == nil and getCreatureStorage(cid, storageSecondAddonBarbarian) == 7 then
        npcHandler:say("I'm impressed... I am sure this was Ajax' idea. I would love to give him a present, but if I leave my hut to gather ingredients, he will surely notice. ...", cid)
        npcHandler:say("Would you maybe help me again, one last time, my friend? I assure you that your efforts will not be in vain.", cid, 2000)
        Topic[cid] = 5
    elseif msgcontains(msg, "yes") and Topic[cid] == 5 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 7 then
        npcHandler:say("Great! You see, I really would love to sew a nice shirt for him. I just need a few things for that, so please listen closely: ...", cid)
        npcHandler:say("He loves green and red, so I will need about 50 pieces of red cloth - like the material heroes make their capes of - and 50 pieces of the green cloth Djinns like. ...", cid, 2000)
        npcHandler:say("Secondly, I need about 10 rolls of spool of yarn. I think mermaids can yarn silk of large spiders to create a smooth thread. ...", cid, 4000)
        npcHandler:say("The only remaining thing needed would be a bottle of warrior's sweat to spray it over the shirt... he just loves this smell. ...", cid, 6000)
        npcHandler:say("Have you understood everything I told you and are willing to handle this task?", cid, 8000)
        Topic[cid] = 6
    elseif msgcontains(msg, "yes") and Topic[cid] == 6 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 7 then
        npcHandler:say("Thank you, my friend! Come back to me once you have collected 50 pieces of red cloth and 50 pieces of green cloth.", cid)
        setPlayerStorageValue(cid, storageSecondAddonBarbarian, 8)
        doPlayerSave(cid)
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
        Topic[cid] = nil

    elseif msgcontains(msg, "red") and msgcontains(msg, "cloth") and getCreatureStorage(cid, storageSecondAddonBarbarian) == 8 then
        npcHandler:say("Have you really managed to fulfil the task and brought me 50 pieces of red cloth and 50 pieces of green cloth?", cid)
        Topic[cid] = 7
    elseif msgcontains(msg, "yes") and Topic[cid] == 7 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 8 then
        if getPlayerItemCount(cid, 5911) >= 50 and getPlayerItemCount(cid, 5910) >= 50 then
            if doPlayerRemoveItem(cid, 5911, 50) and doPlayerRemoveItem(cid, 5910, 50) then
                npcHandler:say("Terrific! I will start to trim it while you gather 10 rolls of spider silk. I'm sure that Ajax will love it.", cid)
                setPlayerStorageValue(cid, storageSecondAddonBarbarian, 9)
                doPlayerSave(cid)
            end
        else
            npcHandler:say("Where is it?", cid)
        end
        Topic[cid] = nil

    elseif msgcontains(msg, "spider") and msgcontains(msg, "silk") and getCreatureStorage(cid, storageSecondAddonBarbarian) == 9 then
        npcHandler:say("Oh, did you bring 10 rolls of spool of yarn for me?", cid)
        Topic[cid] = 8
    elseif msgcontains(msg, "yes") and Topic[cid] == 8 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 9 then
        if getPlayerItemCount(cid, 5886) >= 10 then
            if doPlayerRemoveItem(cid, 5886, 10) then
                npcHandler:say("I'm impressed! You really managed to get spool of yarn for me! I will immediately start to work on this shirt. Please don't forget to bring me warrior's sweat!", cid)
                setPlayerStorageValue(cid, storageSecondAddonBarbarian, 10)
                doPlayerSave(cid)
            end
        else
            npcHandler:say("Where is it?", cid)
        end
        Topic[cid] = nil

    elseif msgcontains(msg, "warrior") and msgcontains(msg, "sweat") and getCreatureStorage(cid, storageSecondAddonBarbarian) == 10 then
        npcHandler:say("Were you able to get hold of a flask with pure warrior's sweat?", cid)
        Topic[cid] = 8
    elseif msgcontains(msg, "yes") and Topic[cid] == 8 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 10 then
        if getPlayerItemCount(cid, 5885) >= 1 then
            if doPlayerRemoveItem(cid, 5885, 1) then
                npcHandler:say("Good work, "..getPlayerName(cid).."! Now I can finally finish this present for Ajax. Because you were such a great help, I have also a present for you. Will you accept it?", cid)
                setPlayerStorageValue(cid, storageSecondAddonBarbarian, 11)
                doPlayerSave(cid)
            end
        else
            npcHandler:say("Where is it?", cid)
        end
        Topic[cid] = nil

    elseif (msgcontains(msg, "yes") or msgcontains(msg, "addon") or msgcontains(msg, "outfit")) and Topic[cid] == nil and getCreatureStorage(cid, storageSecondAddonBarbarian) == 11 then
        npcHandler:say("I have kept this traditional barbarian wig safe for many years now. It is now yours! I hope you will wear it proudly, friend.", cid)
        setPlayerStorageValue(cid, storageSecondAddonBarbarian, 12)
        doPlayerAddOutfit(cid, 147, 2)
        doPlayerAddOutfit(cid, 143, 2)
        doSendMagicEffect(getCreaturePosition(cid), 13)
        doPlayerSave(cid)
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
        Topic[cid] = nil

    end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

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

local Topic = {}

function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)

    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    local storageFirstAddonBarbarian = 900443
    local storageSecondAddonBarbarian = 900444

    
    local storageFirstAddonBarbarianWait = 900446
    local storageSecondAddonBarbarianWait = 900445

    if (msgcontains(msg, "hi") or msgcontains(msg, "hello")) and (not npcHandler:isFocused(cid)) then
        if getCreatureStorage(cid, storageSecondAddonBarbarian) == 2 and getCreatureStorage(cid, storageSecondAddonBarbarianWait) < os.time() then
            npcHandler:say("You back. You know, you right. Brother is right. Fist not always good. Tell him that!", cid)
            setPlayerStorageValue(cid, storageSecondAddonBarbarian, 3)
            npcHandler:releaseFocus(cid)
            npcHandler:resetNpc(cid)
        else
            npcHandler:say("Whatcha do in my place?", cid)
            npcHandler:addFocus(cid)
        end
        return true
    end

    if(not npcHandler:isFocused(cid)) then
        return false
    end
    
    --[ BARBARIAN OUTFIT 2 ]--
    if msgcontains(msg, "mine") and getCreatureStorage(cid, storageSecondAddonBarbarian) == 1 then
        npcHandler:say("YOURS? WHAT IS YOURS! NOTHING IS YOURS! IS MINE! GO AWAY, YES?!", cid)
        Topic[cid] = 1
    elseif msgcontains(msg, "no") and Topic[cid] == 1 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 1 then
        npcHandler:say("YOU STUPID! STUBBORN! I KILL YOU! WILL LEAVE NOW?!", cid)
        Topic[cid] = 2
    elseif msgcontains(msg, "no") and Topic[cid] == 2 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 1 then
        npcHandler:say("ARRRRRRRRRR! YOU ME DRIVE MAD! HOW I MAKE YOU GO??", cid)
        Topic[cid] = 3
    elseif msgcontains(msg, "no") and Topic[cid] == 3 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 1 then
        npcHandler:say("I GIVE YOU NO!", cid)
        Topic[cid] = 4
    elseif msgcontains(msg, "say please") and Topic[cid] == 4 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 1 then
        npcHandler:say("Please? What you mean please? Like I say please you say bye? Please?", cid)
        Topic[cid] = 5
    elseif msgcontains(msg, "yes") and Topic[cid] == 5 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 1 then
        npcHandler:say("Oh. Easy. Okay. Please is good. Now don't say anything. Head aches.", cid)
        setPlayerStorageValue(cid, storageSecondAddonBarbarian, 2)
        setPlayerStorageValue(cid, storageSecondAddonBarbarianWait, os.time() + 60 * 60)
        doPlayerSave(cid)
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
        Topic[cid] = nil

    elseif msgcontains(msg, "gelagos") and getCreatureStorage(cid, storageSecondAddonBarbarian) == 4 then
        npcHandler:say("Bro hates him, but talking no help. Bro needs fighting spirit!", cid)
        Topic[cid] = 6
    elseif msgcontains(msg, "fighting spirit") and Topic[cid] == 6 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 4 then
        npcHandler:say("If you want to help bro, bring him fighting spirit. Magic fighting spirit. Ask Djinn.", cid)
        setPlayerStorageValue(cid, storageSecondAddonBarbarian, 5)
        doPlayerSave(cid)
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
        Topic[cid] = nil

    --[ BARBARIAN OUTFIT 1 ]--
    elseif msgcontains(msg, "present") and getCreatureStorage(cid, storageFirstAddonBarbarian) == -1 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 12 then
        npcHandler:say("Bron gave me present. Ugly, but nice from him. Me want to give present too. You help me?", cid)
        Topic[cid] = 7
    elseif msgcontains(msg, "yes") and Topic[cid] == 7 and getCreatureStorage(cid, storageFirstAddonBarbarian) == -1 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 12 then
        npcHandler:say("Good! Me make shiny weapon. If you help me, I make one for you too. Like axe I wear. I need stuff. Listen. ...", cid)
        npcHandler:say("Me need 100 iron ore. Then need crude iron. Then after that 50 behemoth fangs. And 50 lizard leather. You understand?", cid, 2000)
        npcHandler:say("Help me yes or no?", cid, 4000)
        Topic[cid] = 8
    elseif msgcontains(msg, "yes") and Topic[cid] == 8 and getCreatureStorage(cid, storageFirstAddonBarbarian) == -1 and getCreatureStorage(cid, storageSecondAddonBarbarian) == 12 then
        npcHandler:say("Good. You get 100 iron ore first. Come back.", cid)
        setPlayerStorageValue(cid, storageFirstAddonBarbarian, 1)
        Topic[cid] = nil

    elseif msgcontains(msg, "iron ore") and getCreatureStorage(cid, storageFirstAddonBarbarian) == 1 then
        npcHandler:say("You bring 100 iron ore?", cid)
        Topic[cid] = 9
    elseif msgcontains(msg, "yes") and Topic[cid] == 9 and getCreatureStorage(cid, storageFirstAddonBarbarian) == 1 then
        if getPlayerItemCount(cid, 5880) >= 100 then
            if doPlayerRemoveItem(cid, 5880, 100) then
                npcHandler:say("Good! Now bring crude iron.", cid)
                setPlayerStorageValue(cid, storageFirstAddonBarbarian, 2)
            end
        else
            npcHandler:say("Where is it?", cid)
        end
        Topic[cid] = nil

    elseif msgcontains(msg, "crude iron") and getCreatureStorage(cid, storageFirstAddonBarbarian) == 2 then
        npcHandler:say("You bring a crude iron?", cid)
        Topic[cid] = 10
    elseif msgcontains(msg, "yes") and Topic[cid] == 10 and getCreatureStorage(cid, storageFirstAddonBarbarian) == 2 then
        if getPlayerItemCount(cid, 5892) >= 1 then
            if doPlayerRemoveItem(cid, 5892, 1) then
                npcHandler:say("Good! Now bring 50 behemoth fangs.", cid)
                setPlayerStorageValue(cid, storageFirstAddonBarbarian, 3)
            end
        else
            npcHandler:say("Where is it?", cid)
        end
        Topic[cid] = nil

    elseif msgcontains(msg, "fangs") and getCreatureStorage(cid, storageFirstAddonBarbarian) == 3 then
        npcHandler:say("You bring 50 behemoth fangs?", cid)
        Topic[cid] = 11
    elseif msgcontains(msg, "yes") and Topic[cid] == 11 and getCreatureStorage(cid, storageFirstAddonBarbarian) == 3 then
        if getPlayerItemCount(cid, 5893) >= 50 then
            if doPlayerRemoveItem(cid, 5893, 50) then
                npcHandler:say("Good! Now bring 50 lizard leather.", cid)
                setPlayerStorageValue(cid, storageFirstAddonBarbarian, 4)
            end
        else
            npcHandler:say("Where is it?", cid)
        end
        Topic[cid] = nil

    elseif msgcontains(msg, "leather") and getCreatureStorage(cid, storageFirstAddonBarbarian) == 4 then
        npcHandler:say("You bring 50 lizard leather?", cid)
        Topic[cid] = 12
    elseif msgcontains(msg, "yes") and Topic[cid] == 12 and getCreatureStorage(cid, storageFirstAddonBarbarian) == 4 then
        if getPlayerItemCount(cid, 5876) >= 50 then
            if doPlayerRemoveItem(cid, 5876, 50) then
                npcHandler:say("Ah! All stuff there. I will start making axes now. Come later and ask me for axe.", cid)
                setPlayerStorageValue(cid, storageFirstAddonBarbarian, 5)
                setPlayerStorageValue(cid, storageFirstAddonBarbarianWait, os.time() + 2 * 60 * 60)
            end
        else
            npcHandler:say("Where is it?", cid)
        end
        Topic[cid] = nil

    elseif msgcontains(msg, "axe") and getCreatureStorage(cid, storageFirstAddonBarbarian) == 5 then
        if getCreatureStorage(cid, storageFirstAddonBarbarianWait) < os.time() then
            npcHandler:say("Axe is done! For you. Take. Wear like me.", cid)
            setPlayerStorageValue(cid, storageFirstAddonBarbarian, 6)
            doPlayerAddOutfit(cid, 147, 1)
            doPlayerAddOutfit(cid, 143, 1)
            doSendMagicEffect(getCreaturePosition(cid), 13)
            doPlayerSave(cid)
        else
            npcHandler:say("Axe is not done yet!", cid)
        end
        npcHandler:releaseFocus(cid)
        npcHandler:resetNpc(cid)
        Topic[cid] = nil

    end
    return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
 
Back
Top