• 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 Death Percent Loss

Soul Jocker

New Member
Joined
Sep 26, 2011
Messages
24
Reaction score
0
Hi!

Someone can tell me how can I change the percent loss when a player dies in PVP??

I want to reduce the level and skills percents when someone dies.


My server is 10.96
TFS 1.2


Thanks!!
 
search in config.lua
deathLosePercent =

-- Deaths
-- NOTE: Leave deathLosePercent as -1 if you want to use the default
-- death penalty formula. For the old formula, set it to 10. For
-- no skill/experience loss, set it to 0.
deathLosePercent = -1
 
in player.cpp

find the death method
Code:
void Player::death(Creature* _lastHitCreature)

Then the level loss is declared in the middle~ of the function
Code:
        //Level loss
        uint64_t expLoss = static_cast<uint64_t>(experience * deathLossPercent);

where the deathLossPercent is taken from getLostPercent(). This takes the default formula as
search in config.lua
deathLosePercent =

-- Deaths
-- NOTE: Leave deathLosePercent as -1 if you want to use the default
-- death penalty formula. For the old formula, set it to 10. For
-- no skill/experience loss, set it to 0.
deathLosePercent = -1
said


You can replace it with your function.

And heres the if statement for checking if the player is the killer (for pvp things)
Code:
            if (_lastHitCreature){ //check if creature that last hit you exists

                if (_lastHitCreature->getPlayer() || _lastHitCreature->getMaster()->getPlayer()) //if its player or players summon
                {
                    //..
                }
            }
 
Back
Top