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

Lua Can a quest send items to depot?

demon088

#088 in the Horde
Joined
Jun 17, 2009
Messages
249
Solutions
3
Reaction score
30
Location
Hell
Hello,
Recently I decided to add something similar to loot boxes for my OTS and I would like to know if is there any action script to send the reward directly to the player's depot. If that makes sense, I'll expect help about thid kind of feature.
Thanks!
 
Solution
what version of TFS are you using?
if you are using last version of tfs you should also use tibia 1048+ isnt it? if thats correct I guess it should be better to send your boxes to the inbox
well anyways both are containers
so you just something like this

Lua:
    --inbox
    local inbox = player:getInbox()
    if inbox then
        local receipt = Game.createItem(24301)
        inbox:addItemEx(receipt, INDEX_WHEREEVER, FLAG_NOLIMIT)
    end
  
    --depot
    local dp = player:getDepotChest(1) -- where 1 is the depot id
    if dp then
        local receipt = Game.createItem(24301)
        dp:addItemEx(receipt, INDEX_WHEREEVER, FLAG_NOLIMIT)
    end
what version of TFS are you using?
if you are using last version of tfs you should also use tibia 1048+ isnt it? if thats correct I guess it should be better to send your boxes to the inbox
well anyways both are containers
so you just something like this

Lua:
    --inbox
    local inbox = player:getInbox()
    if inbox then
        local receipt = Game.createItem(24301)
        inbox:addItemEx(receipt, INDEX_WHEREEVER, FLAG_NOLIMIT)
    end
  
    --depot
    local dp = player:getDepotChest(1) -- where 1 is the depot id
    if dp then
        local receipt = Game.createItem(24301)
        dp:addItemEx(receipt, INDEX_WHEREEVER, FLAG_NOLIMIT)
    end
 
Last edited:
Solution
what version of TFS are you using?
if you are using last version of tfs you should also use tibia 1048+ isnt it? if thats correct I guess it should be better to send your boxes to the inbox
well anyways both are containers
so you just something like this

Lua:
    --inbox
    local inbox = player:getInbox()
    if inbox then
        local receipt = Game.createItem(24301)
        inbox:addItemEx(receipt, INDEX_WHEREEVER, FLAG_NOLIMIT)
    end

    --depot
    local dp = player:getDepotChest(1) -- where 1 is the depot id
    if dp then
        local receipt = Game.createItem(24301)
        dp:addItemEx(receipt, INDEX_WHEREEVER, FLAG_NOLIMIT)
    end
I'm using TFS 1.3 for Tibia 10.98, I tried with the next script:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(5017) == 2 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    elseif player:getStorageValue(5017) <= 2 then
        local inbox = player:getInbox()
        if inbox then
        local reward = Game.createItem(26794, 2)
        inbox:addItemEx(reward, INDEX_WHEREEVER, FLAG_NOLIMIT)
        local reward2 = Game.createItem(2160, 50)
        inbox:addItemEx(reward2, INDEX_WHEREEVER, FLAG_NOLIMIT)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found two equipment holders and 50 crystal coins. Your reward has been sent to your inbox!")
        player:setStorageValue(5017, 2)
        end
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Something went wrong.")
       end
end
Also I have included additional rewards for other quests, like this:
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(5017) == 2 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    elseif player:getStorageValue(5017) <= 2 then
        local inbox = player:getInbox()
        if inbox then
        local reward = Game.createItem(2487)
        inbox:addItemEx(reward, INDEX_WHEREEVER, FLAG_NOLIMIT)
        local reward2 = Game.createItem(2195)
        inbox:addItemEx(reward2, INDEX_WHEREEVER, FLAG_NOLIMIT)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You have found a crown armor and a pair of boots of haste. Your reward has been sent to your inbox!")
        player:setStorageValue(5017, 2)
        end
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Something went wrong.")
       end
end
Player is going to receive rewards at inbox. It is a good script for heavy cap rewards and to avoid pk loot after quests.
It is working perfectly. Thanks @StreamSide for your help!
 
Back
Top