Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThingMove(creature, thing, oldpos, oldstackpos) npcHandler:onThingMove(creature, thing, oldpos, oldstackpos) end
function onCreatureAppear(creature) npcHandler:onCreatureAppear(creature) end
function onCreatureDisappear(id) npcHandler:onCreatureDisappear(id) end
function onCreatureTurn(creature) npcHandler:onCreatureTurn(creature) end
function onCreatureChangeOutfit(creature) npcHandler:onCreatureChangeOutfit(creature) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
function creatureSayCallback(cid, type, msg)
if(npcHandler.focus ~= cid) then
return false
end
queststatus = getPlayerStorageValue(cid, 9517)
dairy = doPlayerRemoveItem(cid, 1985, 1)
dairyStatus = getPlayerStorageValue(cid, 1985)
-- getmission --
if msgcontains(msg, 'mission') then
npcHandler:say("I have lost my dairy... I were exploring east of Rhyves when they came, could you please find it?")
talk_state = 1
-- Confirm yes --
elseif msgcontains(msg, 'yes') and talk_state == 1 and queststatus == -1 then
npcHandler:say("Go and find it brave warrior!")
setPlayerStorageValue(cid, 9517, 1)
focus = 0
else
npcHandler:say("You have already accepted this task..")
end
elseif msgcontains(msg, 'no') and talk_state == 1 then
npcHandler:say("Come back when you have grown up!")
talk_state = 0
end
elseif msgcontains(msg, 'dairy') then
npcHandler:say("Did you find my dairy?")
talk_state = 2
elseif msgcontains(msg, 'yes') and talk_state == 2 and dairy == TRUE and dairyStatus == TRUE then
npcHandler:say("Thank you! Here you got some money!")
doPlayerAddItem(cid, 2152, 27)
focus = 0
else
npcHandler:say("You dont have my dairy.")
end
elseif msgcontains(msg, 'no') and talk_state == 2 then
npcHandler:say("Please find it for me.")
talk_state = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())
Heres the Error
Code:
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/Mission.lu
a
data/npc/scripts/Mission.lua:43: 'end' expected (to close 'function' at line 19)
near 'elseif'
I'd be really thank full if you help me =)
(Im using the latest TFS)
sincerely,
Furstwin.
Last edited by a moderator: