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

Exp from killing players help !!

Shoshooo

New Member
Joined
Feb 2, 2015
Messages
62
Reaction score
0
Hello brothers today i made tfs war and when i opened it and try to kill some players test i didn't found any exp so i want to right way to get exp from killing palyers please i search here more but i didn't found any right way
Please help me
 
You can change this in config.lua, can't give any more information than that since you didn't post which server version you use.
 
If you want to receive experience by killing players you have to enable this option (experienceByKillingPlayers) in config.lua. Also difference between killer and victim level must be lesser than or equal to expFromPlayersLevelRange option (also available in configuration).
 
If you want to receive experience by killing players you have to enable this option (experienceByKillingPlayers) in config.lua. Also difference between killer and victim level must be lesser than or equal to expFromPlayersLevelRange option (also available in configuration).

didnt work
 
I've tested it on newest version of forgottenserver and it works fine. If you enable an option in configuration file and level difference isn't greater than value from the config it should work. Maybe gained experience is equal to 0 (it can occur when your damage ratio and victim's loss experience is very low).

Here is a formula:
Code:
lost experience * (attacker damage / total damage) * 0.75

If it still doesn't work correctly you should update your project to the latest version (executable file and data). Probably you will have to update your custom scripts.
 
oddake no funciona para mí, tengo experienceByKillingPlayers = "yes"
pero en mi config no puedo encontrar las rateExperienceFromPlayers = 15

could talk by pm ?
 
i found my problem.

if config.lua:
deathLosePercent = 0

players won't earn experience by killing players

NOT TESTED:
player.cpp
change X to % of experience from killed player
Code:
double Player::getLostPercent(Creature* attacker) const
{
   const Player* player = attacker->getPlayer();
   std::bitset<5> bitset(blessings);

   const int32_t deathLosePercent = g_config.getNumber(ConfigManager::DEATH_LOSE_PERCENT);
   if (deathLosePercent != -1) {
     int32_t lossPercent = deathLosePercent;
 
       if (player)
         lossPercent = X;

     lossPercent -= static_cast<int32_t>(bitset.count());
     return std::max<int32_t>(0, lossPercent) / 100.;
   } else {
......

Code:
void Player::death(Creature* _lastHitCreature)

...........................

double deathLossPercent = getLostPercent(nullptr) * (unfairFightReduction / 100.);

player.h
Code:
    double getLostPercent(Creature* attacker) const;
     uint64_t getLostExperience(Creature* attacker) const final {
       return skillLoss ? static_cast<uint64_t>(experience * getLostPercent(Creature* attacker)) : 0;
     }

luascript.cpp
Code:
int32_t LuaScriptInterface::luaPlayerGetDeathPenalty(lua_State* L)
{
    // player:getDeathPenalty()
    Player* player = getUserdata<Player>(L, 1);
    if (player) {
        lua_pushnumber(L, static_cast<uint32_t>(player->getLostPercent(nullptr) * 100));
    } else {
        lua_pushnil(L);
    }
    return 1;
}
 
Last edited:
Back
Top