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

Compiling No level difference restriction on kills

lostenhoz

New Member
Joined
Aug 31, 2020
Messages
29
Reaction score
0
i change
Lua:
    minLevelThresholdForKilledPlayer = 0
    maxLevelThresholdForKilledPlayer = 0

and change in source

Code:
double attackerLevel = (double)attackerPlayer->getLevel(), min = g_config.getDouble(
        ConfigManager::EFP_MIN_THRESHOLD), max = g_config.getDouble(ConfigManager::EFP_MAX_THRESHOLD);
    if((min > 0 && level < (uint32_t)std::floor(attackerLevel * min)) || (max > 0 &&
        level > (uint32_t)std::floor(attackerLevel * max)))
        return 0;

to
Code:
double attackerLevel = (double)attackerPlayer->getLevel(), max = g_config.getDouble(ConfigManager::EFP_MAX_THRESHOLD);
    if(max > 0 && level > (uint32_t)std::floor(attackerLevel * max))
        return 0;

it removes the restrictions to a higher level, but when killing a lower level you don't get exp
 
i remove all

Lua:
double attackerLevel = (double)attackerPlayer->getLevel(), min = g_config.getDouble(
        ConfigManager::EFP_MIN_THRESHOLD), max = g_config.getDouble(ConfigManager::EFP_MAX_THRESHOLD);
    if((min > 0 && level < (uint32_t)std::floor(attackerLevel * min)) || (max > 0 &&
        level > (uint32_t)std::floor(attackerLevel * max)))
        return 0;

but error in compile, need remove more lines?
 

Lua:
player.cpp:3563:36: error: ‘attackerLevel’ was not declared in this scope
  uint32_t a = (uint32_t)std::floor(attackerLevel * 0.9), b = level;
                                    ^
player.cpp:3566:53: error: ‘b’ was not declared in this scope
   * std::max((double)0, ((double)(1 - (((double)a / b))))) * 0.05 * c)) * rate;
                                                     ^
player.cpp:3567:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[1]: *** [player.o] Error 1
make[1]: Leaving directory `/home/total/src'
make: *** [all] Error 2
 
@lostenhoz
Add that line back:
Code:
double attackerLevel = (double)attackerPlayer->getLevel();
Only delete this if statement:
Code:
if((min > 0 && level < (uint32_t)std::floor(attackerLevel * min)) || (max > 0 &&
        level > (uint32_t)std::floor(attackerLevel * max)))
        return 0;
 
@lostenhoz
Add that line back:
Code:
double attackerLevel = (double)attackerPlayer->getLevel();
Only delete this if statement:
Code:
if((min > 0 && level < (uint32_t)std::floor(attackerLevel * min)) || (max > 0 &&
        level > (uint32_t)std::floor(attackerLevel * max)))
        return 0;
still not gaining exp when killing lower level :(
 
Next time you should post all function

Change
uint32_t a = (uint32_t)std::floor(attackerLevel * 0.9);

To
uint32_t a = 0;

Or you can delete a and put 0 directly on the return line
 
still not gaining exp when killing lower level :(
It's because of the formula for how exp points are distributed:
Code:
/*
Formula
a = attackers level * 0.9
b = victims level
c = victims experience

result = (1 - (a / b)) * 0.05 * c
Not affected by special multipliers(!)
*/
When a > b you're not getting any exp because the whole expression is then < 0.

You can change a to be always 0, like suggested above, but then you will always get maximum exp. That formula was designed to give more exp the greater the difference in level. If you want to keep it like that, you need to set a new one.
 
Last edited:
Back
Top