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

TFS 1.X+ c++ programming help tfs 1.2

gohamvsgoku

Member
Joined
Aug 21, 2017
Messages
151
Reaction score
9
I would like to implement players to gain experience by killing other players, well i found this on config lua
Lua:
experienceByKillingPlayers = true


looking some files sources i found this function here

C++:
uint64_t Player::getGainedExperience(Creature* attacker) const
{
    if (g_config.getBoolean(ConfigManager::EXPERIENCE_FROM_PLAYERS)) {
        Player* attackerPlayer = attacker->getPlayer();
        if (attackerPlayer && attackerPlayer != this && skillLoss && std::abs(static_cast<int32_t>(attackerPlayer->getLevel() - level)) <= g_config.getNumber(ConfigManager::EXP_FROM_PLAYERS_LEVEL_RANGE)) {
            return std::max<uint64_t>(0, std::floor(getLostExperience() * getDamageRatio(attacker) * 0.75));
        }
    }
    return 0;
}

how could i add one more condition, so that only players gain experience killing other players in pvp tiles?
my world is normal pvp, but there are some pvp enforced areas, so for that reason i can't change directly in config.lua to pvp enforced

how could this be done? only gain experience from other playing tiles with pvp property?
 
Back
Top