• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Send Items to depot

silveralol

Advanced OT User
Joined
Mar 16, 2010
Messages
1,484
Solutions
9
Reaction score
217
how send items to depot of the players?

tfs 1.2
no, I'm don't saying about mail
 
Last edited:
Code:
local depotChest = player:getDepotChest(depotId)
if depotChest then
    -- depotChest:addItem(2160, 1, INDEX_WHEREEVER, FLAG_NOLIMIT)
    -- depotChest:addItemEx(tmpItem, INDEX_WHEREEVER, FLAG_NOLIMIT)
end
 
Code:
local depotChest = player:getDepotChest(depotId)
if depotChest then
    -- depotChest:addItem(2160, 1, INDEX_WHEREEVER, FLAG_NOLIMIT)
    -- depotChest:addItemEx(tmpItem, INDEX_WHEREEVER, FLAG_NOLIMIT)
end
and to send inbox?
 
I wanna change the server code and send the loot to a depot chest, how exactly can I get the container?

This is in creature.cpp
Code:
if (corpse) {
     dropLoot(corpse->getContainer(), _lastHitCreature);
}

I need to replace the first argument with the depot of ID 20 of the player who did the most damage (already defined as mostDamageCreature).
 
I wanna change the server code and send the loot to a depot chest, how exactly can I get the container?

This is in creature.cpp
Code:
if (corpse) {
     dropLoot(corpse->getContainer(), _lastHitCreature);
}

I need to replace the first argument with the depot of ID 20 of the player who did the most damage (already defined as mostDamageCreature).
why make it in c++ ?
you can make it by lua
exemple:
Code:
function onDeath(creature, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified)
    local targetMonster = creature:getMonster()
    if not targetMonster then
        return true
    end
    local killer = mostdamagekiller
    local depotchest = killer:getDepotChest(depotId) 
    if depotchest then
        depotChest:addItem(2160, 100, INDEX_WHEREEVER, FLAG_NOLIMIT)
    end
     return true
end
not tested hahahaha
if the identation is bad, i'm sorry about it, because in the editor we can't use the "tab"
also, you need to register in the monster.xml this event
 
I have no problems rebuilding the server.
If I change it in the source files, I only need to change this one line - if I change it in the lua scripts, I will need to rewrite the entire code for looting, since it's not just adding items, it is also choosing what to add.

I don't know much of c++ (or programming at all), and I have tried the following
Code:
dropLoot(mostDamageCreature.getDepotChest(34, false)->getContainer(), _lastHitCreature);
Code:
dropLoot(mostDamageCreature.getDepotChest(34, false), _lastHitCreature);
Code:
dropLoot(mostDamageCreature:getDepotChest(34, false), _lastHitCreature);
Code:
dropLoot(mostDamageCreature->getDepotChest(34, false), _lastHitCreature);

And I'm getting errors, since I don't know exactly what the symbols are used for.


I'm assuming that "mostDamageCreature" is the player who dealt the most damage, I think I'm wrong here, gonna test some more stuff. Also, gonna need to test if the most damage was dealt by a player or a monster, or it will crash.
Gonna need to leave the loot in the corpse if it was killed by a monster or if the killed creature is a player.
 
Last edited:
Back
Top