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

[TFS 1.3] Advanced quest chests

min level does not seems to work, i tried to open a lvl 50 chest, with a lvl 200 and it requires 50 exactly perhaps
Some idiot who wrote the original script messed this up.

Lua:
if questChests[questChest].minLevel [B]=> [/B]playerLevel then
change the => to >=
 
It's good to update the bug fixes in the main thread, not everyone reads the answers.
 
Hello, getting this error.

Lua Script Error: [Scripts Interface]
C:\Users\Administrator\Desktop\Server\data\scripts\actions\quest_chests.lua:callback
...tor\Desktop\Server\data\scripts\actions\quest_chests.lua:21: attempt to index a nil value

Any idea why it is?. TFS 1.4.

Thanks
Im having thos problem aswell, TFS 1.3. Anyone?
 
Im having thos problem aswell, TFS 1.3. Anyone?
Its telling you that there is a uniqueId registered but there is no config at all for that specific uniqueId
Anyway, the following will avoid the error but you still need to make sure everything is set up correctly.

Replace
Lua:
local questChest = item:getUniqueId()

With
Lua:
local questChest = item:getUniqueId()
if not questChests[questChest] then
    return true
end
 
Its telling you that there is a uniqueId registered but there is no config at all for that specific uniqueId
Anyway, the following will avoid the error but you still need to make sure everything is set up correctly.

Replace
Lua:
local questChest = item:getUniqueId()

With
Lua:
local questChest = item:getUniqueId()
if not questChests[questChest] then
    return true
end

I tried firstly to give a quest chest AID 2000, then unique ID 8026. Added 8026 to uniqueId in code. When clicking on the chest ingame im getting the item ‘8026’ and not the items listed in array [1] for items
So i tried to give the exact numbers as the example in code to the chest, leading to this posted result.
 
By default there is a quest system which uses uniqueIds aswell, just disable it
 
If you guys need items to be added in a container, i.e bag or backpack, add this:
Under "Item Type Reward:
Lua:
        -----------------------------------------------------------------------------------
        -- Item Type Reward --
        -----------------------------------------------------------------------------------
        if rewardType == "item" then
            local container = questChests[questChest].items[i].container
            local containerID = questChests[questChest].items[i].containerID
            local item = questChests[questChest].items[i].item
            local count = questChests[questChest].items[i].count

            if container == 1 then
                local bag = player:addItem(containerID)
                if not bag then  
                    return true
                end
                bag:addItem(item,count)
            else
                player:addItem(item, count)
            end
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You earned "..count.."x "..capAll(getItemName(item)))

        end

In quest config lua add container and containerID as shown below. Just set container to 0 or remove it if you dont want container.
Lua:
[1] = {type = "item", item = 2497, count = 1, container = 1, containerID = 1987},
 
If you guys need items to be added in a container, i.e bag or backpack, add this:
Under "Item Type Reward:
Lua:
        -----------------------------------------------------------------------------------
        -- Item Type Reward --
        -----------------------------------------------------------------------------------
        if rewardType == "item" then
            local container = questChests[questChest].items[i].container
            local containerID = questChests[questChest].items[i].containerID
            local item = questChests[questChest].items[i].item
            local count = questChests[questChest].items[i].count

            if container == 1 then
                local bag = player:addItem(containerID)
                if not bag then 
                    return true
                end
                bag:addItem(item,count)
            else
                player:addItem(item, count)
            end
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You earned "..count.."x "..capAll(getItemName(item)))

        end

In quest config lua add container and containerID as shown below. Just set container to 0 or remove it if you dont want container.
Lua:
[1] = {type = "item", item = 2497, count = 1, container = 1, containerID = 1987},

I didnt test it probably until now. You have to add the local container before the for loop inside the code, otherwise you will just get and X * times items with bags xd.. Sorry!

like this :

Lua:
-- Give reward if player has not yet opened box --
    local containerID = questChests[questChest].containerID
    local bag = player:addItem(containerID)
    -----------------------------------------------------------------------------------
    for i = 1, #questChests[questChest].items do
        local rewardType = questChests[questChest].items[i].type
        -----------------------------------------------------------------------------------
        -- Item Type Reward --
        -----------------------------------------------------------------------------------
        if rewardType == "item" then
            local container = questChests[questChest].items[i].container

            local item = questChests[questChest].items[i].item
            local count = questChests[questChest].items[i].count

            if container == 1 then
                print("container ok")

                if not bag then
                    print("Fail")
                    return true
                end
                bag:addItem(item,count)
            else
                player:addItem(item, count)
            end
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You earned "..count.."x "..capAll(getItemName(item)))

Lua:
[38041] = {
        minLevel = 1,
        storageUnique = 38041,
        containerID = 1987,
        items = {
            [1] = {type = "item", item = 2518, count = 1, container = 1},
            [2] = {type = "item", item = 2181, count = 1, container = 1},
 
Back
Top