L
LordVissie
Guest
Hey guys, so It has been a while since I created a thread but I'm back!
What I would like to have is: A part in the player description like this:
So I found something and that's this:
______________________________________________________________________________________________________
creaturescripts.xml:
Code:
login.lua
Code:
rebirth.lua
Code:
This is my rebirthnpc.lua:
______________________________________________________________________________________________________
I added everything but It doesn't seems to work. It gives me no errors or something else. Anyone having an idea how I can make it work?
Thanks for the help as always
(I'm using 0.3.6)
Regards,
LordVissie
~And If someone knows how to make the player only rebirth ones please tell me!
What I would like to have is: A part in the player description like this:
You see Test. He is a druid. This player has been Reborned.
So I found something and that's this:
______________________________________________________________________________________________________
creaturescripts.xml:
Code:
Code:
<event type="Look" name="Rebirth" event="script" value="Rebirth.lua"/>
login.lua
Code:
Code:
registerCreatureEvent(cid, "Rebirth")
rebirth.lua
Code:
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
This is my rebirthnpc.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local t = {}
local level = 6000
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())
I added everything but It doesn't seems to work. It gives me no errors or something else. Anyone having an idea how I can make it work?
Thanks for the help as always
Regards,
LordVissie
~And If someone knows how to make the player only rebirth ones please tell me!
Last edited by a moderator: