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
lvl = XX -- put here the leve requiered
mount = XX -- put here the mount id
startid = XXXX -- storagevalue to start task
bearid = XXXX -- storage of the bear task
bearcount = XXX -- storage to count the number of bears
bearsuccess = XX -- bear task done
bearnumber = XX -- number of bears to beat the task
expp = XX -- experience points
function task(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerStorageValue(cid, startid) <= 0 then
npcHandler:say("Hello, i have right now the {bear} task for you, you need to be level " .. lvl .. " to start this task", cid)
else
if getPlayerStorageValue(cid, bearsuccess) >= 1 then
npcHandler:say("Great! you have finish the task, as a reward take a mount and exp", cid)
setPlayerStorageValue(cid, startid, 0)
setPlayerStorageValue(cid, bearid, 0)
setPlayerStorageValue(cid, bearcount, 0)
setPlayerStorageValue(cid, bearsuccess, 0)
Player(cid):addMount(mount)
Player(cid):addExperience(expp)
npcHandler:resetNpc()
else
if getPlayerStorageValue(cid, startid) == 1 then
npcHandler:say("I'm sorry, you are already in a task, finish first the task and then try to start other, say {!task} to check your progress", cid)
npcHandler:resetNpc()
end
end
end
return true
end
function bear(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerLevel(cid) >= lvl then
npcHandler:say('The bear task, you need to kill ' .. bearnumber .. ' bears, if you do it you will receive a mount and exp, will you do it?', cid)
else
npcHandler:say("Sorry, you don't have enough level to do this task", cid)
npcHandler:resetNpc()
end
return true
end
function acceptbear(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerLevel(cid) >= lvl then
npcHandler:say('Okay!, you have to kill ' .. bearnumber .. ' bears, no matter where they are, if you want to see your progress you can say {!task} or simple ask me, good hunting!', cid)
setPlayerStorageValue(cid, startid, 1)
setPlayerStorageValue(cid, bearid, 1)
setPlayerStorageValue(cid, bearcount, 0)
npcHandler:resetNpc()
end
return true
end
local node1 = keywordHandler:addKeyword({'task'}, task)
local node2 = node1:addChildKeyword({'bear'}, bear)
local node3 = node2:addChildKeyword({'yes'}, acceptbear)
local node4 = node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Well, if you don\'t want...'})
npcHandler:addModule(FocusModule:new())