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

Quest System TFS 1.3 (8.6 Version)

Valania

Learning PHP/Lua
Joined
Oct 23, 2009
Messages
315
Reaction score
1
Location
Germany
I cannot get my quest chests to work. It simply only opens up the chest with the item inside: Screenshot (http://prntscr.com/ozd0og)

I tried chaging the quest.lua and the system.lua to the newest ones, but it just doesn't work. Does anyone have working lua files for TFS 1.3?

Thanks for the help, Cheers
 
Solution
No it isn't broken, I thought I already explained how it should work all this time and you guys are having different issue with it so I tried giving different scripts.
Anyways the main quests system which comes with 1.3/1.2 works only with Unique ID, so all you have to do is adding the item id as unique ID.
Example :
If you are adding a Golden helmet you'll have to make your chest's Unique ID 2471 which is the ID of Golden Helmet and keep action id 0 without any touches.
Why you have 2 quest systems in your server? quest.lua and system.lua Post how did you add both to your actions.xml and I suggest you removing one of them and add this script instead of the left one.
Lua:
local specialQuests = { --Choose one chest
    [2215]  = Storage.AnnihilatorDone,
    [26300] = Storage.SvargrondArena.RewardGreenhorn,
    [27300] = Storage.SvargrondArena.RewardScrapper,
    [28300] = Storage.SvargrondArena.RewardWarlord
}

local questsExperience = {
    [2215] = 100000, --anni
}

local questLog = { --Various chests
    [2000] = Storage.DemonHelmetDone,
    [2001] = Storage.BehemothDone,
    [2002] = Storage.VampireShieldDone,
    [2003] = Storage.FireAxeDone,
    [2004] = Storage.MedusaShieldDone,
    [2005] = Storage.CrystalWandDone,
    [2006] = Storage.GriffinShieldDone,
    [2007] = Storage.NaginataQuestDone
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local storage = specialQuests[item.actionid]
    if not storage then
        storage = item.uid
        if storage > 65535 then
            return false
        end
    end
   
    if player:getStorageValue(storage) > 0 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.')
        return true
    end
   
    local items, reward = {}
    local size = item:isContainer() and item:getSize() or 0
    if size == 0 then
        reward = item:clone()
    else
        local container = Container(item.uid)
        for i = 0, container:getSize() - 1 do
            items[#items + 1] = container:getItem(i):clone()
        end
    end
   
    size = #items
    if size == 1 then
        reward = items[1]:clone()
    end
   
    local result = ''
    if reward then
        local ret = ItemType(reward.itemid)
        if ret:isRune() then
            result = ret:getArticle() .. ' ' .. ret:getName() .. ' (' .. reward.type .. ' charges)'
        elseif ret:isStackable() and reward:getCount() > 1 then
            result = reward:getCount() .. ' ' .. ret:getPluralName()
        elseif ret:getArticle() ~= '' then
            result = ret:getArticle() .. ' ' .. ret:getName()
        else
            result = ret:getName()
        end
    else
        if size > 20 then
            reward = Game.createItem(item.itemid, 1)
        elseif size > 8 then
            reward = Game.createItem(1988, 1)
        else
            reward = Game.createItem(1987, 1)
        end
       
        for i = 1, size do
            local tmp = items[i]
            if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then
                print('[Warning] QuestSystem:', 'Could not add quest reward to container')
            end
        end
        local ret = ItemType(reward.itemid)
        result = ret:getArticle() .. ' ' .. ret:getName()
    end
   
    if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then
        local weight = reward:getWeight()
        if player:getFreeCapacity() < weight then
            player:sendCancelMessage(string.format('You have found %s weighing %.2f oz. You have no capacity.', result, (weight / 100)))
        else
            player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.')
        end
        return true
    end
   
    if questsExperience[storage] then
        player:addExperience(questsExperience[storage], true)
    end
   
    if questLog[item.actionid] then
        if (player:getStorageValue(questLog[item.actionid]) ~= 1) then
            player:setStorageValue(questLog[item.actionid], 1)          
        end
    end
   
    player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found ' .. result .. '.')
    player:setStorageValue(storage, 1)
    return true
end
and add this to your actions.xml
XML:
    <action itemid="1740" script="quests/system.lua" />
    <action fromid="1747" toid="1749" script="quests/system.lua" />
    <action actionid="2000" script="quests/system.lua"/>
    <action actionid="2001" script="quests/system.lua"/>
    <action actionid="2007" script="quests/system.lua"/>
    <action actionid="2006" script="quests/system.lua"/>
    <action actionid="2005" script="quests/system.lua"/>
    <action actionid="2004" script="quests/system.lua"/>
    <action actionid="2003" script="quests/system.lua"/>
    <action actionid="2002" script="quests/system.lua"/>
    <action actionid="26300" script="quests/system.lua" />
    <action actionid="27300" script="quests/system.lua" />
    <action actionid="28300" script="quests/system.lua" />
    <action actionid="2215" script="quests/system.lua" />
 
Use this one, Sorry I uploaded edited quests system which will require many functions to be added to compat.lua.
So just use the main TFS 1.3 one here
Lua:
local annihilatorReward = {1990, 2400, 2431, 2494}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.uid <= 1250 or item.uid >= 30000 then
        return false
    end

    local itemType = ItemType(item.uid)
    if itemType:getId() == 0 then
        return false
    end

    local itemWeight = itemType:getWeight()
    local playerCap = player:getFreeCapacity()
    if table.contains(annihilatorReward, item.uid) then
        if player:getStorageValue(30015) == -1 then
            if playerCap >= itemWeight then
                if item.uid == 1990 then
                    player:addItem(1990, 1):addItem(2326, 1)
                else
                    player:addItem(item.uid, 1)
                end
                player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
                player:setStorageValue(30015, 1)
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
        end
    elseif player:getStorageValue(item.uid) == -1 then
        if playerCap >= itemWeight then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
            player:addItem(item.uid, 1)
            player:setStorageValue(item.uid, 1)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
        end
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    end
    return true
end
 
Use this one, Sorry I uploaded edited quests system which will require many functions to be added to compat.lua.
So just use the main TFS 1.3 one here
Lua:
local annihilatorReward = {1990, 2400, 2431, 2494}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.uid <= 1250 or item.uid >= 30000 then
        return false
    end

    local itemType = ItemType(item.uid)
    if itemType:getId() == 0 then
        return false
    end

    local itemWeight = itemType:getWeight()
    local playerCap = player:getFreeCapacity()
    if table.contains(annihilatorReward, item.uid) then
        if player:getStorageValue(30015) == -1 then
            if playerCap >= itemWeight then
                if item.uid == 1990 then
                    player:addItem(1990, 1):addItem(2326, 1)
                else
                    player:addItem(item.uid, 1)
                end
                player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
                player:setStorageValue(30015, 1)
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
        end
    elseif player:getStorageValue(item.uid) == -1 then
        if playerCap >= itemWeight then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
            player:addItem(item.uid, 1)
            player:setStorageValue(item.uid, 1)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
        end
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    end
    return true
end

I'm having an issue with the quest system also (for 1.3 8.6 downport). I don't understand how to read the lua and figure out how to make a quest chest from it. With the default 1.3 you posted how would i make a quest chest? I have the correct chests placed 1740 and 1747-1749 ids, they have items and i've tried actionid 2000. The chest works like a normal chest in-game.
 
Just use the first one I posted above..
and then add to your data\lib\lib.lua
Lua:
dofile('data/lib/core/storages.lua')
Then inside your data\lib\core
Create a lua file and name it storages.lua and paste this into it then it should work.
Lua:
-- STORAGES --

Storage = {
    DemonOak = {
        Done = 1010,
        Progress = 1013,
        Squares = 1014,

        AxeBlowsBird = 8288,
        AxeBlowsLeft = 8289,
        AxeBlowsRight = 8290,
        AxeBlowsFace = 8291
    },
  
  
    AnnihilatorDone = 5000,
    VampireShieldDone = 5001,
    FireAxeDone = 5002,
    MedusaShieldDone = 5003,
    CrystalWandDone = 5004,
    GriffinShieldDone = 5005,
    NaginataQuestDone = 5006,
    DemonHelmetDone = 100136,
    BehemothDone = 100104,
  
    SvargrondArena = {
        Arena = 1100,
        Pit = 1101,

        QuestLogGreenhorn = 50140,
        QuestLogScrapper = 50141,
        QuestLogWarlord = 50142,

        RewardGreenhorn = 26300,
        RewardScrapper = 27300,
        RewardWarlord = 28300,

        TrophyGreenhorn = 1103,
        TrophyScrapper = 1105,
        TrophyWarlord = 1107,

        -- Reward Doors
        Greenhorn = 26100,
        Scrapper = 27100,
        Warlord = 28100
    },
  
    ElementalSphere = {
        QuestLine = 10000,
        BossStorage = 10001,
        MachineGemCount = 10002
    },
  
    TheNewFrontier = {
        Questline = 12130, -- Storage through the Quest
        Mission01 = 12131,
        Mission02 = 12132,
        Mission03 = 12133,
        Mission04 = 12134,
        Mission05 = 12135,
        Mission06 = 12136,
        Mission07 = 12137,
        Mission08 = 12138,
        Mission09 = 12139,
        Mission10 = 12140,
      
        TomeofKnowledge = 12141,
      
        Beaver1 = 12142,
        Beaver2 = 12143,
        Beaver3 = 12144,
      
        BribeKing = 12145,
        BribeLeeland = 12146,
        BribeExplorerSociety = 12147,
        BribeWydrin = 12148,
        BribeTelas = 12149,
        BribeHumgolf = 12150
    },
  
    PitsOfInferno = {
        ShortcutHub = 8819,
        ShortcutLevers = 8818,
        Pumin = 50096,

        WeaponReward = 10544,

        ThroneInfernatil = 2080,
        ThroneTafariel = 2081,
        ThroneVerminor = 2082,
        ThroneApocalypse = 2083,
        ThroneBazir = 2084,
        ThroneAshfalor = 2085,
        ThronePumin = 2086
    },
  
    SeaOfLightQuest = {
        Questline = 50250,
        Mission1 = 50251,
        Mission2 = 50252,
        Mission3 = 50253,
        StudyTimer = 50254,
        LostMinesCrystal = 50255
    },
  
    KillingInTheNameOf = {
        LugriNecromancers = 50000,
        LugriNecromancerCount = 50001,

        MissionTiquandasRevenge = 22222,
        TiquandasRevengeTeleport = 22555,
        MissionDemodras = 22223,
        DemodrasTeleport = 22556

    },
}

GlobalStorage = {
    PitsOfInfernoLevers = 1000,
  
    ElementalSphere = {
        BossRoom = 10004,

        KnightBoss = 8568,
        SorcererBoss = 8569,
        PaladinBoss = 8570,
        DruidBoss = 8578,

        Machine1 = 10005,
        Machine2 = 10006,
        Machine3 = 10007,
        Machine4 = 10008
    }
}
@Valania You can do this too if you still have issues with this.
 
Last edited:
Just use the first one I posted above..
and then add to your data\lib\lib.lua
Lua:
dofile('data/lib/core/storages.lua')
Then inside your data\lib\core
Create a lua file and name it storages.lua and paste this into it then it should work.
Lua:
-- STORAGES --

Storage = {
    DemonOak = {
        Done = 1010,
        Progress = 1013,
        Squares = 1014,

        AxeBlowsBird = 8288,
        AxeBlowsLeft = 8289,
        AxeBlowsRight = 8290,
        AxeBlowsFace = 8291
    },
 
 
    AnnihilatorDone = 5000,
    VampireShieldDone = 5001,
    FireAxeDone = 5002,
    MedusaShieldDone = 5003,
    CrystalWandDone = 5004,
    GriffinShieldDone = 5005,
    NaginataQuestDone = 5006,
    DemonHelmetDone = 100136,
    BehemothDone = 100104,
 
    SvargrondArena = {
        Arena = 1100,
        Pit = 1101,

        QuestLogGreenhorn = 50140,
        QuestLogScrapper = 50141,
        QuestLogWarlord = 50142,

        RewardGreenhorn = 26300,
        RewardScrapper = 27300,
        RewardWarlord = 28300,

        TrophyGreenhorn = 1103,
        TrophyScrapper = 1105,
        TrophyWarlord = 1107,

        -- Reward Doors
        Greenhorn = 26100,
        Scrapper = 27100,
        Warlord = 28100
    },
 
    ElementalSphere = {
        QuestLine = 10000,
        BossStorage = 10001,
        MachineGemCount = 10002
    },
 
    TheNewFrontier = {
        Questline = 12130, -- Storage through the Quest
        Mission01 = 12131,
        Mission02 = 12132,
        Mission03 = 12133,
        Mission04 = 12134,
        Mission05 = 12135,
        Mission06 = 12136,
        Mission07 = 12137,
        Mission08 = 12138,
        Mission09 = 12139,
        Mission10 = 12140,
     
        TomeofKnowledge = 12141,
     
        Beaver1 = 12142,
        Beaver2 = 12143,
        Beaver3 = 12144,
     
        BribeKing = 12145,
        BribeLeeland = 12146,
        BribeExplorerSociety = 12147,
        BribeWydrin = 12148,
        BribeTelas = 12149,
        BribeHumgolf = 12150
    },
 
    PitsOfInferno = {
        ShortcutHub = 8819,
        ShortcutLevers = 8818,
        Pumin = 50096,

        WeaponReward = 10544,

        ThroneInfernatil = 2080,
        ThroneTafariel = 2081,
        ThroneVerminor = 2082,
        ThroneApocalypse = 2083,
        ThroneBazir = 2084,
        ThroneAshfalor = 2085,
        ThronePumin = 2086
    },
 
    SeaOfLightQuest = {
        Questline = 50250,
        Mission1 = 50251,
        Mission2 = 50252,
        Mission3 = 50253,
        StudyTimer = 50254,
        LostMinesCrystal = 50255
    },
 
    KillingInTheNameOf = {
        LugriNecromancers = 50000,
        LugriNecromancerCount = 50001,

        MissionTiquandasRevenge = 22222,
        TiquandasRevengeTeleport = 22555,
        MissionDemodras = 22223,
        DemodrasTeleport = 22556

    },
}

GlobalStorage = {
    PitsOfInfernoLevers = 1000,
 
    ElementalSphere = {
        BossRoom = 10004,

        KnightBoss = 8568,
        SorcererBoss = 8569,
        PaladinBoss = 8570,
        DruidBoss = 8578,

        Machine1 = 10005,
        Machine2 = 10006,
        Machine3 = 10007,
        Machine4 = 10008
    }
}


This confuses me more, what do storages have to do with this? Are storages broken by default? from reading your replies you seem to imply that the default system works correctly with "So just use the main TFS 1.3 one here".
I have the 'main' one with the 8.6 downport i just don't know how to use it. And if aid 2000 + uid is the answer, well then it's broken by default i guess? since that does not work.
 
No it isn't broken, I thought I already explained how it should work all this time and you guys are having different issue with it so I tried giving different scripts.
Anyways the main quests system which comes with 1.3/1.2 works only with Unique ID, so all you have to do is adding the item id as unique ID.
Example :
If you are adding a Golden helmet you'll have to make your chest's Unique ID 2471 which is the ID of Golden Helmet and keep action id 0 without any touches.
 
Solution
So now you have only 1 quest system? Post it here and post how you added to actions.xml
Don't use both scripts, Just one.
 
No it isn't broken, I thought I already explained how it should work all this time and you guys are having different issue with it so I tried giving different scripts.
Anyways the main quests system which comes with 1.3/1.2 works only with Unique ID, so all you have to do is adding the item id as unique ID.
Example :
If you are adding a Golden helmet you'll have to make your chest's Unique ID 2471 which is the ID of Golden Helmet and keep action id 0 without any touches.

Thank you, sorry it was late and i had been stressing over several issues, it seems i failed to connect the right solution with my issue.

Setting the uid to the itemid works fine, thank you :)
 
Finally got it - thanks M0ustafa. So you said just keeping the Chest ID like the item ID that should be in the chest? That was the part I missed. :p
 
It has different script inside your data\actions\scripts\quests called annihilator.lua and for POI or different quests like WOTE/Inquisition you'll have to make a script like Annihilator's one and change it for your quest or you'll have to get one from other real map and change the old function names to new function names or add the missing ones to your compat.lua
 
No it isn't broken, I thought I already explained how it should work all this time and you guys are having different issue with it so I tried giving different scripts.
Anyways the main quests system which comes with 1.3/1.2 works only with Unique ID, so all you have to do is adding the item id as unique ID.
Example :
If you are adding a Golden helmet you'll have to make your chest's Unique ID 2471 which is the ID of Golden Helmet and keep action id 0 without any touches.
Miss the days when I was able to put more items in a chest and give it an unique-id to make it work. ^^"
Now we have to learn something new, thats ok i guess.
 
Back
Top