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

get Rl mana and health + setLevel

Doggynub

LUA / C++
Joined
Sep 28, 2008
Messages
2,541
Reaction score
186
getState(lvl,state,vocid)

so you use getState(20,mana,3) : it will get the mana of paladin lvl 20 , getState(20,health,3) it will get the health of pally lvl 20
I donno how will this function be useful but sometimes i need to use it so i thogut i may make it and here is outcome :
Lua:
function getState(lvl,state,vocid)
local cfg = {
              k = {4,8},
			  d = {2,6},
			  s = {1,5},
			  p = {3,7}
			 }
local value = 0
   if state == health then
		    if isInArray(cfg.p, vocid) then
			      value = lvl * 10 + 105 
			elseif isInArray(cfg.d, vocid) or isInArray(cfg.s, vocid) then
			    value = lvl * 5 + 145 
            elseif isInArray(cfg.k, vocid) then
			    value = lvl * 15 + 65
			end
   elseif state == mana then
           if isInArray(cfg.p, vocid) then
			    value = lvl * 15 - 85 
            elseif isInArray(cfg.d, vocid) or isInArray(cfg.s, vocid) then
			     value = lvl * 30 - 205 
			elseif isInArray(cfg.k, vocid) then
			    value = lvl * 5 - 5
	    	end
   else 
		     value = "console error" 
		    print("--------------------------------------------------------\nError : getStats() function in state param, 'mana' or 'health' are expected in fuction\nex : <getStats(lvl,health / mana,vocid)>\n-----------------------------------------------------")
   end
 return value
end

I donno you may use it as a in game calculater or somthng like this to set lvl accordin mana and health like rl fomula
setLevel(cid,20) if player is pally it will set him lvl 20 with modified mana and hp according to rl formulas even if his level is more than 20
Lua:
function setLevel(cid,lvl)
return doPlayerAddExp(cid, getExperienceForLevel(lvl) - getPlayerExperience(cid)) and setCreatureMaxHealth(cid, getState(lvl,health,getPlayerVocation(cid)))and setCreatureMaxMana(cid, getState(lvl,mana,getPlayerVocation(cid))) and doCreatureAddHealth(cid, getState(lvl,health,getPlayerVocation(cid)), false) and doCreatureAddMana(cid, getState(lvl,mana,getPlayerVocation(cid)), false)
end

:( ....
 
Last edited:
Back
Top