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

C++ Double Experience per level

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
Hey, can anyone help me, figure out, or help me to to move and change that:

I want to make that for every level , player need double experience to get level.
As example now lvl 1 to lvl 2 need 200 experience, i want it 400exp.

AS example 10 lvl to 11 lvl need 10k exp, i want 20k exp.

So basicaly i want for every level to up, player need 2x more experience.

i tryed edit source abit, but failed just broke abit the exp show on client.. tho it kept same...


Anyone can help ? I use tfs 1,2++ , otcv8
 
Hey, can anyone help me, figure out, or help me to to move and change that:

I want to make that for every level , player need double experience to get level.
As example now lvl 1 to lvl 2 need 200 experience, i want it 400exp.

AS example 10 lvl to 11 lvl need 10k exp, i want 20k exp.

So basicaly i want for every level to up, player need 2x more experience.

i tryed edit source abit, but failed just broke abit the exp show on client.. tho it kept same...


Anyone can help ? I use tfs 1,2++ , otcv8
Replace forgottenserver/src/player.h at 1.2 · otland/forgottenserver (https://github.com/otland/forgottenserver/blob/1.2/src/player.h#L199) :
C++:
return ((50ULL * lv * lv * lv) - (150ULL * lv * lv) + (400ULL * lv)) / 3ULL;
with:
C++:
return (((50ULL * lv * lv * lv) - (150ULL * lv * lv) + (400ULL * lv)) / 3ULL) * 2;

It sounds like a bad idea. Players are used to normal level progress, they know exact exp values for levels. If you want to slow down level progress, reduce exp from monsters by 50% ex. under this forgottenserver/data/events/scripts/player.lua at 1.2 · otland/forgottenserver (https://github.com/otland/forgottenserver/blob/1.2/data/events/scripts/player.lua#L139-L142)
LUA:
function Player:onGainExperience(source, exp, rawExp)
	if not source or source:isPlayer() then
		return exp
	end
add:
LUA:
	exp = exp * 0.5
 
I also want to increase the required experience per lvl and I thought about the same, that it will be a bad idea. I will still increase it, but after lvl 50, and just by a bit. 10% more. I hope people won't feel it that much, and at the same time not many people know the exact experience needed after lvl 50. I guess only lvl 100 15kk, and 200 130kk.

*Edit
If someone wants to change the exp, this is what I did.
*Note: The characters that I already had created kept their level, and the exp increased. Not sure what would happen if you decreased the exp later, will they keep their level and decrease exp? Not sure. In case you later on, consider changing the exp.

Experience required
LevelTotal EXP (Modified)Base EXPDifference% Harder
501 847 3001 847 30000 %
10016 974 62015 694 800+1 279 820+8.2 %
15063 665 77056 295 800+7 369 970+13.1 %
200151 378 570129 389 800+21 988 770+17.0 %
  • 1–50 ×1.00
  • 51–70 ×1.05
  • 71–100 ×1.10
  • 101–150 ×1.15
  • 151–200 ×1.20
  • 201+ ×1.25

For TFS 1.2 in player.h look for

void kickPlayer(bool displayEffect);

Remove the code between these 2 lines and then add the code here.

bool addOfflineTrainingTries(skills_t skill, uint64_t tries);






void kickPlayer(bool displayEffect);

// ── added: staged/segmented EXP curve ─────────────────────────────────────────
static uint64_t getExpForLevel(int32_t level) {
// Classic Tibia cumulative EXP to reach level L
auto F = [](int32_t L) -> uint64_t {
int64_t x = static_cast<int64_t>(L) - 1; // use L-1 per Tibia formula
return static_cast<uint64_t>(
(50ULL * x * x * x) - (150ULL * x * x) + (400ULL * x)
) / 3ULL;
};

if (level <= 50) {
return F(level); // no scaling ≤ 50
}

uint64_t total = F(50);

// helper to add a scaled segment (a, b]
auto add_segment = [&](int32_t a, int32_t b, uint32_t num, uint32_t den) {
if (level <= a) return;
int32_t hi = std::min(level, b);
uint64_t delta = F(hi) - F(a);
total += (delta * num) / den; // multiply by (num/den)
};

// 51–70: +5%
add_segment(50, 70, 105, 100);
// 71–100: +10%
add_segment(70, 100, 110, 100);
// 101–150: +15%
add_segment(100, 150, 115, 100);
// 151–200: +20%
add_segment(150, 200, 120, 100);

// 201+: +25%
if (level > 200) {
uint64_t delta = F(level) - F(200);
total += (delta * 125) / 100;
}

return total;
}
// ─────────────────────────────────────────────────────────────────────────────

bool addOfflineTrainingTries(skills_t skill, uint64_t tries);
 
Last edited:

Similar threads

Back
Top