• 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.X+ Reward choose chest !

Nuelman

Member
Joined
Nov 9, 2017
Messages
98
Solutions
1
Reaction score
6
version 10.99

I have a problem, I don't know how to put in three chests and only collect one reward.

Any help? +rep
 
Use search function next time or atleast have a look on Annihilator quest.
 
Don't work for me....

Any more solutions?

Lua:
[Warning - Action::loadFunction] Function "" does not exist.
Post automatically merged:

Now get this message:
Lua:
[Warning - Actions::registerEvent] Duplicate registered item with actionid: 2000
Post automatically merged:

Lua:
local storage_id = 2000

local rewards = {
    [11750] = {reward_id = 2494, reward_count = 1}, -- [chest uid] = {reward item id, reward item count},
    [11751] = {reward_id = 2400, reward_count = 1},
    [11752] = {reward_id = 2431, reward_count = 1},
    [11753] = {reward_id = 2421, reward_count = 1}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local storage = player:getStorageValue(storage_id)
    if storage > 0 then
        return player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    end

    local reward = rewards[item.uid]
    local reward_type = reward and ItemType(reward.reward_id)
    if reward_type then
        if player:addItem(reward.reward_id, reward.reward_count, false, 1, CONST_SLOT_WHEREEVER) then
            player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a " .. reward_type:getName():lower() .. ".")
            player:setStorageValue(storage_id, 1)
        else
            local weight = reward_type:getWeight()
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found an item weighing ' .. weight / 100 .. ' oz it\'s too heavy or you do not have enough room.')
        end
    end
    return true
end
 
Last edited:
Change the action id in the map editor for 0 and only put in the chest your unique id.

First chest = unique id 11750
Second chest = unique id 11751
Etc
 
Back
Top