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

[Request] Rebirth Onloonk

Ranyo13

ManCausingMayhem
Joined
Aug 22, 2009
Messages
981
Reaction score
39
Hey otlanders... ^_^
I was just thinking if you guys could help me with a rebirth onlook system that means when you look on someone that has rebirthed before it tells u next to his name: You see (Player Name). He is a 5th rebirthed knight. Dunno if its possible to do.. So heres my rebirth script but i think it needs to be customized so when u get rebirthed each time it adds a different storage value.. and the onlook script shud check the storage value.. There:
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('Are you ready to be reborn?', cid)
                talkState[talkUser] = 1

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

        local level     =   700000
        local cost      =   1000000
        
        ------/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 == 5 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 20, `experience` = 98800, `promotion` = 1 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥"..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 6 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 20, `experience` = 98800, `promotion` = 1 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥"..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 7 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 20, `experience` = 98800, `promotion` = 1 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥"..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 8 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 20, `experience` = 9880, `promotion` = 1 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥"..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 9 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 20, `experience` = 98800, `promotion` = 2 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥"..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 10 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 20, `experience` = 98800, `promotion` = 2 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥"..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 11 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 20, `experience` = 98800, `promotion` = 2 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥"..name.."' WHERE `id` ='"..id.."';")
                                elseif vocation == 12 then
                                        doRemoveCreature(cid)
                                        db.executeQuery("UPDATE `players` SET `level` = 20, `experience` = 9880, `promotion` = 2 WHERE `id` ='"..id.."';")
                                        db.executeQuery("UPDATE `players` SET `name` = '¥"..name.."' WHERE `id` ='"..id.."';")

                                else
                                        selfSay('Please talk with forgotten king and promote first.', cid)
                                        talkState[talkUser] = 0
                                end
                        else
                                selfSay('You dont have enough money. You need to pay 1milion coins to be rebirthed.', cid)
                                talkState[talkUser] = 0
                        end
                else
                        selfSay('Only characters of level 700000 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())

--------------------[SPECIAL THANKS TO CYKO SOLVED]-------------------------------[ANOTHER PROBLEM]-------------------------------[LOOK BELOW]------------------------
Guyz cyko helped me with rebirth onlook but the rebirth script it self got a weird problem.. When i try rebirthing i relog and check skills button when i click it the client debugs so help plz?
Rep ++ if u help me
Thanks alot...;)
 
Last edited:
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local t = {}

local level = 700000
local cost = 1000000

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
	elseif msgcontains(msg, 'rebirth') then
		selfSay('Are you ready to be reborn?', cid)
		t[cid] = 1
	elseif t[cid] == 1 then
		npcHandler:releaseFocus(cid)
		t[cid] = nil
		if msgcontains(msg, 'yes') then
			if getPlayerLevel(cid) >= level then
				if getPlayerPromotionLevel(cid) ~= 0 then
					if doPlayerRemoveMoney(cid, cost) then
						doCreatureSetStorage(cid, 133, math.max(0, getCreatureStorage(cid, 133)) + 1)
						local q = "UPDATE players SET level=20,experience=98800,name='¥"..getCreatureName(cid).."' WHERE id="..getPlayerGUID(cid)
						doRemoveCreature(cid)
						db.executeQuery(q)
					else
						selfSay('You don\'t have enough money. You need to pay ' .. cost .. ' coins to be rebirthed.', cid)
					end
				else
					selfSay('Please talk with The Forgotten King and promote first.', cid)
				end
			else
				selfSay('Only characters of level ' .. level .. ' or higher can be rebirthed.', cid)
			end
		else
			selfSay('Okay, come back when you are ready.', cid)
		end
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
LUA:
function onLook(cid, thing, position, lookDistance)
	if not isPlayer(thing.uid) then
		return true
	end

	doPlayerSetSpecialDescription(thing.uid, '.  Resets: ' .. math.max(0, getCreatureStorage(thing.uid, 133)))
	return true
end
 
create a new look creaturescript. also add health=185,healthmax=185,mana=35,manamax=35, to the query, before level=
 
