I'm trying to make a quest in my server and I seemed to have put the code in correctly,
but i get this error (Which occurs after talking with him, when i say yes to the quest)
I'm using TFS 0.2.15
Here is my code in XML\Quests.lua
here is my NPC code in \data\npc\scripts
anyone see the problem? Is there anything i'm forgetting?
but i get this error (Which occurs after talking with him, when i say yes to the quest)
Code:
[26/01/2014 01:58:37] data/npc/scripts/doug.lua:21: attempt to call global 'doPlayerSetStorageValue' (a nil value)
[26/01/2014 01:58:37] stack traceback:
[26/01/2014 01:58:37] [C]: in function 'doPlayerSetStorageValue'
[26/01/2014 01:58:37] data/npc/scripts/doug.lua:21: in function 'callback'
[26/01/2014 01:58:37] data/npc/lib/npcsystem/keywordhandler.lua:27: in function 'processMessage'
[26/01/2014 01:58:37] data/npc/lib/npcsystem/keywordhandler.lua:135: in function 'processNodeMessage'
[26/01/2014 01:58:37] data/npc/lib/npcsystem/keywordhandler.lua:103: in function 'processMessage'
[26/01/2014 01:58:37] data/npc/lib/npcsystem/npchandler.lua:387: in function 'onCreatureSay'
[26/01/2014 01:58:37] data/npc/scripts/doug.lua:7: in function <data/npc/scripts/doug.lua:7>
Here is my code in XML\Quests.lua
Code:
<quest name="Doug" startstorageid="80012" startstoragevalue="1">
<mission name="Doug's Glasses" storageid="424242" startvalue="1" endvalue="3">
<missionstate id="1" description="Doug asked you to find his glasses. He last saw them in Mount Minotaur."/>
<missionstate id="2" description="Return the found glasses to Doug."/>
<missionstate id="3" description="Doug praised you for your favour."/>
</mission>
</quest>
here is my NPC code in \data\npc\scripts
Code:
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
-- QUEST --
function Task1(cid, message, keywords, parameters, node)
local stor1 = 424242 -- this is the same STOR1 from quests.xml
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerStorageValue(cid,stor1) < 0 then
npcHandler:say('Hurry please find my glasses! I can not see a thing!',cid)
doPlayerSetStorageValue(cid, stor1, 1)
elseif getPlayerStorageValue(cid, stor1) == 1 then
npcHandler:say('I am still waiting for you to find my glasses!',cid)
elseif getPlayerStorageValue(cid, stor1) == 2 then
npcHandler:say('Thank you so much for finding my glasses!',cid)
doPlayerAddItem(cid, 2152, 25)
doPlayerSetStorageValue(cid, stor1, 3)
doSendMagicEffect(getCreaturePosition(cid), 13)
elseif getPlayerStorageValue(cid, stor1) == 3 then
npcHandler:say('You already unlocked the room, thank you!',cid)
end
end
local node1 = keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Can you help me find my glasses?!'})
node1:addChildKeyword({'yes'}, Task1, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Oh, sorry to bother you.', reset = true})
npcHandler:addModule(FocusModule:new())
anyone see the problem? Is there anything i'm forgetting?
Last edited: