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

Loot problem

leonmagmo

New Member
Joined
Mar 17, 2009
Messages
82
Reaction score
3
Hello, Someone know how I can fix a problem in source?
I'm using 0.3.6pl1(8.54), and I'm with problem in loots. The player who gave the last hit is receiving the loot, that is wrong, the correct is the player who gave more damage(consequently the player who will receive more xp).
Thanks!

bump
 
Last edited by a moderator:
Aha! So the player that gets the last hit is the only person able to open the corpse?

That would be annoying for all your players!

The solution to your problem is in monster.cpp in this function.
Code:
Item* Monster::createCorpse(DeathList deathList)

Now there SHOULD be a line like this:
Code:
   Creature* _owner = deathList[0].getKillerCreature();
   if(deathList.size() > 1 && deathList[1].getDamage() > deathList[0].getDamage())
     _owner = deathList[1].getKillerCreature();
and then a little farther into the function there is this:
Code:
  corpse->setCorpseOwner(owner->getGUID());

So basically the _owner becomes the corpse owner, so we need to explain the first 3 lines of code so you can fix it.

Code:
   Creature* _owner = deathList[0].getKillerCreature();
deathList[0] is the last hit, so by default, the last hit will be the corpseOwner as you can see above.
Code:
   if(deathList.size() > 1 && deathList[1].getDamage() > deathList[0].getDamage())
     _owner = deathList[1].getKillerCreature();
so above it says, If there is more than 1 person on the Deathlist (deathList.size() > 1) and the damage of the other other player is higher than the player who got the last hit (deathList[1].getDamage() > deathList[0].getDamage()) THEN the _owner will be deathList[1] (The player who got more damage than the last hit player)

So as long as your source code shows the above IT SHOULD work.

There can be ANOTHER way (which I assume is much more likely to be the problem) that you have broken this.

If you set your PZ timer, white skull timer, or field ownership timer to less than 5 seconds, then it ONLY counts damage done in the last 5 seconds.

I don't remember which one, but I HIGHLY suggest first trying this.
Set the below config values to AT LEAST 10 seconds. I am betting this will fix your problem.

Code:
pzLocked = 10 * 1000 -- 10 seconds
huntingDuration = 10 * 1000 -- 10 seconds
fieldOwnershipDuration = 10 * 1000 -- 10 seconds
 
Back
Top