Teddy
SweStream.se
Can some post the promotion guy (working promotion npc)
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, text = 'Congratulations! You are now promoted.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Allright then. Come back when you are ready.', reset = true})
npcHandler:addModule(FocusModule:new())
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Promotion" script="data/npc/scripts/promotion.lua" walkinterval="1" floorchange="0">
<health now="100" max="100"/>
<look type="133" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>
[17/04/2009 15:03:36] Lua Script Error: [Npc interface]
[17/04/2009 15:03:36] data/npc/scripts/Copy.lua:onCreatureSay
[17/04/2009 15:03:36] data/npc/lib/npcsystem/modules.lua:80: attempt to compare nil with number
[17/04/2009 15:03:36] stack traceback:
[17/04/2009 15:03:36] data/npc/lib/npcsystem/modules.lua:80: in function 'callback'
[17/04/2009 15:03:36] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[17/04/2009 15:03:36] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[17/04/2009 15:03:36] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[17/04/2009 15:03:36] data/npc/lib/npcsystem/npchandler.lua:371: in function 'onCreatureSay'
[17/04/2009 15:03:36] data/npc/scripts/Copy.lua:7: in function <data/npc/scripts/Copy.lua:7>
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--
npcHandler:addModule(FocusModule:new())