• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

[REQUEST] LEVEL Scroll

exique

Natala-ot.com
Joined
Sep 28, 2008
Messages
1,673
Reaction score
25
Location
Sweden
I want a scroll just like exp but it gives out levels instead of exp!

And is it possible to make it like just 250 levels for a level 2000+ example :p
:thumbup:

Reputation for anyone that helps >.<
 
I tried making it without the formula for level;experience, but the excessive looping made my server crash. It couldn't handle the amount of loops needed to not make the EXP go over the exact amount.

Although, that was before i found the function getExperienceForLevel() ;)

Put this in the lib of the action you execute. If it's a scroll, put it in actions/lib/actions
Lua:
function doPlayerAddLevel(cid, var)
	for i = 1, var do
		doPlayerAddExp(cid, getExperienceForLevel(getPlayerLevel(cid)+ 1) - getPlayerExperience(cid))
			end
	return TRUE
end

Edit:

Example of usage:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

	if getPlayerLevel(cid) >= 2000 then
		doPlayerAddLevel(cid, 250)
	else
		doPlayerAddLevel(cid, 500)
			end
	return TRUE
end
 
put this to at the end of functions.lua
Lua:
function doPlayerAddLevel(cid, levels)
		if(isPlayer(cid) == TRUE) then		
			doPlayerAddExperience(cid, getExperienceForLevel(getPlayerLevel(cid)+levels))
		else
			error("Something went wrong")
		end
	return TRUE
end

How to use?

Just doPlayerAddLevel(cid, levels) instead of doPlayerAddExperience(cid, exp)
 
Last edited:
Back
Top Bottom