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

[request] rebirth system

eternalthug

New Member
Joined
Jul 25, 2009
Messages
51
Reaction score
0
Hey im looking for a rebirth system for example, at lvl 100k you go to a npc say hi, would u like to be reborn?, yes, you are now reborn. goes back to lvl 8, promotes to 2nd promotion, keeps skills, but not mana and hp. if anyone can help ill rep++
 
herefag :p
Lua:
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
 
is this a npc script or a actions script. and thank you arthur :) and we all must come outa the closet sometime :p

jokes
 
Last edited:
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;')
That doesn't seem right. do i have to edit any of that shit or is it fine?
 
I just made a npc and 4 new vocations.
the npc sets u back to level 8, resets hp/mana etc.., adds a fun TAG to the name and the new vocations get -33% exp per kill but get a +33% bonus to all combat stuffs..
like a post er??
 
i did post specifics, my first post has em :p but is it possible you could make it so it promotes the player to his 2nd promotion, resets him to lvl 8, keeps all skills, for npc. think you could?
 
i have extra damage on vocations, i already have vocations made and stuff, i just need the npc to rebirth the characters into that 2nd voc. i have the damage multipliers already tuned, and their hp mana rate is a tad higher depending on vocs per lvl.
 
This guy should work, I used him for my old OT.
since i edited him a bit for your liking, let me know if there are any bugs :).

Code:
  local keywordHandler    = KeywordHandler:new()
local npcHandler        = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid)
        npcHandler:onCreatureAppear(cid)
end
function onCreatureDisappear(cid)
        npcHandler:onCreatureDisappear(cid)
end
function onCreatureSay(cid, type, msg)
        npcHandler:onCreatureSay(cid, type, msg)
end
function onThink()
        npcHandler:onThink()
end

function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
        end

        local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

        if(msgcontains(msg, 'rebirth')) then
                selfSay('Ready for me to rebirth you?', cid)
                talkState[talkUser] = 1

        elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		-------CONFIGS-------

        local level =         -- Put here the level to rebirth --
        local cost =         -- Put here the cost to rebirth in GP (20000 = 20k) --
		
		------/CONFIGS-------
		-----LOCALS-----
        local id = getPlayerGUID(cid)
        local name = getCreatureName(cid)
        local vocation = getPlayerVocation(cid)
		----/LOCALS-----

                if getPlayerLevel(cid) >= level then
						if doPlayerRemoveMoney(cid,cost) == TRUE then
                                if vocation == 1 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `health` = 250, `healthmax` = 250, `mana` = 250, `manamax` = 250, `promotion` = 2 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥ "..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 2 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `health` = 250, `healthmax` = 250, `mana` = 250, `manamax` = 250, `promotion` = 2 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥ "..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 3 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `health` = 250, `healthmax` = 250, `mana` = 250, `manamax` = 250, `promotion` = 2 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥ "..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 4 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `health` = 250, `healthmax` = 250, `mana` = 250, `manamax` = 250, `promotion` = 2 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥ "..name.."' WHERE `id` ='"..id.."';")

                                else
                                        selfSay('Not a valid vocation. Contact administrator.', cid)
                                        talkState[talkUser] = 0
                                end
                        else
                                selfSay('You dont have enough money. You need to pay " .. cost .. " to be rebirthed.', cid)
                                talkState[talkUser] = 0
                        end
                else
                        selfSay('Only characters of level " .. level .. " or higher can be rebirthed.', cid)
                        talkState[talkUser] = 0
end
        elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then
                selfSay('Okey come back when you are ready.', cid)
                talkState[talkUser] = 0
        
                                end
        return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
:$
 
Last edited:
local level = -- Put here the level to rebirth --
local cost = -- Put here the cost to rebirth in GP (200000000 = 200m) --

where do i put the level lol
 
Like this:
Lua:
local level = 1000 -- Put here the level to rebirth --
local cost = 5000 -- Put here the cost to rebirth in GP (200000000 = 200m) --
 
Back
Top