Thanks alot Cyko, you have gained ur rep :)

EDIT:When i rebirth it gives me an error..
Code:
[05/05/2011 03:48:28] [Error - Npc interface] 
[05/05/2011 03:48:28] data/npc/scripts/rebirthnpc.lua:onCreatureSay
[05/05/2011 03:48:28] Description: 
[05/05/2011 03:48:28] data/npc/scripts/rebirthnpc.lua:32: attempt to concatenate upvalue 'name' (a boolean value)
[05/05/2011 03:48:28] stack traceback:
[05/05/2011 03:48:28] 	data/npc/scripts/rebirthnpc.lua:32: in function 'callback'
[05/05/2011 03:48:28] 	data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[05/05/2011 03:48:28] 	data/npc/scripts/rebirthnpc.lua:13: in function <data/npc/scripts/rebirthnpc.lua:13>
 
Last edited:
Well, i think its urs
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local t = {}
 
local level = 717217
local cost = 1000000
local name = getCreatureName(cid)
 
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
	elseif msgcontains(msg, 'rebirth') then
		selfSay('Are you ready to be reborn?', cid)
		t[cid] = 1
	elseif t[cid] == 1 then
		npcHandler:releaseFocus(cid)
		t[cid] = nil
		if msgcontains(msg, 'yes') then
			if getPlayerLevel(cid) >= level then
				if getPlayerPromotionLevel(cid) ~= 0 then
					if doPlayerRemoveMoney(cid, cost) then
						doCreatureSetStorage(cid, 133, math.max(0, getCreatureStorage(cid, 133)) + 1)
						local q = "UPDATE players SET level=20,experience=98800,name='"..getCreatureName(cid).."' WHERE id="..getPlayerGUID(cid)
						doRemoveCreature(cid)
doBroadcastMessage("".. name .." has been reborned.", MESSAGE_STATUS_CONSOLE_ORANGE)
						db.executeQuery(q)
					else
						selfSay('You don\'t have enough money. You need to pay ' .. cost .. ' coins to be rebirthed.', cid)
					end
				else
					selfSay('Please talk with The Forgotten King and promote first.', cid)
				end
			else
				selfSay('Only characters of level ' .. level .. ' or higher can be rebirthed.', cid)
			end
		else
			selfSay('Okay, come back when you are ready.', cid)
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local t = {}
 
local level = 717217
local cost = 1000000
 
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
	elseif msgcontains(msg, 'rebirth') then
		selfSay('Are you ready to be reborn?', cid)
		t[cid] = 1
	elseif t[cid] == 1 then
		npcHandler:releaseFocus(cid)
		t[cid] = nil
		if msgcontains(msg, 'yes') then
			if getPlayerLevel(cid) >= level then
				if getPlayerPromotionLevel(cid) ~= 0 then
					if doPlayerRemoveMoney(cid, cost) then
						doCreatureSetStorage(cid, 133, math.max(0, getCreatureStorage(cid, 133)) + 1)
						local name = getCreatureName(cid)
						local q = "UPDATE players SET level=20,experience=98800,name='"..name.."' WHERE id="..getPlayerGUID(cid)
						doRemoveCreature(cid)
						doBroadcastMessage(name .. ' has been reborned.', MESSAGE_STATUS_CONSOLE_ORANGE)
						db.executeQuery(q)
					else
						selfSay('You don\'t have enough money. You need to pay ' .. cost .. ' coins to be rebirthed.', cid)
					end
				else
					selfSay('Please talk with The Forgotten King and promote first.', cid)
				end
			else
				selfSay('Only characters of level ' .. level .. ' or higher can be rebirthed.', cid)
			end
		else
			selfSay('Okay, come back when you are ready.', cid)
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Cykotitan i hope u check this thread again.. Or if any scripter checks this thread help me fix my bug.. whenever i try rebirthing everything goes ok but when i relog i try opening my skills tab it debugs me or when i try clicking tibia on the task bar it debugs again...

EDIT: Rep++ for who helps :/
 
Last edited:
Back
Top