Alegres
You break it you buy it
Hello, I'm writing quest based on that tutorial: http://otland.net/f479/configuration-how-make-working-quest-log-143683/
Code:
but I get errors:
What am I doing wrong? I got TFS for Tibia 9.31
Code:
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 = 25578 -- 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('I will be waiting here, I guess... Find the bloody lever!',cid)
doPlayerSetStorageValue(cid, stor1, 0)
elseif getPlayerStorageValue(cid, stor1) == 0 then
npcHandler:say('I am still waiting for you to unlock me.',cid)
elseif getPlayerStorageValue(cid, stor1) == 1 then
npcHandler:say('Thank you, now I\'m free! I\'ll tell you a secret. To pass through the doors, you have to whistle while staying right in front of them.',cid)
doPlayerSetStorageValue(cid, 1234, 1)
doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerSetStorageValue(cid, stor1, 2)
elseif getPlayerStorageValue(cid, stor1) == 2 then
npcHandler:say('You already unlocked my cage, thank you!',cid)
end
end
local node1 = keywordHandler:addKeyword({'out'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Some bastards forced me into entering here then locked the room by pulling a lever around here somewhere. Would you please find it and unlock me?'})
node1:addChildKeyword({'yes'}, Task1, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Seems like you are no better than them.', reset = true})
npcHandler:addModule(FocusModule:new())
but I get errors:
What am I doing wrong? I got TFS for Tibia 9.31