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

[HALP] Reborn

Status
Not open for further replies.

Fallen

Freelancer
Senator
Joined
Aug 21, 2009
Messages
3,712
Reaction score
250
Location
Egypt
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

local config = {
         levelReq = 20000,
         toLevel = 5000,
         RebornItem = 2141,
         playerVoc = getPlayerVocation(cid)
}
-- No more configurable (Exp, Health, and Mana calculated) --
if getPlayerStorageValue(cid, 15313) == -1 and getPlayerLevel(cid) == config.levelReq and getPlayerItemCount(cid, config.RebornItem) >= 1 then
         if config.playerVoc == 1 then
                        doPlayerAddExperience(cid, -131212504250000)
                        doPlayerSendTextMessage(cid, 22, "You\'ve been reborn")
                        doPlayerRemoveItem(cid, config.RebornItem, 1)
                        setCreatureMaxHealth(cid, 25145)
                        setCreatureMaxMana(cid, 149795)
         elseif config.playerVoc == 2 then
                        doPlayerAddExperience(cid, -131212504250000)
                        doPlayerSendTextMessage(cid, 22, "You\'ve been reborn")
                        doPlayerRemoveItem(cid, config.RebornItem, 1)
                        setCreatureMaxHealth(cid, 25145)
                        setCreatureMaxMana(cid, 149795)
         elseif config.playerVoc == 3 then
                        doPlayerAddExperience(cid, -131212504250000)
                        doPlayerSendTextMessage(cid, 22, "You\'ve been reborn")
                        doPlayerRemoveItem(cid, config.RebornItem, 1)
                        setCreatureMaxHealth(cid, 50105)
                        setCreatureMaxMana(cid, 74915)
         elseif config.playerVoc == 4 then
                        doPlayerAddExperience(cid, -131212504250000)
                        doPlayerSendTextMessage(cid, 22, "You\'ve been reborn")
                        doPlayerRemoveItem(cid, config.RebornItem, 1)
                        setCreatureMaxHealth(cid, 75065)
                        setCreatureMaxMana(cid, 24995)
         else
                        doPlayerSendCancel(cid, "You don\'t have the required Vocation.")
         end
                        setPlayerStorageValue(cid, 15313, 1)           
else
                        doPlayerSendCancel(cid, "You\'re not ready to take your reborn or you\'re already reborned!")
        return true
end
end
 
Last edited:
Code:
local config = {
	levelReq = 20000,
	toLevel = 5000,
	RebornItem = 2141
}
local function getStats(cid, v)
	if v == "health" then
		return isKnight(cid) and getPlayerLevel(cid) * 15 + 65 or isPaladin(cid) and getPlayerLevel(cid) * 10 + 105 or (isSorcerer(cid) or isDruid(cid)) and getPlayerLevel(cid) * 5 + 145
	elseif v == "mana" then
		return isKnight(cid) and getPlayerLevel(cid) * 5 - 5 or isPaladin(cid) and getPlayerLevel(cid) * 15 - 85 or (isSorcerer(cid) or isDruid(cid)) and getPlayerLevel(cid) * 30 - 205
	end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 15313) < 1 and getPlayerLevel(cid) >= config.levelReq and doPlayerRemoveItem(cid, config.RebornItem, 1) then
			doPlayerAddExperience(cid, -(getExperienceForLevel(getPlayerLevel(cid)) - getExperienceForLevel(config.toLevel)))
			doPlayerSendTextMessage(cid, 22, "You've been reborn")
			setCreatureMaxHealth(cid, getStats(cid, "health"))
			setCreatureMaxMana(cid, getStats(cid, "mana"))
			doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid), false)
			doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid), false)
			setPlayerStorageValue(cid, 15313, 1)
	else
		doPlayerSendCancel(cid, "You're not ready to take your reborn or you're already reborned!")
	end
	return true
end
 
Last edited:
Status
Not open for further replies.
Back
Top