Sirion_Mido
Experienced Member
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 :
2. Go To Data / Npc / Scripts -> And Create File Name Rebirth.lua
And Paste The Following:
Now creaturescripts Part:
1. Go To Data / creaturescripts / scripts And Create File Name ->rebirth.lua
And Paste The Following
Now Go To Data / creaturescripts / Scripts / And Open Login.lua And Paste The Following:
After
Then Go To data / creaturescripts / creaturescripts.xml and paste The Following:
Rep++
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())
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
Lua:
registerCreatureEvent(cid, "Rebirth")
Lua:
registerCreatureEvent(cid, "GuildMotd")
Lua:
<event type="Look" name="Rebirth" event="script" value="Rebirth.lua"/>
Rep++
Last edited: