• 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 0.X monsters give levels, not experience ,its possible?

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
monsters give levels, not experience ,its possible?

If YES then
say 'how'
 
Solution
When hunt without Party:
otland/tfs-old-svn

When hunt with Party:
otland/tfs-old-svn

From these 2 places in creature.cpp you must remove code that shows exp (marked yellow on Github).

Then you must add in player.cpp:
PHP:
int16_t color = g_config.getNumber(ConfigManager::EXPERIENCE_COLOR);
if(color < 0)
    color = random_range(0, 255);

std::stringstream ss;
ss << (level - prevLevel);
g_game.addAnimatedText(getPosition(), (uint8_t)color, ss.str());

Under:
otland/tfs-old-svn
PHP:
char advMsg[60];
sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
sendTextMessage(MSG_EVENT_ADVANCE, advMsg);


-------------
Exp color you can change from white to any other in...
something like that the idea
Code:
local config = {
    ["rotworm"] = {level = 1},
    ["demon"] = {level = 8}
}

function onkill(cid, target)
    local monster = config[target:getName()]
    local player = Player(cid)

    local playerLevel = player:getLevel()
    local exptoLevel = getExpToLevel(playerLevel, (playerLevel + monster.level))

    player:addExperience(exptoLevel)
end
 
something like that the idea
Code:
local config = {
    ["rotworm"] = {level = 1},
    ["demon"] = {level = 8}
}

function onkill(cid, target)
    local monster = config[target:getName()]
    local player = Player(cid)

    local playerLevel = player:getLevel()
    local exptoLevel = getExpToLevel(playerLevel, (playerLevel + monster.level))

    player:addExperience(exptoLevel)
end

Okey, but it possible to change it in sources? And if i set in monsters/demon.xml in expierience="1" that monster give me 1 lvl, not exp? And in game after kill show me number "1" not experience "3213213", and if i have in stages exp x900 i get 900 levels
 
Last edited:
Or where i can change "experience to nextlevel"? Maybe i change it to 1 everytime, and i remove stages and in monsters i set 1 experience point.
 
Or, where i can change if i kill monster i saw how much experience i get, so where i can change it to how levels i get?
 
You can do it easily in sources. Biggest problem in this case is calculation of exp sharing. How many levels should receive each player?
If monster gives 3 levels and 2 players hit it, there is veeery big chance that both players will receive 1 level, so 'total level' from monster will be 2, not 3.

If you want to change it to '1 exp = 1 level', you can change math that calculate it. It's in player.h file:
PHP:
static uint64_t getExpForLevel(uint32_t lv)
{
    lv--;
    return ((50ULL * lv * lv * lv) - (150ULL * lv * lv) + (400ULL * lv)) / 3ULL;
}
To make it 1 lvl = 1 exp, replace it with:
PHP:
static uint64_t getExpForLevel(uint32_t lv)
{
    lv--;
    return lv;
}
1 lvl = 0 exp
2 lvl = 1 exp
3 lvl = 2 exp
 
You can do it easily in sources. Biggest problem in this case is calculation of exp sharing. How many levels should receive each player?
If monster gives 3 levels and 2 players hit it, there is veeery big chance that both players will receive 1 level, so 'total level' from monster will be 2, not 3.

If you want to change it to '1 exp = 1 level', you can change math that calculate it. It's in player.h file:
PHP:
static uint64_t getExpForLevel(uint32_t lv)
{
    lv--;
    return ((50ULL * lv * lv * lv) - (150ULL * lv * lv) + (400ULL * lv)) / 3ULL;
}
To make it 1 lvl = 1 exp, replace it with:
PHP:
static uint64_t getExpForLevel(uint32_t lv)
{
    lv--;
    return lv;
}
1 lvl = 0 exp
2 lvl = 1 exp
3 lvl = 2 exp

Okey, so maybe better is change experience numbers, to how much level i get after kill monsters (only that info), you know how i can change it?
 
Okey, so maybe better is change experience numbers, to how much level i get after kill monsters (only that info), you know how i can change it?
I'm not sure what you mean. I gave you code, that give as many levels, as monster give exp. Set in monster 'experience="15"' and it will give 15 levels.
 
I'm not sure what you mean. I gave you code, that give as many levels, as monster give exp. Set in monster 'experience="15"' and it will give 15 levels.
yea, i know but that code work with stages? And if i have 200k level and in monster i set experience=1 then i got 1 level? or i need 200k experience points to next level?

