• 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.2] Sending items to empty DP won't work

guiismiti

Well-Known Member
Joined
May 19, 2014
Messages
315
Solutions
3
Reaction score
68
Hello,

As the title suggests, I'm using TFS 1.2.
I've done a few tests, and, turns out that sending items to an empty depot does not work.
For it to work, after logging in, the player must either:
  • open that DP before the items are sent; or
  • have at least one item in the dp.

This is the code I have - the orange messages were used for testing
Code:
    local depotChest = self:getDepotChest(34)

    doCreatureSay(self, '1', TALKTYPE_ORANGE_1)

    if(depotChest) then
        doCreatureSay(self, '2', TALKTYPE_ORANGE_1)
        depotChest:addItem(itemid, count, INDEX_WHEREEVER, FLAG_NOLIMIT)
    end

    depotChest = self:getDepotChest(13)
    if(depotChest) then
        doCreatureSay(self, '3', TALKTYPE_ORANGE_1)
    end
I have also used the DP of ID 13 (Yalahar) to test if there was something wrong with only the DP of ID 34.

So, the results - the test if(depotChest) is false if the DP is empty or if the player did not open it before the items were sent.

Any ideas on how to solve this?


Thanks in advance.
 
As far i know, tfs only save the depots chests if player had open any depot from any city. If player does not open any depot, there is no lastDepotId, if there is no lastDepotId, there is no need to save(i know, its a bug).
 
The depot is only created when it's needed. You can force it to be created by calling getDepotChest(id, true). The true is the important piece you're missing.
 
Ok, not solved, I've found a bug.

  • I logged in, did not open the depot;
  • Hunted for a while, then just stepped on the glowing switch, without opening the depot, and I got the message that there were 60 items in my depot;
  • Then I logged out and in again, stepped on the switch and there were 0 items.

A second test:
  • I logged in again, did not open the depot;
  • Hunted for a while, then stepped on the glowing switch, and, this time, I opened the depot. I had 30 items;
  • Then I logged out and in again, and the items were still there.


Anybody knows if there is a way to fix this?


Edit: also a third test
  • I left an item in the depot;
  • Logged out and in again, killed stuff, stepped on the glowing switch without opening the depot, and I had 20 items;
  • Logged out and in again, I had only one item - the one I placed.

Somehow the loot items are being deleted on logout if I don't open the depot.
I'm thinking about using the mailbox to send the loots...

In addition, this is the code to add the item to the depot (I got it from a reward system)
Code:
function Player:addItemRewardBag(itemid, count)
    local master = self:getMaster()
 
    if master and master:isPlayer() then 
        local depotChest = master:getDepotChest(34, true)
     
        if(depotChest) then
            depotChest:addItem(itemid, count, INDEX_WHEREEVER, FLAG_NOLIMIT)
        end
    else
        local depotChest = self:getDepotChest(34, true)
     
        if(depotChest) then
            depotChest:addItem(itemid, count, INDEX_WHEREEVER, FLAG_NOLIMIT)
        end
    end
end

And, another edit - this is a creatureevent that is registered on Login.
 
Last edited:
Back
Top