• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Reset Lvl/Exp/mana/Health script

Madlander

Madlander
Joined
Sep 16, 2009
Messages
318
Reaction score
16
Location
Mexico
Hi there

im looking for some action or movements to reset level,exp,mna and health of the player.

only this......

I GIVE REP for help me and my soul :O XD
 
like rebirth system?

Code:
local t = {
	level=700, -- level required for rebirth
	RemainingLvl=8, -- {8} = level(normal) level you become after the rebirth
	skull=true, -- players with white skull can ascend?
	redskull=true, -- players with red skull can ascend?
	prot=true, -- players must be in protection zone to ascend?
	bat=true -- players must not have battle condition to ascend?
}
 
local function getResets(cid)
	return math.max(0, getPlayerStorageValue(cid, 1020))
end
 
function onSay(cid, words, param)
	local skull = getCreatureSkullType(cid)
	if (not t.skull and skull == SKULL_WHITE) or (not t.redskull and skull == SKULL_RED) then
		doPlayerSendTextMessage(cid, 22, 'You cannot ascend with a ' .. (skull == SKULL_WHITE and 'white' or 'red') .. ' skull.')
	end
 
	local pos = getThingPos(cid)
	if t.prot and not getTileInfo(pos).protection then
		return doPlayerSendTextMessage(cid, 22, 'You must be in a protection zone to ascend.')
	elseif t.bat and hasCondition(cid, CONDITION_INFIGHT) then
		return doPlayerSendTextMessage(cid, 22, 'You must lose your battle sign to ascend.')
	end
 
	local lvl = getPlayerLevel(cid)
	if lvl >= t.level then
		local new, newLvl = getResets(cid) + 1, math.max(t.RemainingLvl, t.RemainingLvl + lvl - t.level)
		setPlayerStorageValue(cid, 1020, new)
		doPlayerSetSpecialDescription(cid, '. ' .. (getPlayerSex(cid) == 0 and 'Sh' or 'H') .. 'e is on Ascension # ' .. new)
		doPlayerPopupFYI(cid, 'You have ascended, and you now have ' .. new .. ' reset' .. (new == 1 and '' or 's') .. ' in total.')
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		local pid, hp, mana = getPlayerGUID(cid), math.ceil(getCreatureMaxHealth(cid) * (0.2 * new)), math.ceil(getCreatureMaxMana(cid) * (0.2 * new))
		doRemoveCreature(cid)
		db.executeQuery('UPDATE `players` SET `level` = ' .. newLvl .. ', `experience` = ' .. getExperienceForLevel(newLvl) .. ', `promotion` = 0, `health` = ' .. hp ..', `healthmax` = ' .. hp .. ', `mana` = ' .. mana .. ', `manamax` = ' .. mana .. ' WHERE `id` = ' .. pid .. ' LIMIT 1;')
	else
		doPlayerSendCancel(cid, 'You need to reach level ' .. t.level .. ' or higher to ascend.')
		doSendMagicEffect(pos, CONST_ME_POFF)
	end
	return true
 
Back
Top