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

masterjojje

Tibia geek! :D
Joined
Feb 10, 2009
Messages
158
Reaction score
1
Location
Sweden
Hello I have searched for a long time for a rebirth npc...For an example how it works: When you reach lvl 40k+ You go to the npc and talk to him and then he make you to lvl 8 again but you can keep all hp/mana/skills/magic level and you can also not change vocation when you rebirth...Hmm and can you please add this dialog to the npc:
PLAYER: Hi
Rebirther: Hello dear player, ready for me to rebirth you?
PLAYER: Yes
Rebirther: Now you are rebirthed.

If you arent 40k+:
Rebirther: Hello dear player, ready for me to rebirth you?
PLAYER: Yes
Rebirther: You are to low level come back when you are ready.

If you decline:
Rebirther: Hello dear player, ready for me to rebirth you?
PLAYER: No
Rebirther: Okey come back when you are ready.

When you say bye:
Rebirther: Good bye my dear friend.

If someone could make this I would give you rep+++ and you would be my god! or goddess;)
 
I made one for you modifying one I used on my last server, it used to work on 0.3.2 but dont know if it will on 0.3.5 or so.

I also havent tested the modification because Im not home, but here it is, tell me if it works or doesnt.

In data/npc make Rebirth NPC.xml and add this on the script:

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rebirth NPC" script="data/npc/scripts/rebirthnpc.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="130" head="39" body="122" legs="125" feet="57" addons="0"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. Im in charge of the 'rebirth' system."/>
		<parameter key="message_farewell" value="Good bye my dear friend."/>
	</parameters>
</npc>

Then in data/npc/scripts make rebirthnpc.lua and add this:

Lua:
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

	local level	= 40000		-- Put here the level to rebirth
	local cost	= 20000		-- Put here the cost to rebirth in GP (20000 = 20k)

	local name = getCreatureName(cid)
	local vocation = getPlayerVocation(cid)

		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, vocation = 1 WHERE name ='"..name.."';")
				elseif vocation == 2 then
					doRemoveCreature(cid)
					db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 2 WHERE name ='"..name.."';")
				elseif vocation == 3 then
					doRemoveCreature(cid)
					db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 3 WHERE name ='"..name.."';")
				elseif vocation == 4 then
					doRemoveCreature(cid)
					db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 4 WHERE name ='"..name.."';")
				else
					selfSay('Not a valid vocation. Contact administrator.', cid)
					talkState[talkUser] = 0
				end
			else
				selfSay('You dont have enough money. You need to pay 20k to be rebirthed.', cid)
				talkState[talkUser] = 0
			end
		else
			selfSay('Only characters of level 40k or higher can be rebirthed.', cid)
			talkState[talkUser] = 0
		end

	elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then
		talkState[talkUser] = 0
		selfSay('Okey come back when you are ready.', cid)
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Post if you get any errors or something.

Cheers.
 
Last edited:
I made one for you modifying one I used on my last server, it used to work on 0.3.2 but dont know if it will on 0.3.5 or so.

I also havent tested the modification because Im not home, but here it is, tell me if it works or doesnt.

In data/npc make Rebirth NPC.xml and add this on the script:

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rebirth NPC" script="data/npc/scripts/rebirthnpc.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="130" head="39" body="122" legs="125" feet="57" addons="0"/>
	<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. Im in charge of the 'rebirth' system."/>
		<parameter key="message_farewell" value="Good bye my dear friend."/>
	</parameters>
</npc>

Then in data/npc/scripts make rebirthnpc.lua and add this:

Lua:
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

	local level	= 40000		-- Put here the level to rebirth
	local cost	= 20000		-- Put here the cost to rebirth in GP (20000 = 20k)

	local name = getCreatureName(cid)
	local vocation = getPlayerVocation(cid)

		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, vocation = 1 WHERE name ='"..name.."';")
				elseif vocation == 2 then
					doRemoveCreature(cid)
					db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 2 WHERE name ='"..name.."';")
				elseif vocation == 3 then
					doRemoveCreature(cid)
					db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 3 WHERE name ='"..name.."';")
				elseif vocation == 4 then
					doRemoveCreature(cid)
					db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 4 WHERE name ='"..name.."';")
				else
					selfSay('Not a valid vocation. Contact administrator.', cid)
					talkState[talkUser] = 0
				end
			else
				selfSay('You dont have enough money. You need to pay 20k to be rebirthed.', cid)
				talkState[talkUser] = 0
			end
		else
			selfSay('Only characters of level 40k or higher can be rebirthed.', cid)
			talkState[talkUser] = 0
		end

	elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then
		talkState[talkUser] = 0
		selfSay('Okey come back when you are ready.', cid)
	end
	return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Post if you get any errors or something.

Cheers.

this keeps same skills hp mana etc.. only level? o_O
 
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
 
Back
Top