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

rebirth onlook script

tsb0314

New Member
Joined
Oct 21, 2009
Messages
220
Reaction score
4
adding new things to my server and saw a script about rebirths. i have tried mostly all of them and none of them do or work as i want them to
when a character get to level 50k i would like them to somehow (npc or talkaction it doesnt matter to me) reset themselfs to level 100.

now that is the easy part. this is what the other scripts dont have.


when you look at someone it should look like this

21:05 You see Joshy (Level 36518). He is an elite knight.[rebirths: 4] Health: [1216827892 / 1216827892], Mana: [3498795 / 3651035]


if not there really is no point to reseting or rebirthing.


if someone could please help me get this in either an NPC or just a talkaction like !rebirth. that would be great

thanks
 
create file
data/npc/scripts/rebirthnpc.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local t = {}
 
local level = 50000
local cost = 10000
 
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, 200, math.max(0, getCreatureStorage(cid, 200)) + 1)
						local q = "UPDATE players SET level=20,experience=98800 WHERE id="..getPlayerGUID(cid)
						npcHandler:releaseFocus(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())
creaturescripts.xml
Code:
        <event type="Look" name="Rebirth" event="script" value="Rebirth.lua"/>
login.lua
Code:
	registerCreatureEvent(cid, "Rebirth")
rebirth.lua
Code:
function onLook(cid, thing, position, lookDistance)
	if not isPlayer(thing.uid) then
		return true
	end
 
	doPlayerSetSpecialDescription(thing.uid, '.  Rebirth: ' .. math.max(0, getCreatureStorage(thing.uid, 200)))
	return true
end
 
Last edited:
need this ?
Code:
<?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 and Please come back and i will help you ."/>
    </parameters>
</npc>
 
Last edited:

Similar threads

Back
Top