When hunt without Party:
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());
char advMsg[60];
sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
sendTextMessage(MSG_EVENT_ADVANCE, advMsg);
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
WHY XD
when someone is so stupid they want to cause whole thing to crash xD
static uint64_t getExpForLevel(uint32_t lv)
{
lv--;
return ((50ULL * lv * lv * lv) - (150ULL * lv * lv) + (400ULL * lv)) / 3ULL;
}
static uint64_t getExpForLevel(uint32_t lv)
{
lv--;
return lv;
}
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:
To make it 1 lvl = 1 exp, replace it with:PHP:static uint64_t getExpForLevel(uint32_t lv) { lv--; return ((50ULL * lv * lv * lv) - (150ULL * lv * lv) + (400ULL * lv)) / 3ULL; }
1 lvl = 0 expPHP:static uint64_t getExpForLevel(uint32_t lv) { lv--; return lv; }
2 lvl = 1 exp
3 lvl = 2 exp
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.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?
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?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.
+1 xp = +1 lvlyea, 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?
static uint64_t getExpForLevel(uint32_t lv)
{
lv--;
return lv * 100ULL;
}
+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:
Then set in monster experience="200" and it will give 2 levels.PHP:static uint64_t getExpForLevel(uint32_t lv) { lv--; return lv * 100ULL; }
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)
On what engine? TFS 1.3 or some 0.4?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?
On what engine? TFS 1.3 or some 0.4?
When hunt without Party:
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());
char advMsg[60];
sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level);
sendTextMessage(MSG_EVENT_ADVANCE, advMsg);
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.
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.