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

Solved Send loot to Depot (hard code)

guiismiti

Well-Known Member
Joined
May 19, 2014
Messages
313
Solutions
3
Reaction score
67
<SOLVED>

Hello,

I think this is the adequate board for the question.

I'm using TFS 1.2, and, like the title says, I want to place the loot in the depot of the player who dealt the most damage.
I'm doing this changing the exe code because I have no problems compiling it and I believe I'll just need to change a couple lines, which wouldn't be the case of doing this using lua scripts.
It should match the following conditions:
The killed creature must not be a player, and the killer must not be a monster.

I have found this in creature.cpp
Code:
if (corpse) {
      dropLoot(corpse->getContainer(), _lastHitCreature);
}

My problem is, I don't know much of c++ syntax. I've been trying some "benchmarking", but no success so far. Since I spent a couple hours so far, I decided to ask for help.



Thanks in advance.

Edit #1:
I got it to work with
Code:
Player* looter = _lastHitCreature->getPlayer();
dropLoot(looter->getDepotChest(34, false), _lastHitCreature);

Now I only need to know the function used to determine if the victim is a player or if the killer is a monster.



Solution
I used this
Code:
        if(Player* looter = _lastHitCreature->getPlayer())
            dropLoot(looter->getDepotChest(34, false), _lastHitCreature);

        else {
            if (corpse) {
                dropLoot(corpse->getContainer(), _lastHitCreature);
            }
        }
When a player dies, killed by monster or player, the loot will stay in the body;
If a monster is killed by a party, the most damaging player gets the loot.
 
Last edited:
Back
Top