God Mythera
Veteran OT User
So when i try to rebirth on a character with the level (150) it doesnt do anything and gives this error:
This is also the npc & script:
If anyone can help id really appreciate it :d
This is also the npc & script:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Prestige Npc" script="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 'Prestige' system."/>
<parameter key="message_farewell" value="Good bye my dear friend."/>
</parameters>
</npc>
Code:
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, 'prestige')) then
selfSay('Are you ready to prestige and start a new life?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
-------CONFIGS-------
local level = 150
local cost = 100000
------/CONFIGS-------
-----LOCALS-----
local id = getPlayerGUID(cid)
local name = getCreatureName(cid)
local vocation = getPlayerVocation(cid)
local storage = getCreatureStorage(cid, 85987)
----/LOCALS-----
if(getPlayerLevel(cid) >= level) then
if(doPlayerRemoveMoney(cid, cost) == TRUE) then
if(isInArray({1, 2, 3, 4, 5, 6, 7, 8}, vocation)) then
doCreatureSetStorage(cid, 85987, storage == -1 and 1 or storage + 1)
doRemoveCreature(cid)
db.query("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 0 WHERE `id` ='"..id.."';")
db.query("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
else
selfSay('Please talk with Forgotten King and promote first.', cid)
talkState[talkUser] = 0
end
else
selfSay('You don\'t have enough money. You need to pay 1 gold coin to be rebirthed.', cid)
talkState[talkUser] = 0
end
else
selfSay('Only characters of level 150 or higher can be rebirthed.', cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
selfSay('Okey. Come back when you feel ready.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
If anyone can help id really appreciate it :d