Its everytime 1xp to level?
 
yea, i know but that code work with stages? And if i have 200k level and in monster i set experience=1 then i got 1 level? or i need 200k experience points to next level?

Its everytime 1xp to level?
+1 xp = +1 lvl
200.000 level goes to 200.001 when get 1 exp.

EDIT:
Stages/rate will multiply received exp (level).

EDIT 2:
There is very big chance that error in exp gain/share calculation will make people get less exp when they hunt together.
I recommend to use some other formula. Like 100 exp for every level:
PHP:
static uint64_t getExpForLevel(uint32_t lv)
{
    lv--;
    return lv * 100ULL;
}
Then set in monster experience="200" and it will give 2 levels.

Maximum possible level is 4.294.967.295 [maximum unsigned 32 bit number value].
Maximum possible experience value is 18.446.744.073.709.551.615 (4.294.967.295 * 4.294.967.295)
 
Last edited:
+1 xp = +1 lvl
200.000 level goes to 200.001 when get 1 exp.

EDIT:
Stages/rate will multiply received exp (level).

EDIT 2:
There is very big chance that error in exp gain/share calculation will make people get less exp when they hunt together.
I recommend to use some other formula. Like 100 exp for every level:
PHP:
static uint64_t getExpForLevel(uint32_t lv)
{
    lv--;
    return lv * 100ULL;
}
Then set in monster experience="200" and it will give 2 levels.

Maximum possible level is 4.294.967.295 [maximum unsigned 32 bit number value].
Maximum possible experience value is 18.446.744.073.709.551.615 (4.294.967.295 * 4.294.967.295)

Okey thanks! I have one more question, you know where i can change experience to level? i mean if i kill monster on screen i can saw white numbers (exp), how change it to gained level?

exp+z+beasty.jpg
 
When hunt without Party:
otland/tfs-old-svn

When hunt with Party:
otland/tfs-old-svn

From these 2 places in creature.cpp you must remove code that shows exp (marked yellow on Github).

Then you must add in player.cpp:
PHP:
int16_t color = g_config.getNumber(ConfigManager::EXPERIENCE_COLOR);
if(color < 0)
    color = random_range(0, 255);

std::stringstream ss;
ss << (level - prevLevel);
g_game.addAnimatedText(getPosition(), (uint8_t)color, ss.str());

Under:
otland/tfs-old-svn
PHP:
char advMsg[60];
sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
sendTextMessage(MSG_EVENT_ADVANCE, advMsg);


-------------
Exp color you can change from white to any other in config.lua. Color numbers (animated text):
http://ots.me/colors
If you set in config.lua color value to -1, it will use random color.
 
Solution
When hunt without Party:
otland/tfs-old-svn

When hunt with Party:
otland/tfs-old-svn

From these 2 places in creature.cpp you must remove code that shows exp (marked yellow on Github).

Then you must add in player.cpp:
PHP:
int16_t color = g_config.getNumber(ConfigManager::EXPERIENCE_COLOR);
if(color < 0)
    color = random_range(0, 255);

std::stringstream ss;
ss << (level - prevLevel);
g_game.addAnimatedText(getPosition(), (uint8_t)color, ss.str());

Under:
otland/tfs-old-svn
PHP:
char advMsg[60];
sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
sendTextMessage(MSG_EVENT_ADVANCE, advMsg);


-------------
Exp color you can change from white to any other in config.lua. Color numbers (animated text):
http://ots.me/colors
If you set in config.lua color value to -1, it will use random color.

yea, thanks bro! <3
 
When hunt without Party:
otland/tfs-old-svn

When hunt with Party:
otland/tfs-old-svn

From these 2 places in creature.cpp you must remove code that shows exp (marked yellow on Github).

Then you must add in player.cpp:
PHP:
int16_t color = g_config.getNumber(ConfigManager::EXPERIENCE_COLOR);
if(color < 0)
    color = random_range(0, 255);

std::stringstream ss;
ss << (level - prevLevel);
g_game.addAnimatedText(getPosition(), (uint8_t)color, ss.str());

Under:
otland/tfs-old-svn
PHP:
char advMsg[60];
sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
sendTextMessage(MSG_EVENT_ADVANCE, advMsg);


-------------
Exp color you can change from white to any other in config.lua. Color numbers (animated text):
http://ots.me/colors
If you set in config.lua color value to -1, it will use random color.

will have this solution for tfs 0.3.6 that does not have cpp files are .lua files
 
Back
Top