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

[C++] Trying to set minimum level to 70

Hellrage

Worr
Joined
Oct 30, 2007
Messages
2,477
Reaction score
5
Location
Sweden
Hello. Im having some trouble to understand everything but I will try to fix it and post here to see if I understood it correctly. If I got something wrong, please help me. I have tried a couple of different ways with server crashes as result that is why I make this thread.

[Cpp] //Level loss
uint32_t newLevel = level;
while((uint64_t)(experience - getLostExperience()) < Player::getExpForLevel(newLevel))
{
if(newLevel > 1)
newLevel--;
else
break;
}[/Cpp]

I read it like this:

You loose one level every turn. When you have lost enought levels it will stop. It will also stop so you cant die below level 1. So if you die from 101 to 98 it will remove one level (100, 99, 98) and stop when newLevel is 98, only that it doesnt count in levels, it counts in experience needed for level. I cant explain better than this but I think I know how it works.

Anyways, if I changed so code now looks like this:

[CPP] //Level loss
uint32_t newLevel = level;
while((uint64_t)(experience - getLostExperience()) < Player::getExpForLevel(newLevel))
{
if(newLevel > 70)
newLevel--;
else
break;
}[/CPP]

... I guess that will set new minimum level to 70. Correct?

edit: Writing next part...
 
I guess so. Gonna test this first part now. But I think this will bug things up because you only stop loosing levels so next time you die it will be messed up :p

edit: Gotta go, I will continue later. If someone have any good ideas how to solve this problem please notice me :)
 
I think you misunderstood. This havent got anything to do with how much exp you gain. I want so players cant die below level 70. Instead they will stay at level 70 (with 100% to next level and correct amount of exp)
 
I have a perfect fix.

Do this in config:

1# protectionLevel = 70

and use this code in lua

Lua:
local newLevel = 70
local time = 0.5
function onPrepareDeath(cid, deathList)
	if getPlayerLevel(cid) <= newLevel and getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
	addEvent(doCreatureAddHealth(cid, math.random(400,500)time)
	end
	return true
end

What I've done here is. If the lvl 70 is damaged he will heal 400 - 500 every 0.5 seconds. If you disable PvP for lvl 70- in config, then there's no chance they can die. It's an easy fix without source edit :p
 
Last edited:
Im sorry, that is not a perfect fix xD

When players die they respawn with full war backpack (its pvp-e ot). If they die below level 70 (10 below starting level) they havent got cap for backpack. Also I think its good so people dont need to create new character if they die too much.

This fix that you said above, will just make level 70s invicible ^^
 
I would also like to know how to set minimum level of 200... me and my friend are changing are real map to a war ot -real map edited.. We dont know how to make it so u cant go below level 200 for our war ot and we need some help.. if u can help ill rep u but please answer as soon as possible! Thanks-- Cm Havoc==sharystone.no-ip.org
 
hmm i didnt understand well but i think this what u want.

PHP:
function onLogin(cid)

	if getPlayerLevel(cid) < 70 then
	doPlayerAddExperience(cid, (getExperienceForLevel(70) - getPlayerExperience(cid)))
end
return TRUE
end
 
Back
Top