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

CreatureEvent Reborn System

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
Here is my reborn system, there you have a easy way to config it.
Lua:
local config =
{
	levelLimit = 400, --limit of course
	kickTime = 60000, --(in miliseconds) time before player gets kicked
	removeInventory = true, --remove items from inventory after reset? (to prevent players using items with level required after reset)
	newLevel = 20, --new level after reset
	newExp = 4500, --new exp after reset
	resetSkills = true, --reset skills?
	skillLevel = 11, --new skills level after reset
	resetMagic = true, --reset magic level?
	newMagic = 2, --new magic level after reset
	resetHealth = true, --reset health?
	newHealth = 180, --new player health/healthmax after reset
	resetMana = true, --reset mana?
	newMana = 240, --new player mana/manamax after reset
	resetVocation = true --delete promotion?
}

local displayMessage, message = true, "You have reached the level limit, you will be kicked in " .. config.kickTime / 1000 .. " seconds."

function onAdvance(cid, skill, oldlevel, newLevel)

	if(skill == SKILL__LEVEL and isPlayer(cid)) then
		if newLevel >= config.levelLimit then
			local queries = {}
			local id = getPlayerGUID(cid)	

			if displayMessage then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, message)
			end
			if config.removeInventory then
				table.insert(queries, "delete from player_items where player_id = " .. id .. ";")
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Save your items on the depot or will be deleted after the reset.")
			end
			if config.resetSkills then
				for i = 1, 6 do
					table.insert(queries, "update player_skills set value = " .. config.skillLevel .. ", count = 0 where skillid = " .. i - 1 .. " and player_id = " .. id .. ";")
				end
			end
			table.insert(queries, "update players set level = " .. config.newLevel .. ", experience = " .. config.newExp .. "" .. (config.resetMagic and ", maglevel = " .. config.newMagic .. "" or "") .. (config.resetHealth and ", health = " .. config.newHealth .. ", healthmax = " .. config.newHealth .. "" or "") .. (config.resetMana and ", mana = " .. config.newMana .. ", manamax = " .. config.newMana .. "" or "") .. (config.resetVocation and ", promotion = 0" or "") .. ";")
			addEvent(reset, config.kickTime, getCreatureName(cid), queries)
		else
			if config.levelLimit - newLevel <= 10 then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need " .. config.levelLimit - newLevel .. " levels more to reach the limit".. (config.removeInventory and ", remember to save your items at the depot" or "") .. ".")
			end
		end
	end
	return true
end

function reset(p, queries)
	if getPlayerByName(p) ~= nil then
		doRemoveCreature(getCreatureByName(p))
		db.executeQuery("update players set online = 0 where id = " .. getPlayerGUIDByName(p) .. ";")
	end
	for i = 1, table.maxn(queries) do
		if not db.executeQuery(queries[i]) then
			print("[RESET] Unable to execute query: " .. queries[i])
		end
	end
	return true
end

creaturescripts.xml
XML:
	<event type="advance" name="reset" event="script" value="reset.lua"/>

login.lua
Lua:
registerCreatureEvent(cid, "reset")
 
Would be great with a storage so you could make a script where you how many times someone has reborned.
 
Last edited:
wow| some people need learn lua to understend the script jjejej no no sense of offense
 
darkkhaos, can you modify script? i want make when player get the "limit level", the scripts says to him "Your want make a reborn?" and player can choose "Yes or Not".

Sorry for my explain on english, idk much... hehe thanks in advance
 
Is easier to reach level 399 and no level up more.. what you gain if you reset your self?
 
or try this in a npc for the ppl that want it to be chooseable :p

This code here shows u how it could have 2x rebirth, easy to see and understand I hope :)
Using on Crying Demension 0.3.6 :)

Code:
        if(msgcontains(msg, 'rebirth')) then
                selfSay('Would you like to be reborn?', cid)
                talkState[talkUser] = 1

        elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
------------------------------------------------CONFIGURATION-------------------------------------------------------------------------
        local level     = 60000         -- Put here the level to rebirth
