I have this script with reborns
I can't make script doors to this reborn system who help me ! PLS!local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
local reborn = 2500 -- free storage
local spellReborn = {
[1] = 'Reborn spell #1',
[5] = 'Reborn spell #5',
[10] = 'Reborn spell #10',
[25] = 'Reborn spell #25',
[50] = 'Reborn spell #50',
[100] = 'Reborn spell #100',
[250] = 'Reborn spell #250',
[500] = 'Reborn spell #500'
}
local level = 717217
local maxReborns = 5000
local toLevel = 101
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function greetCallback(cid)
Topic[cid] = nil
return true
end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
elseif Topic[cid] then
if msgcontains(msg, 'yes') then
if getCreatureStorage(cid, reborn) < maxReborns then
doCreatureSetStorage(cid, reborn, math.max(0, getCreatureStorage(cid, reborn)) + 1)
for k, v in pairs(spellReborn) do
if getCreatureStorage(cid, reborn) == k then
doPlayerLearnInstantSpell(cid, v)
doSendMagicEffect(getThingPosition(cid), CONST_ME_FIREWORK_RED)
break
end
end
local g = getPlayerGUID(cid)
npcHandler:releaseFocus(cid)
doRemoveCreature(cid)
db.executeQuery('UPDATE players SET level=99,experience=15219400 WHERE id=' .. g)
else
npcHandler:say('You reached maximum amount of reborns.', cid)
end
else
npcHandler:say('Maybe next time.', cid)
end
Topic[cid] = nil
else
if msgcontains(msg, 'reborn') then
if getPlayerLevel(cid) >= level then
npcHandler:say('Reborned you ?',cid)
Topic[cid] = 1
else
npcHandler:say('You don\'t have enough level. ['..level..']',cid)
Topic[cid] = nil
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())