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

OTClient OTC questlog and quest storages

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,470
Solutions
27
Reaction score
844
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi! I use TFS 1.4 downgraded 8.6 by nekiro, and mehah's otclient. Tried to use the NPC Padreia to import The Exterminator quest, as a example to see how the quest storage system works and if this could trigger the quest log.

First edited my lib/core/storages.lua to load PlayerStorageKeys.TibiaTales.TheExterminator.
Lua:
--[[
Reserved storage ranges:
- 300000 to 301000+ reserved for achievements
- 20000 to 21000+ reserved for achievement progress
- 10000000 to 20000000 reserved for outfits and mounts on source
]]--
PlayerStorageKeys = {
    annihilatorReward = 30015,
    promotion = 30018,
    delayLargeSeaShell = 30019,
    firstRod = 30020,
    delayWallMirror = 30021,
    madSheepSummon = 30023,
    crateUsable = 30024,
    achievementsBase = 300000,
    achievementsCounter = 20000,

TibiaTales = {
        TheExterminator = 3939,
    }
    }

GlobalStorageKeys = {
}

Then imported Padreia, here is its .lua file
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

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

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

    local player = Player(cid)

    if msgcontains(msg, "cough syrup") then
        npcHandler:say("Do you want to buy a bottle of cough syrup for 50 gold?", cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, 'mission') then
        if player:getStorageValue(PlayerStorageKeys.TibiaTales.TheExterminator) == -1 then
            npcHandler:say({
                'Oh, thank god you came to me. Last night, I had a vision about an upcoming plague here in Carlin. ...',
                'It will originate from slimes that will swarm out of the sewers and infect every citizen with a deadly disease. Are you willing to help me save Carlin?'
            }, cid)
            npcHandler.topic[cid] = 2
        elseif player:getStorageValue(PlayerStorageKeys.TibiaTales.TheExterminator) == 1 then
            npcHandler:say('You MUST find that slime pool immediately or life here in Carlin will not be the same anymore.', cid)
        elseif player:getStorageValue(PlayerStorageKeys.TibiaTales.TheExterminator) == 2 then
            local itemId = {2150, 2149, 2147, 2146}
            for i = 1, #itemId do
                player:addItem(itemId[i], 1)
            end
            player:setStorageValue(PlayerStorageKeys.TibiaTales.TheExterminator, 3)
            npcHandler:say('You did it! Even if only few of the Carliners will ever know about that, you saved all of their lives. Here, take this as a reward. Farewell!', cid)
        else
            npcHandler:say('Maybe the guards have something to do for you or know someone who could need some help.', cid)
        end
    elseif msgcontains(msg, "yes") then
        if npcHandler.topic[cid] == 1 then
            if not player:removeMoney(50) then
                npcHandler:say("You don't have enough money.", cid)
                return true
            end

            npcHandler:say("Thank you. Here it is.", cid)
            player:addItem(4839, 1)
        elseif npcHandler.topic[cid] == 2 then
            player:addItem(8205, 1)
            player:setStorageValue(PlayerStorageKeys.TibiaTales.TheExterminator, 1)
            npcHandler:say({
                'I knew I could count on you. Take this highly intensified vermin poison. In my vision, I saw some kind of \'pool\' where these slimes came from. ...',
                'Pour the poison in the water to stop the demise of Carlin. Tell me about your mission after you fulfilled your task.'
            }, cid)
        end
        npcHandler.topic[cid] = 0
    elseif msgcontains(msg, "no") then
        if npcHandler.topic[cid] == 1 then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        elseif npcHandler.topic[cid] == 2 then
            npcHandler:say('Then the downfall of Carlin is inescapable. Please think about it. You know where to find me.', cid)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = "I am the grand druid of Carlin. I am responsible for the guild, the fields, and our citizens' health."})
keywordHandler:addKeyword({'magic'}, StdModule.say, {npcHandler = npcHandler, text = "Every druid is able to learn the numerous spells of our craft."})
--keywordHandler:addKeyword({'spell'}, StdModule.say, {npcHandler = npcHandler, text = "Sorry, I don't teach spells for your vocation."})

npcHandler:setMessage(MESSAGE_GREET, "Welcome to our humble guild, wanderer. May I be of any assistance to you?")
npcHandler:setMessage(MESSAGE_FAREWELL, "Farewell.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Farewell.")

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

The npc started working, but when I received the mission (after saying, hi, mission), the server sent the message that the questlog was updated. Clicked on the questlog window and nothing appeared.

questlog.png

Why the client questlog didn't get updated? This is my question. Took the NPC and the core/storage lines from ORTS GitHub - EPuncker/orts2: ORTS datapack working on latest TFS (https://github.com/EPuncker/orts2). If you have any solution I will test! Please help me with this one :)

Regards!
Post automatically merged:

Now working! It was registered wrong at quest.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<quests>
    <quest name="Padreia" startstorageid="3939" startstoragevalue="1">
        <mission name="The Exterminator" storageid="3939" startvalue="1" endvalue="3">
            <missionstate id="1" description="Padreia in Carlin asked you to exterminate the slimes in the sewers of Carlin by poisoning their spawn pool." />
            <missionstate id="2" description="You poisoned the spawn pool of the slimes in the sewers of Carlin. Report to Padreia about your mission." />
            <missionstate id="3" description="You successfully helped Padreia in saving Carlin from a slimy disease." />
        </mission>
    </quest>
</quests>
 
Last edited:
Back
Top