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

[Configuration] How to make a working Quest Log

Your Mission 3 doesn't have a mission state for its endvalue, your mission 4 doesn't have a state for any of its values (4-6), furthermore, when you specify a start value and an end value, you must cover each and every mission state in between those two numbers with descriptions (unless you'll be skipping some storage values with other scripts).
its bugged max 1 mission showed completed.

i have 8 mission completed but only the highest show

im not sure but its problem on clientside or serverside

its looks limit to show 1 higher values

C++:
void ProtocolGame::parseQuestLine(const InputMessagePtr& msg)
{
    std::vector<std::tuple<std::string, std::string>> questMissions;
    int questId = msg->getU16();
    int missionCount = msg->getU8();
    for(int i = 0; i < missionCount; i++) {          // 1? 
        std::string missionName = msg->getString();
        std::string missionDescrition = msg->getString();
        questMissions.push_back(std::make_tuple(missionName, missionDescrition));
    }

    g_game.processQuestLine(questId, questMissions);
}
 
data/npc/scripts/nelly.lua:19: attempt to index global 'player' (a nil value)


how tot fix?
 
data/npc/scripts/nelly.lua:19: attempt to index global 'player' (a nil value)


how tot fix?
On line 19 of your script you are trying to use a variable called player which is has no value. I don't know what you changed, but you messed something up :p Also you are using a script written 9 years ago on a much newer engine probably, can't expect copy/paste to work either.
 
It's a pity -1 doesn't work, so you could display available - but not yet taken quests - to the player and advise how to seek them out.
Whilst not super immersive, I suppose it's better in some ways than having to go to a wiki that might tell your players too much and spoil the experience.
 
It's a pity -1 doesn't work, so you could display available - but not yet taken quests - to the player and advise how to seek them out.
Whilst not super immersive, I suppose it's better in some ways than having to go to a wiki that might tell your players too much and spoil the experience.

Could be made in sources to work that way for those who know how to do it.
I personally went a different route a while ago, where most quests on value "0" have that approach (describe the quest and what to do to continue pursuing it) and then set the player's storages to 0 for the quests I want them to have unlocked as they progress.
 
Oh, for some reason I didn't think of that. That's a viable workaround.
Guessing something like this should handle it, barring newly added quests for existing characters.
Lua:
function onLogin(player)

    local quests = {10001, 10002, 10003, 10004, 10005}

    if player:getLastLoginSaved() <= 0 then
        for i=1, #quests do
            setPlayerStorageValue(cid, quests.[i], 0)
    end

    return true
end
 
Last edited:
Oh, for some reason I didn't think of that. That's a viable workaround.
Guessing something like this should handle it, barring newly added quests for existing characters.
Lua:
function onLogin(player)

    local quests = {10001, 10002, 10003, 10004, 10005}

    if player:getLastLoginSaved() <= 0 then
        for i=1, #quests do
            setPlayerStorageValue(cid, quests.[i], 1)
    end

    return true
end

Yeah, pretty much that's the idea. đź‘Ť It could become a quite heavy loop if you really have a ton of quests to add at the start, so I preferred to only unlock a few "Starter Quests" for the player upon first login, and then new quests for other zones are unlocked as they wander into them and so on. That's mostly cuz I'm trying to lighten the load on the onLogin script as much as possible, since I have a ton of stuff in there.
 
Does anybody know How to clean questlog ? I made a new player , when I'm log in i got everything completed ?
Post automatically merged:

I made it just clean storage in login.lua. The quest log has clean , but if i want make for example svar arena npc tell me i got already finish it ;/ any help ?
 
Last edited:
Does anybody know How to clean questlog ? I made a new player , when I'm log in i got everything completed ?
Post automatically merged:

I made it just clean storage in login.lua. The quest log has clean , but if i want make for example svar arena npc tell me i got already finish it ;/ any help ?

Read the thread and understand how Quest Log works relative to storages, then check your quests.xml to see which storages are being used for the quests that appear complete, then check which code in your server is setting those storages to completed values.
 
Read the thread and understand how Quest Log works relative to storages, then check your quests.xml to see which storages are being used for the quests that appear complete, then check which code in your server is setting those storages to completed values.
I dont have quests.xml I got only groups,imbuements,mounts,outfits,vocations
 
I didint get how i set this storage (example): player:setStorageValue(Storage.ExplorerSociety.JoiningtheExplorers, 1)
And the player get the quest in quest log, can anyone explain it to me please?
I'm trying to learn how quest log works.
 
Hi! I'm having a bit of issue aswell. I've set it up as showed (updated to work for tfs 1.3), I get this when going to next state:
1609170756418.png

But nothing pops up in quest log. What am I missing?

Edit: Had wrong storage ID :<
 
Last edited:
I didint get how i set this storage (example): player:setStorageValue(Storage.ExplorerSociety.JoiningtheExplorers, 1)
And the player get the quest in quest log, can anyone explain it to me please?
I'm trying to learn how quest log works.

That's how you set it, with that exact function:
player:setStorageValue(key, value)

The rest is explained in the tutorial. Keep in mind, if you don't have quests.xml file in XML folder, you may be using a non standard distro such as otservbr, in that case:

Try in data/lib/core/quests.lua then if you're using otservbr
 
That's how you set it, with that exact function:
player:setStorageValue(key, value)

The rest is explained in the tutorial. Keep in mind, if you don't have quests.xml file in XML folder, you may be using a non standard distro such as otservbr, in that case:
My question is more like: How this turn in to a "quest log updated" and how it turn in to a questLine/Mission inside the game the theorycal part i guess.
 
My question is more like: How this turn in to a "quest log updated" and how it turn in to a questLine/Mission inside the game the theorycal part i guess.

Whenever you use setStorageValue on some storage to change it to a non-default value (so, not -1), the server checks if that storage is used in some quest configuration in quests.xml for a quest.
If yes, it sends the "quest log updated" message.

Check this function in the sources for more info - it happens on this line (657).

More specifically, it uses this function to achieve that check.
 
Last edited:
Sorry for necroposting, but i don't see a reason to create new thread for the same thing.

Is there any chance to update this for TFS 1.4?
 
Sorry for necroposting, but i don't see a reason to create new thread for the same thing.

Is there any chance to update this for TFS 1.4?
The quest log still works the same in TFS 1.4 as it did back when this thread was created.

You can find an example quest in data/XML/quests.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<quests>
    <quest name="Example Quest I" startstorageid="1001" startstoragevalue="1">
        <mission name="Example Mission 1" storageid="1001" startvalue="1" endvalue="3" ignoreendvalue="true">
            <missionstate id="1" description="Example description 1" />
            <missionstate id="2" description="Example description 2" />
            <missionstate id="3" description="Example description 3" />
        </mission>
        <mission name="Example Mission 2" storageid="1001" startvalue="4" endvalue="5">
            <missionstate id="4" description="Example description 1" />
            <missionstate id="5" description="Example description 2" />
        </mission>
    </quest>
</quests>
 
The quest log still works the same in TFS 1.4 as it did back when this thread was created.

You can find an example quest in data/XML/quests.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<quests>
    <quest name="Example Quest I" startstorageid="1001" startstoragevalue="1">
        <mission name="Example Mission 1" storageid="1001" startvalue="1" endvalue="3" ignoreendvalue="true">
            <missionstate id="1" description="Example description 1" />
            <missionstate id="2" description="Example description 2" />
            <missionstate id="3" description="Example description 3" />
        </mission>
        <mission name="Example Mission 2" storageid="1001" startvalue="4" endvalue="5">
            <missionstate id="4" description="Example description 1" />
            <missionstate id="5" description="Example description 2" />
        </mission>
    </quest>
</quests>
Hello bro, a query, could you explain to me how the code works? , they must complete the 3 missions? but do I declare these missions in script? and I put the id of the chests that they should take out? or how is the return sorry that the truth I can not understand
 
Hello bro, a query, could you explain to me how the code works? , they must complete the 3 missions? but do I declare these missions in script? and I put the id of the chests that they should take out? or how is the return sorry that the truth I can not understand

In the above example quest, they use storage 1001.
To start the quest, you change the players storage (1001) value to 1. Doing this will automatically update the quest log of that player.

As you continue the quest and update the player storage, the quest log will continue to auto update.

As you finish the quest and the player now has storage 1001 with value 5, the 1st and 2nd mission will be 'complete'.

so tldr;

You should make your quest / npc / storyline how you normally would with storage values.
and then make your quest log, using the storage values you assigned during the quest.
 
Back
Top