• 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+ TFS 1.3 Action script to give storage from list

undead mage

Active Member
Joined
Mar 25, 2012
Messages
364
Solutions
2
Reaction score
47
Location
Amsterdam
Hey, I was wondering if someone could help me out? So im trying to set a storage if someone doesn't have it yet but the problem is that I don't know how to get that storage from the list above. I've tried to make it myself looking at some other scripts but I can't figure it out. The part where im stuck is the part that says "STORAGE FROM LIST HERE". Im using tfs 1.3 btw.

Lua:
local rewards = {
    [1044] = Storage.HiddenTreasures.WizardTower,
    [1029] = Storage.HiddenTreasures.CrownQuest, -- 1030 + 1031
    [1015] = Storage.HiddenTreasures.UndeadTower
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local reward = rewards[item.uid]
    if not reward then
        return false
    end

    if item[item.uid] == reward then
        if player:getStorageValue(STORAGE FROM LIST HERE) < 1 then
            player:setStorageValue(STORAGE FROM LIST HERE, 1)
        end
    end
    return true
end
 
Hey, I was wondering if someone could help me out? So im trying to set a storage if someone doesn't have it yet but the problem is that I don't know how to get that storage from the list above. I've tried to make it myself looking at some other scripts but I can't figure it out. The part where im stuck is the part that says "STORAGE FROM LIST HERE". Im using tfs 1.3 btw.

Lua:
local rewards = {
    [1044] = Storage.HiddenTreasures.WizardTower,
    [1029] = Storage.HiddenTreasures.CrownQuest, -- 1030 + 1031
    [1015] = Storage.HiddenTreasures.UndeadTower
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local reward = rewards[item.uid]
    if not reward then
        return false
    end

    if item[item.uid] == reward then
        if player:getStorageValue(STORAGE FROM LIST HERE) < 1 then
            player:setStorageValue(STORAGE FROM LIST HERE, 1)
        end
    end
    return true
end
Lua:
local rewards = {
    [1044] = Storage.HiddenTreasures.WizardTower,
    [1029] = Storage.HiddenTreasures.CrownQuest, -- 1030 + 1031
    [1015] = Storage.HiddenTreasures.UndeadTower
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local reward = rewards[item.uid]
    if not reward then
        return false
    end

    if player:getStorageValue(reward) < 1 then
        player:setStorageValue(reward, 1)
    end
    return true
end
 
Oh damn okay ty gonna test it out later. But how come it recognizes the storage directly and it doesn't go for the id that's between the [ ]?

Also how does it work if you want to add a second parameter? For example now 1044 = storage but what if I want to configure another storage so something like:
[1044] = {storage1 = Storage.HiddenTreasures.WizardTower}
{storage2 = Storage.HiddenTreasures.WizardHouse},
 
Last edited:
Back
Top