------------------------------------------------Dont Touch These----------------------------------------------------------------------
        local id = getPlayerGUID(cid)
        local name = getCreatureName(cid)
        local vocation = getPlayerVocation(cid)
		------------------------------------------------------------------------------------------------------------------------------
		
                             if getPlayerLevel(cid) >= level then
				   if(isInArray({5,6,7,8}, getPlayerVocation(cid)) == TRUE) then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `health` = 500, `healthmax` = 500, `mana` = 500, `manamax` = 500, `promotion` = 2 WHERE `id` ='"..id.."';")
                             elseif(isInArray({9,10,11,12}, getPlayerVocation(cid)) == TRUE) then
                                        doRemoveCreature(cid)
					db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `health` = 500, `healthmax` = 500, `mana` = 500, `manamax` = 500, `promotion` = 3 WHERE `id` ='"..id.."';")

					 else
                                                selfSay('Youre not the right level, vocation, or havent enough cash to rebirth yourself.', cid)
                                                talkState[talkUser] = 0
                                                end
				        end
			        end	
        return TRUE
        end
Hope this helps the people that wish to have chosen rebirth in their servers :p
 
Last edited:
@kito2, what i did was made reborn vocations that get -66% exp and have bonus combat rates, hp/mp perlevel and regenerations, etc..
if someone wants more than one rebirth, make it start at -33% exp +33% stats,
second reborn -66% exp +66% stats :p you see?
 
Hello!

where need i pull this local config =
{
levelLimit = 400, --limit of course
kickTime = 60000, --(in miliseconds) time before player gets kicked
removeInventory = true, --remove items from inventory after reset? (to prevent players using items with level required after reset)
newLevel = 20, --new level after reset
newExp = 4500, --new exp after reset
resetSkills = true, --reset skills?
skillLevel = 11, --new skills level after reset
resetMagic = true, --reset magic level?
newMagic = 2, --new magic level after reset
resetHealth = true, --reset health?
newHealth = 180, --new player health/healthmax after reset
resetMana = true, --reset mana?
newMana = 240, --new player mana/manamax after reset
resetVocation = true --delete promotion?
}

local displayMessage, message = true, "You have reached the level limit, you will be kicked in " .. config.kickTime / 1000 .. " seconds."

function onAdvance(cid, skill, oldlevel, newLevel)

if(skill == SKILL__LEVEL and isPlayer(cid)) then
if newLevel >= config.levelLimit then
local queries = {}
local id = getPlayerGUID(cid)

if displayMessage then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, message)
end
if config.removeInventory then
table.insert(queries, "delete from player_items where player_id = " .. id .. ";")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Save your items on the depot or will be deleted after the reset.")
end
if config.resetSkills then
for i = 1, 6 do
table.insert(queries, "update player_skills set value = " .. config.skillLevel .. ", count = 0 where skillid = " .. i - 1 .. " and player_id = " .. id .. ";")
end
end
table.insert(queries, "update players set level = " .. config.newLevel .. ", experience = " .. config.newExp .. "" .. (config.resetMagic and ", maglevel = " .. config.newMagic .. "" or "") .. (config.resetHealth and ", health = " .. config.newHealth .. ", healthmax = " .. config.newHealth .. "" or "") .. (config.resetMana and ", mana = " .. config.newMana .. ", manamax = " .. config.newMana .. "" or "") .. (config.resetVocation and ", promotion = 0" or "") .. ";")
addEvent(reset, config.kickTime, getCreatureName(cid), queries)
else
if config.levelLimit - newLevel <= 10 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need " .. config.levelLimit - newLevel .. " levels more to reach the limit".. (config.removeInventory and ", remember to save your items at the depot" or "") .. ".")
end
end
end
return true
end

function reset(p, queries)
if getPlayerByName(p) ~= nil then
doRemoveCreature(getCreatureByName(p))
db.executeQuery("update players set online = 0 where id = " .. getPlayerGUIDByName(p) .. ";")
end
for i = 1, table.maxn(queries) do
if not db.executeQuery(queries) then
print("[RESET] Unable to execute query: " .. queries)
end
end
return true
end
 
@kito2
something worthy of posting ?
-Basic Vocations File with 2x Reborn Vocations, 16voc ids,
-Rebirth NPC File, and script.
-Tutorial/Guide/Information on how it works.
???????????
 
Please always say which version of OTservers that can handle this script. Does it work for 0.2.7 TFS?
 
Back
Top