• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent Rebirth System , Rep++

Sirion_Mido

Experienced Member
Joined
Jul 22, 2012
Messages
579
Reaction score
43
Location
E-G-Y-P-T
Hello That's Rebirth System Npc
I Will Say How To Add Step By Step

1. ~Go To Data / Npc -> And Create File Name Rebirth.xml
And Paste The Following :
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rebirth" script="data/npc/scripts/rebirth.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100"/>
<look type="73" head="78" body="88" legs="0" feet="88" addons="3"/>
    <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>

2. Go To Data / Npc / Scripts -> And Create File Name Rebirth.lua
And Paste The Following:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local t = {}
 
local level = 300
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())
Now creaturescripts Part:
1. Go To Data / creaturescripts / scripts And Create File Name ->rebirth.lua
And Paste The Following
Lua:
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
Now Go To Data / creaturescripts / Scripts / And Open Login.lua And Paste The Following:
Lua:
registerCreatureEvent(cid, "Rebirth")
After
Lua:
registerCreatureEvent(cid, "GuildMotd")
Then Go To data / creaturescripts / creaturescripts.xml and paste The Following:
Lua:
<event type="Look" name="Rebirth" event="script" value="Rebirth.lua"/>

Rep++
 
Last edited:
So what happens when you get reborn? Can you explain this a little more?


Reborn means that you "evolve" and gives you more survivability, meaning you keep your hp at that specifik lvl you go prestige .. Knight lvl 100 000 got 14mil hp -> after reborn you will be lvl 8 (1 rebirth.prestige.reborn w.e) with 14mil hp.

:)
 
man plz the look is not working, how can i do to use look on someone and see how many prestige he/she has?
 

Similar threads

Back
Top