• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Task System nie reaguje

marcinek99097

Banned User
Joined
Feb 6, 2010
Messages
588
Reaction score
4
Location
Poland/Dg
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}

local data = {
	[14007] = {'crocodile', 'Happy hunting, old chap! Come back to me when you are through with your task.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u crocodiles. Come back to me when you are done.', 'Spiffing work, old chap. Now I have a special task for you. Recently several citizens of Port Hope have vanished. It is rumoured that they were killed by a crocodile. The people call it \'Snapper\'. Hunt down and kill that evil man eating beast.', 800, 1, 'Snapper', },
	[14008] = {'tarantula', 'Happy hunting, old chap! Come back to me when you are through with your task.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u tarantulas. Come back to me when you are done.', 'Nicely done! Now I shall assign you a special task. Rumour has it that there is an ancient and evil tarantula who preys on humans. She is called \'Hide\'. Track her down and kill her! Good luck, old chap.', 1500, 1, 'Hide'},
	[14009] = {'carniphila', 'Good show, old chap! Speak to me again when you are done hunting.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u carniphilas. Come back to me when you are done.', 'That took some time, huh? Good hunting though. If you\'re up for another hunting mission just ask me for a {task}.', 1500, 1},
	[14010] = {'stone golem', 'Happy hunting, friend! When you have finished hunting, return here. ', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u stone golems. Come back to me when you are done.', 'Good show, old chap. If you\'re up for another hunting mission just ask me for a task.', 2000, 1},
	[14011] = {'mammoth', 'Happy hunting, friend! Come back to me when you are done hunting.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u mammoths. Come back to me when you are done.', 'Jolly good job you did there, but now I have a special task for you. The citizens of Svargrond live in fear because of a frightfully bad-tempered mammoth they call \'Blood Tusk\'. Go there and put an end to him. Happy hunting!', 'Bloodtusk', 4000, 1},
	[14012] = {'ice golem', 'Happy hunting, friend! Come back to me when you are done hunting.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u ice golems. Come back to me when you are done.', 'As i see it, you need more of a challenge! I have heard that there is an ice golem the hunters in Svargrond call \'Shardhead\'. He is an extremely dangerous example of his kind! I believe you are equal to the task, %s!', 15000, 1, 'Shardhead'},
	[14013] = {'quara constrictor scout', 'Happy hunting, friend! Come back to me when you are done hunting.', 'Alright, then you should go on with your task. You have already killed %u quara scouts in total. Come back to me when you are done.', 'Jolly good show! What a hunter! If you\'re up for another hunting mission just ask me for a {task}.', 10000, 1}, -- ?
	[14014] = {'quara constrictor', 'Happy hunting, friend! Come back to me when you are done hunting.', 'Alright, then you should go on with your task. You have already killed %u underwater quaras in total. Come back to me when you are done.', 'Superb work. However, there is something else I want you to do. It is said that there is a Quara general named \'Thul\' who is responsible for the attacks on Liberty Bay. Find him and kill him and bring peace to Liberty bay!', 12000, 1, 'Thul'}, -- OK
	[14015] = {'water elemental', 'Happy hunting, my old mocker! Come back to me when you are done hunting. ', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u water elementals. Come back to me when you are done.', 'Fantastic! If you\'re up for another hunting mission just ask me for a {task}.', 7000, 1},
	[14016] = {'earth elemental', 'Happy hunting, friend! Come back to me when you are done hunting. ', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u earth elementals. Come back to me when you are done.', 'Fantastic! If you\'re up for another hunting mission just ask me for a {task}.', 10000, 1},
	[14017] = {'energy elemental', 'Happy hunting, pal! Come back to me when you are done hunting. ', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u energy elementals. Come back to me when you are done.', 'Fantastic! If you\'re up for another hunting mission just ask me for a {task}.', 10000, 1},
	[14018] = {'fire elemental', 'Happy hunting, old friend! Come back to me when you are done hunting. ', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u fire elementals. Come back to me when you are done.', 'Fantastic! If you\'re up for another hunting mission just ask me for a {task}.', 7000, 1},
	[14019] = {'mutated rat', 'Happy hunting, old chap! Come back to me when you are done hunting. ', 'Alright, then stop dilly dallying here and go on with your task. You have already exterminated %u mutated rats. Come back to me when you are done.', {'Very good work, old chap. Lucky you are here - I have just been told of a task which is perfect for you. ...', 'The Yalaharians are having a spot of bother with a huge mutated rat. They call it \'Esmeralda\' and you should find her somewhere in the sewers. Good hunting!'}, 10000, 1, 'Esmeralda'}, -- OK
	[14020] = {'giant spider', 'Jolly good show! Come back to me when you are done hunting. ', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u giant spiders. Come back to me when you are done.', 'Well THAT was a hunt. Good job. Have you heared about \'The Old Widow\'? It must have a hideout. Try to find it and slay the beast.', 5000, 1, 'Old Widow'},
	[14021] = {'hydra', 'Happy hunting, old chap! Come back to me when you are done hunting.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u hydras. Come back to me when you are done.', {'With Nornur the God of Fate as my witness, you are truly born to hunt. If anyone can do this task, you can! Listen: ...', 'It is said that the Lizards of Chor are training hydras for attacks against us. They have already successfully bred a hydra named \'The Many\'. Find her and kill her!'}, 0, 3, 'Many'},
	[14001] = {'sea serpent', 'Happy hunting, old chap! Come back to me when you are done hunting.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u sea serpents. Come back to me when you are done.', 'Good job, old chap! Are you up for a challenge? Have you heard of the legendary sea serpent called \'The Leviathan\'? It must be somewhere near the spot you found. This is a true test of your hunting skills - find it and kill it. Good hunting!', 0, 3, 'Leviathan'},
	[14022] = {'behemoth', 'Happy hunting, old chap! Come back to me when you are done hunting.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u behemoths. Come back to me when you are done.', 'Such marvellous hunting skills! Perhaps you can help me with this one. Have you heard about \'Stonecracker\'? ...', 0, 3, 'Stonecracker'}, -- OK
	[14002] = {'serpent spawn', 'Happy hunting, old chap! Come back to me when you are done hunting.', 'Alright, then return to your duties! Day light is a-wasting! You have already smashed %u serpent spawns. Come back to me when you are done.', 'My - you can be proud of yourself! However, you\'re not finished yet. There are rumours about a being called \'The Noxious Spawn\' which was seen deep down in the ruins of Banuta. Try to find its hideout.', 0, 3, 'Noxious Spawn'},
}

local curTask = 14500
local points = 14501
local rank = 14502
local questLog = 14503
local tiquanda = 14505
local demodras = 14506

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

function greetCallback(cid)
	local cur, r, msg = getPlayerStorageValue(cid, points), getPlayerStorageValue(cid, rank)
	if cur >= 5 and r < 1 then
		msg = 'Welcome back |PLAYERNAME|. You have completed 5 tasks for our society. Ask me for a {promotion} to advance your rank!'
	elseif cur >= 10 and r < 2 then
		msg = 'Good to see you again |PLAYERNAME|. You have completed 10 tasks for our society. Ask me for a {promotion} to advance your rank!'
	elseif cur >= 20 and r < 3 then
		msg = 'Salutations |PLAYERNAME|. You have completed 20 tasks for our society. Ask me for a {promotion} to advance your rank!'
	elseif cur >= 30 and r < 4 then
		msg = 'Always good to welcome you back, |PLAYERNAME|. You have completed 30 tasks for our society. Ask me for a {promotion} to advance your rank!'
	elseif cur >= 50 and r < 5 then
		msg = 'By the gods....50 hunting tasks....this is astounding! Ask me for a {promotion} to advance your rank! And while you are here, I also have another {special} task for you.'
	else
		msg = 'Welcome back |PLAYERNAME|. What brings you here this time?'
	end
	npcHandler:setMessage(MESSAGE_GREET, msg)
	Topic[cid] = 0
	return true
end

function creatureSayCallback(cid, _type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	if msgcontains(msg, 'task') then
		local cur = getPlayerStorageValue(cid, curTask)
		if cur < 1 or (cur ~= 14006 and getPlayerStorageValue(cid, cur) == tasks[data[cur][1]].amount + 1 and getPlayerStorageValue(cid, cur + 100) == -1) then
			local v, lvl = '', getPlayerLevel(cid)
			if lvl < 50 then
				v, Topic[cid] = '{Crocodiles}, {tarantulas}, {carniphilas}, {stone golems} or {mammoths}', 1
			elseif lvl < 90 then
				v, Topic[cid] = '{Ice golems}, {Quara}, {elementals}, {mutated rats} or {giant spiders}', 2
			elseif 90 <= lvl then
				v, Topic[cid] = '{Hydras}, {sea serpents}, {behemoths}' .. (getPlayerStorageValue(cid, rank) == 5 and ', {serpent spawns} or {demons}' or ' or {serpent spawns}'), 3
			end
			selfSay('All right, what would you like to hunt? ' .. v .. '?', cid)
		elseif cur == 14006 and getPlayerStorageValue(cid, cur) == tasks['demon'].amount then
			selfSay({'Such derring do deserves a special reward! Take this holy icon. It neutralizes great evil and gives you access to areas which are protected by those forces. But remember ...', 'This is a one time opportunity! You won\'t get the holy icon twice.'}, cid)
			doPlayerAddItem(cid, 10305, 1)
			setPlayerStorageValue(cid, curTask, -1)
		elseif cur ~= 14006 and getPlayerStorageValue(cid, cur) == tasks[data[cur][1]].amount and getPlayerStorageValue(cid, cur + 100) < 1 then
			local tmp
			if type(data[cur][4]) == 'table' then
				tmp = {}
				for i = 1, #data[cur][4] do
					tmp[i] = string.format(data[cur][4][i], getCreatureName(cid))
				end
			end
			selfSay(tmp or string.format(data[cur][4], getCreatureName(cid)), cid)
			if data[cur][5] > 0 then
				doPlayerAddExp(cid, data[cur][5])
				doSendAnimatedText(getThingPos(cid), data[cur][5], 215)
			end
			if data[cur][6] then
				setPlayerStorageValue(cid, points, getPlayerStorageValue(cid, points) + data[cur][6])
			end
			if data[cur][7] then -- special task (he sends you to kill the boss)
				setPlayerStorageValue(cid, cur + 100, 1)
			end
			setPlayerStorageValue(cid, cur, getPlayerStorageValue(cid, cur) + 1)
			Topic[cid] = 0
		elseif getPlayerStorageValue(cid, cur + 100) == 2 then
			setPlayerStorageValue(cid, points, getPlayerStorageValue(cid, points) + 1)
			selfSay('Fantastic! If you\'re up for another hunting mission just ask me for a {task}.', cid)
			setPlayerStorageValue(cid, cur + 100, -1)
		else
			selfSay(getPlayerStorageValue(cid, cur + 100) < 1 and 'You are not done with your task yet. Come back to me when you are. Or do you want to abort your task to start a different one?' or string.format('Find %s\'s hideout. I hope for you that you are skilled enough to kill him. Or do you want to abort your task to start a different one?', data[cur][7]), cid)
			Topic[cid] = 4
		end
	elseif msgcontains(msg, 'trade') and getPlayerStorageValue(cid, rank) >= 1 then
		local items = {
			{name='antlers', id=11208, sell=50},
			{name='bloody pincers', id=10549, sell=50},
			{name='crab pincers', id=11183, sell=35},
			{name='cyclops toe', id=10573, sell=55},
			{name='frosty ear of a troll', id=10564, sell=30},
			{name='hydra head', id=11193, sell=600},
			{name='lancer leetle shell', id=11366, sell=80},
			{name='mutated bat ear', id=10578, sell=420},
			{name='sabretooth', id=11222, sell=400},
			{name='sandcrawler shell', id=11367, sell=20},
			{name='scarab pincers', id=10547, sell=280},
			{name='terramite legs', id=11365, sell=60},
			{name='terramite shell', id=11363, sell=170},
			{name='terrorbird beak', id=11184, sell=95},
			{name='cyclops trophy', id=7398, sell=500},
			{name='minotaur trophy', id=7401, sell=500},
		}
		if getPlayerStorageValue(cid, rank) >= 3 then
			table.insert(items, {name='deer trophy', id=7397, sell=3000})
			table.insert(items, {name='lion trophy', id=7400, sell=3000})
			table.insert(items, {name='wolf trophy', id=7394, sell=3000})
		end
		if getPlayerStorageValue(cid, rank) >= 4 then
			table.insert(items, {name='behemoth trophy', id=7396, sell=20000})
			table.insert(items, {name='demon trophy', id=7393, sell=40000})
			table.insert(items, {name='dragon lord trophy', id=7399, sell=10000})
			table.insert(items, {name='demon backpack', id=10518, buy=1000})
		end
		openShopWindow(cid, items,
			function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
				customCallbackOnBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks, items)
			end,
			function(cid, itemid, subType, amount, ignoreCap, inBackpacks)
				customCallbackOnSell(cid, itemid, subType, amount, ignoreCap, inBackpacks, items)
			end
		)
		selfSay("Alright, show me what you've got.", cid)
	elseif Topic[cid] == 4 then
		local cur = getPlayerStorageValue(cid, curTask)
		if msgcontains(msg, 'yes') or msgcontains(msg, 'abort') then
			selfSay('Alright, as you wish. Ask me for a task if you are interested in a different hunting mission.', cid)
			setPlayerStorageValue(cid, cur, -1)
			setPlayerStorageValue(cid, curTask, -1)
			if getPlayerStorageValue(cid, cur + 100) > 0 then
				setPlayerStorageValue(cid, cur + 100, -1)
			end
		else
			selfSay(cur == 14006 and string.format('Alright, then stop dilly dallying here and go on with your task. You have already exterminated %u demons. Come back to me when you are done.', getPlayerStorageValue(cid, cur)) or getPlayerStorageValue(cid, cur + 100) < 1 and string.format(data[getPlayerStorageValue(cid, curTask)][3], getPlayerStorageValue(cid, cur)) or 'Alright, then you should go on with your task.', cid)
		end
		Topic[cid] = 0
	elseif Topic[cid] == 1 and msgcontains(msg, 'crocodile') then
		local v = tasks['crocodile']
		selfSay('They are a nuisance! You\'ll find them here in the jungle near the river. Hunt ' .. v.amount .. ' crocodiles and you\'ll get a nice reward. Interested?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 1 and msgcontains(msg, 'tarantula') then
		local v = tasks['tarantula']
		selfSay('There is a veritable plague of tarantulas living in the caves north of the river to the east. Can you squish ' .. v.amount .. ' tarantulas for the Hunting Elite. What do you say?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 1 and msgcontains(msg, 'carniphila') then
		local v = tasks['carniphila']
		selfSay('Damn walking weed-thingies! You\'ll find them deeper in the jungle. Weed out ' .. v.amount .. ' carniphilas for our society. Alright?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 1 and msgcontains(msg, 'golem') then
		local v = tasks['stone golem']
		selfSay('They can be found all over Tibia. You\'ll find them in mountain caves or rocky dungeons. Hunt ' .. v.amount .. ' of them and come back to me. Understood?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 1 and msgcontains(msg, 'mammoth') then
		local v = tasks['mammoth']
		selfSay('This particular species are found in Svargrond. Impressive beasts, but you wouldn\'t want one in your back garden. Hunt ' .. v.amount .. ' of them. Alright?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 2 and msgcontains(msg, 'golem') then
		local v = tasks['ice golem']
		selfSay('The ice golems on the glacier of Hrodmir are becoming a threat to the civilians in Svargrond. Travel to the Ice Islands and hunt ' .. v.amount .. ' Ice Golems. Do you accept this task?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 2 and msgcontains(msg, 'quara') then
		selfSay('There are different types of quaras. The weaker {scouts} which can be found on Malada, one of the shattered Islands and the more skilled {underwater} kind which can be found in Calassa and some smaller colonies. Which one do you wish to hunt?', cid)
		Topic[cid] = 5
	elseif Topic[cid] == 5 and msgcontains(msg, 'scout') then
		local v = tasks['quara constrictor scout']
		selfSay('Good choice! Hunt down those Quara scouts - remember no less than ' .. v.amount .. '! Focus! Do you accept this task?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 5 and msgcontains(msg, 'underwater') then
		local v = tasks['quara constrictor']
		selfSay('As you wish. Seek out a Quara settlement and hunt ' .. v.amount .. ' Quaras, it doesn\'t matter which type you hunt. Alright?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 2 and msgcontains(msg, 'elemental') then
		selfSay({'Since the creation of the elemental shrines and the portals, the curtain separating the worlds is thin, allowing the elementals to surge into our world. They have to be contained. ...', 'The choice as to which kind of elementals you hunt is yours, as long as they are in the lands of Tibia. Hunt 70 {earth}, {energy}, {fire} or {water} elementals. Which one do you choose?'} , cid)
		Topic[cid] = 6
	elseif Topic[cid] == 6 and msgcontains(msg, 'water') then
		local v = tasks['water elemental']
		selfSay('Alright, go hunt ' .. v.amount .. ' water elementals or massive water elementals. Don\'t forget your umbrella! Alright?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 6 and msgcontains(msg, 'earth') then
		local v = tasks['earth elemental']
		selfSay('Good choice! I need you to slay ' .. v.amount .. ' earth elementals or massive earth elementals. There are some in the so called Taboo-area in the eastern jungle of Tiquanda and I heard about a cave in Edron where you\'ll find them. Are you game?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 6 and msgcontains(msg, 'energy') then
		local v = tasks['energy elemental']
		selfSay('A brave hunter! Kill ' .. v.amount .. ' energy elementals or massive energy elementals. You\'ll find them in the mountains between Darama and Tiquanda. Are you sure you want to do this?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 6 and msgcontains(msg, 'fire') then
		local v = tasks['fire elemental']
		selfSay('Don\'t get burnt! Your challenge, should you choose to accept it, is to kill ' .. v.amount .. ' fire elementals or massive fire elementals. Are you ready?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 2 and msgcontains(msg, 'mutated rat') then
		local v = tasks['mutated rat']
		selfSay('Recently, I heard of a disturbing development in Yalahar - a plague of monstrous Mutated rats! If they were to spread to the rest of Tibia.. <shudders> My task for you is to contain their numbers in Yalahar. Hunt ' .. v.amount .. ' of them. What do you say?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 2 and msgcontains(msg, 'giant spider') then
		local v = tasks['giant spider']
		selfSay('Never liked spiders. Entirely too many legs. And I always find them in my bath! Those nasty creepy crawlies are a threat to the hygiene of every living being in Tibia. Hunt ' .. v.amount .. ' of them. Okay?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 3 and msgcontains(msg, 'hydra') then
		local v = tasks['hydra']
		selfSay('The hydras are located in the eastern jungle of Tiquanda and there are several mountain caves that are inhabited by them. Your task is to hunt a mere ' .. v.amount .. ' hydras. Are you willing to do that?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 3 and msgcontains(msg, 'sea serpent') then
		local v = tasks['sea serpent']
		selfSay({'The sea serpents are a threat to honest seafarers! Captain Haba knows where to find them. ...', 'Go to Svargrond and talk to him. ' .. v.amount .. ' sea serpents should be enough to reduce the threat - but not their young though! After all, they are an endangered species! Got it?'}, cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 3 and msgcontains(msg, 'behemoth') then
		local v = tasks['behemoth']
		selfSay('Behemoths must be kept away from the settlements at all costs. You\'ll find them east of here in the taboo-area or under the cyclopolis in Edron. Go there and hunt a few of them - shall we say... ' .. v.amount .. '? Are you up for that?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 3 and msgcontains(msg, 'serpent spawn') then
		local v = tasks['serpent spawn']
		selfSay('Very dangerous, nasty, slimey creatures. They live deep in the old ruins of Banuta. I think a mere ' .. v.amount .. ' serpent spawns should do the trick. What do you say?', cid)
		Topic[cid] = v.storage
	elseif Topic[cid] == 3 and getPlayerStorageValue(cid, rank) == 5 and msgcontains(msg, 'demon') and getPlayerStorageValue(cid, curTask) < 1 then
		local v = tasks['demon']
		selfSay('The spawn of pure evil must be erased from Tibia. You\'ll find demons lurking in the northern ruins of Edron as well as in some of other deeper dungeons of Tibia. We need to wipe them out! Slay ' .. v.amount .. ' demons for the Greater Good!', cid)
		setPlayerStorageValue(cid, curTask, v.storage)
		setPlayerStorageValue(cid, v.storage, 0)
		Topic[cid] = 0
	elseif Topic[cid] >= 14000 and msgcontains(msg, 'yes') then
		selfSay(data[Topic[cid]][2], cid)
		setPlayerStorageValue(cid, curTask, Topic[cid])
		setPlayerStorageValue(cid, Topic[cid], 0)
		if getPlayerStorageValue(cid, questLog) < 1 then
			setPlayerStorageValue(cid, questLog, 1)
			setPlayerStorageValue(cid, points, 0)
		end
		Topic[cid] = 0
	elseif msgcontains(msg, 'special') and getPlayerStorageValue(cid, rank) == 5 then
		local v, k = getPlayerStorageValue(cid, tiquanda), getPlayerStorageValue(cid, demodras)
		if v < 1 then
			if getPlayerLevel(cid) >= 90 then
				setPlayerStorageValue(cid, tiquanda, 1)
				selfSay({'Have you heard about {Tiquandas Revenge}? It is said that the jungle itself is alive and takes revenge for all the bad things people have done to it. ...', 'I myself believe that there is some truth in this clap trap. Something \'real\' which therefore must have a hideout somewhere. Go find it and take revenge yourself! Ask me about the {special} task when you\'re done.'}, cid)
			else
				selfSay('Your eagerness is commendable, and your rank within our hunting elite is great buuuut I\'m afraid you\'re a little bit too weak for the special tasks. Get more experience and the special tasks will be no match for you.', cid)
			end
		elseif v == 2 then
			selfSay('Great achievement, old chap! You are an outstanding hunter, no doubt about it!', cid)
			setPlayerStorageValue(cid, tiquanda, 3)
		elseif v == 3 and k < 1 then
			if getPlayerLevel(cid) >= 100 then
				setPlayerStorageValue(cid, demodras, 1)
				selfSay('This task is a very dangerous one. I want you to look for {Demodras}\' hideout. It might be somewhere under the {Plains of Havoc}. Good luck, old chap, come back in one piece and ask me about the {special} task when you\'re done.', cid)
			else
				selfSay('Your eagerness is commendable, and your rank within our hunting elite is great buuuut I\'m afraid you\'re a little bit too weak for the special tasks. Get more experience and the special tasks will be no match for you.', cid)
			end
		elseif k == 2 then
			selfSay('Great achievement, old chap! You are an outstanding hunter, no doubt about it!', cid)
			setPlayerStorageValue(cid, demodras, 3)
		end
	elseif msgcontains(msg, 'promotion') then
		local cur, r, msg, exp, item = getPlayerStorageValue(cid, points), getPlayerStorageValue(cid, rank)
		if cur >= 5 and r < 1 then
			msg, exp = {'You have completed 5 tasks! Let me promote you to the first rank: Huntsman. Congratulations! ...', 'If you find any trophies that you don\'t need, feel free to ask me for a trade.'}, 5000
		elseif cur >= 10 and r < 2 then
			msg, exp = {'You have completed 10 hunting tasks. It\'s time for a promotion. You advance to the rank of \'Ranger\'. Congratulations! ...', 'Oh, I made a deal with Lorek. He ships Rangers from our society - and higher ranks of course - to Banuta, Chor or near the mountain pass to Darama. Just ask him for a passage.'}, 8000
		elseif cur >= 20 and r < 3 then
			msg, exp = {'Good show! You have completed 20 hunting tasks for the \'Paw and Fur - Hunting Elite. You have earned the right to join the ranks of those known as \'Big game hunter\'. Congratulations! ...', 'From now on I\'ll buy more trophies from you!'}, 10000
		elseif cur >= 30 and r < 4 then
			msg, exp, item = 'Spiffing! You have done 30 hunting tasks! From now on you can call yourself a \'Trophy hunter\'. As a reward I have this special backpack for you and in addition you can sell some more rare trophies to me.', 15000, 10518
		elseif cur >= 50 and r < 5 then
			msg, exp = 'Congratulations! You have made the highest rank: \'Elite hunter\'. If haven\'t yet done so ask me for the {special} task.', 30000
		end
		if msg then
			selfSay(msg, cid)
			setPlayerStorageValue(cid, rank, math.max(1, r + 1))
			if exp then
				doPlayerAddExp(cid, exp)
				doSendAnimatedText(getThingPos(cid), exp, 215)
			end
			if item then
				doPlayerAddItem(cid, item, 1)
			end
		end
	end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_FAREWELL, 'Happy hunting, old chap!')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Happy hunting, old chap!')
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:addModule(FocusModule:new())

Pisze do npc hi ładnie mi odpowiada pisze task wypisuje mi tylko 4 taski chce jakiegoś użyć np. crodile i chuj nie odpisuje na żaden.
 
hmm nawet jak dodałem to niedziała
Code:
local grizzlyAdamsConfig = {
							tasks = { 
									--level 6-49-- 
									['crocodiles'] = {storage = 9999, expe = true, count = 800, count = 300,
											beginStorageValue = 1, finishStorageValue = 2, boss = true, 
											beforeKillBoss = 1, afterKillBoss = 2, talkState = 1}, 
									['tarantulas'] = {storage = 9998, exp = 1500, count = 300,
											beginStorageValue = 3, finishStorageValue = 4, boss = true, 
											beforeKillBoss = 3, afterKillBoss = 4, talkState = 2}, 
									['badgers'] = {storage = 9997, exp = 450, count = 300,
											beginStorageValue = 5, finishStorageValue = 6, talkState = 3}, 
									['carniphilas'] = {storage = 9996, exp = 2500, count = 150,
											beginStorageValue = 7, finishStorageValue = 8, boss = true,
											beforeKillBoss = 5, afterKillBoss = 6, talkState = 4},
									['stone golems'] = {storage = 9995, exp = 2000, count = 200,
											beginStorageValue = 9, finishStorageValue = 10, talkState = 5},
									['mammoths'] = {storage = 9994, exp = 4000, count = 300,
											beginStorageValue = 11, finishStorageValue = 12, boss = true,
											beforeKillBoss = 7, afterKillBoss = 8, talkState = 6},
									['gnarlhounds'] = {storage = 9993, exp = 1000, count = 300,
											beginStorageValue = 13, finishStorageValue = 14, talkState = 7}, 
									['apes'] = {exp = 1000, count = 300,
											beginStorageValue = 15, finishStorageValue = 16, talkState = 8}, 
									['terramites'] = {storage = 9991, exp = 2500, count = 300,
											beginStorageValue = 17, finishStorageValue = 18, talkState = 9}, 
									['thornback tortoises'] = {storage = 9990, exp = 4000, count = 300,
											beginStorageValue = 19, finishStorageValue = 20, talkState = 10}, 
									['gargoyles'] = {storage = 9989, exp = 4000, count = 300,
											beginStorageValue = 21, finishStorageValue = 22, talkState = 11}, 
									
									--level 50-79-- 
									['ice golems'] = {storage = 9988, exp = 15000, count = 300,
											beginStorageValue = 23, finishStorageValue = 24, boss = true, 
											beforeKillBoss = 9, afterKillBoss = 10, talkState = 12}, 
									['quara scouts'] = {exp = 10000, count = 400,
											beginStorageValue = 25, finishStorageValue = 26, talkState = 13}, 
									['mutated rats'] = {storage = 9986, exp = 10000, count = 400,
											beginStorageValue = 27, finishStorageValue = 28, boss = true, 
											beforeKillBoss = 11, afterKillBoss = 12, talkState = 14}, 
									['crystal spiders'] = {storage = 9985, exp = 15000, count = 300,
											beginStorageValue = 29, finishStorageValue = 30, boss = true, 
											beforeKillBoss = 13, afterKillBoss = 14, talkState = 15}, 
									['ancient scarabs'] = {storage = 9984, exp = 15000, count = 250,
											beginStorageValue = 31, finishStorageValue = 32, boss = true, 
											beforeKillBoss = 15, afterKillBoss = 16, talkState = 16}, 
									['wyverns'] = {storage = 9983, exp = 12000, count = 300,
											beginStorageValue = 33, finishStorageValue = 34, talkState = 17}, 
									['lancer beetles'] = {storage = 9982, exp = 8000, count = 300,
											beginStorageValue = 35, finishStorageValue = 36, talkState = 18}, 
									['mutated tigers'] = {storage = 9981, exp = 10000, count = 400,
											beginStorageValue = 37, finishStorageValue = 38, talkState = 19}, 
									['wailing widows'] = {storage = 9980, exp = 12000, count = 400,
											beginStorageValue = 39, finishStorageValue = 40, talkState = 20}, 
									['killer caimans'] = {storage = 9979, exp = 15000, count = 250,
											beginStorageValue = 41, finishStorageValue = 42, talkState = 21}, 
									['bonebeasts'] = {storage = 9978, exp = 12000, count = 300,
											beginStorageValue = 43, finishStorageValue = 44, boss = true, 
											beforeKillBoss = 17, afterKillBoss = 18, talkState = 22}, 
									
									--level 80-129--
									['giant spiders'] = {storage = 9977, exp = 20000, count = 500,
											beginStorageValue = 45, finishStorageValue = 46, boss = true, 
											beforeKillBoss = 19, afterKillBoss = 20, talkState = 23}, 
									['quaras'] = {exp = 10000, count = 600,
											beginStorageValue = 47, finishStorageValue = 48, boss = true, 
											beforeKillBoss = 21, afterKillBoss = 22, talkState = 24}, 
									['werewolves'] = {storage = 9975, exp = 30000, count = 300,
											beginStorageValue = 49, finishStorageValue = 50, talkState = 25}, 
									['nightmares'] = {storage = 9974, exp = 20000, count = 400,
											beginStorageValue = 51, finishStorageValue = 52, talkState = 26}, 
									['hellspawns'] = {storage = 9973, exp = 30000, count = 600,
											beginStorageValue = 53, finishStorageValue = 54, boss = true, 
											beforeKillBoss = 23, afterKillBoss = 24, talkState = 27}, 
									['high class lizards'] = {exp = 30000, count = 800,
											beginStorageValue = 55, finishStorageValue = 56, talkState = 28}, 
									['brimstone bugs'] = {storage = 9971, exp = 15000, count = 500,
											beginStorageValue = 57, finishStorageValue = 58, boss = true, 
											beforeKillBoss = 25, afterKillBoss = 26, talkState = 29}, 
									['mutated bats'] = {storage = 9970, exp = 20000, count = 500,
											beginStorageValue = 59, finishStorageValue = 60, talkState = 30}, 
									--level 130+ -- 
									['hydras'] = {storage = 9969, exp = 30000, count = 650,
											beginStorageValue = 61, finishStorageValue = 62, boss = true, 
											beforeKillBoss = 27, afterKillBoss = 28, talkState = 31}, 
									['sea serpents'] = {exp = 30000, count = 900,
											beginStorageValue = 63, finishStorageValue = 64, boss = true, 
											beforeKillBoss = 29, afterKillBoss = 30, talkState = 32}, 
									['behemoths'] = {storage = 9967, exp = 30000, count = 700,
											beginStorageValue = 65, finishStorageValue = 66, boss = true, 
											beforeKillBoss = 31, afterKillBoss = 32, talkState = 33}, 
									['serpent spawns'] = {storage = 9966, exp = 30000, count = 800,
											beginStorageValue = 67, finishStorageValue = 68, boss = true, 
											beforeKillBoss = 33, afterKillBoss = 34, talkState = 34}, 
									['medusas'] = {storage = 9965, exp = 40000, count = 500,
											beginStorageValue = 69, finishStorageValue = 70, boss = true, 
											beforeKillBoss = 35, afterKillBoss = 36, talkState = 35}, 
									['hellhounds'] = {storage = 9964, exp = 40000, count = 250,
											beginStorageValue = 71, finishStorageValue = 72, boss = true, 
											beforeKillBoss = 37, afterKillBoss = 38, talkState = 36}, 
									['ghastly dragons'] = {storage = 9963, exp = 30000, count = 500,
											beginStorageValue = 73, finishStorageValue = 74, boss = true, 
											beforeKillBoss = 39, afterKillBoss = 40, talkState = 37}, 
									['drakens'] = {monsterStorages = {9931,9930,9929,9928}, exp = 30000, count = 900,
											beginStorageValue = 75, finishStorageValue = 76, talkState = 38}, 
									['destroyers'] = {storage = 9961, exp = 30000, count = 650,
											beginStorageValue = 77, finishStorageValue = 78, talkState = 39}, 
									['undead dragons'] = {storage = 9960, exp = 60000, count = 450,
											beginStorageValue = 79, finishStorageValue = 80, talkState = 40}, 
									['demons'] = {storage = 9959, itemId = 2160, count = 6666,
											beginStorageValue = 81, finishStorageValue = 82, talkState = 41}, 
									},
							specialTask = {		
										--specials--
										['tiquandas revenge'] = 10005,
										['demodras'] = 10006
										},
							storages = {
										main_storage = 10001,
										points_storage = 10002,
										bosses_storage = 10003,
										promote_storage = 10004,
										tiquandas_revenge_storage = 10005,
										demodras_storage = 10006,
										demons_storage = 10007
										},
							messages = {
										goodHunting = {'Happy hunting, old chap! Come back to me when you are through with your {task}.', 'Good show, old chap! Speak to me again when you are done hunting.'},
										goodJob = {'That took some time, huh? Good hunting though. If you\'re up for another hunting mission just ask me for a {task}.', 'If you\'re up for another hunting mission just ask me for a {task}.'}
										},
							rank = { 
									{needPoints = 10, name = 'Huntsman', howManyExp = 5000}, 
									{needPoints = 20, name = 'Ranger', howManyExp = 8000}, 
									{needPoints = 40, name = 'Big Game Hunter', howManyExp = 10000}, 
									{needPoints = 70, name = 'Trophy Hunter', howManyExp = 15000, itemId = 10518}, 
									{needPoints = 100, name = 'Elite Hunter', howManyExp = 30000} 
									},
							ranks = {
									huntsMan_rank = {
													{id=11208, buy=0, sell=50, name='antlers'},
													{id=10549, buy=0, sell=100, name='bloody pincers'},
													{id=12470, buy=0, sell=110, name='colourful feather'},
													{id=11183, buy=0, sell=35, name='crab pincers'},
													{id=10573, buy=0, sell=55, name='cyclops toe'},
													{id=10564, buy=0, sell=30, name='frosty ear of a troll'},
													{id=12495, buy=0, sell=20, name='goblin ear'},
													{id=11193, buy=0, sell=600, name='hydra head'},
													{id=11366, buy=0, sell=80, name='lancer beetle shell'},
													{id=12445, buy=0, sell=280, name='mantassin tail'},
													{id=10578, buy=0, sell=420, name='mutated bat ear'},
													{id=12447, buy=0, sell=500, name='quara bone'},
													{id=12444, buy=0, sell=350, name='quara eye'},
													{id=12446, buy=0, sell=410, name='quara pincer'},
													{id=12443, buy=0, sell=140, name='quara tenracle'},
													{id=11222, buy=0, sell=400, name='sabretooth'},
													{id=11367, buy=0, sell=20, name='sandcrawler shell'},
													{id=10547, buy=0, sell=280, name='scarab pincers'},
													{id=11365, buy=0, sell=60, name='terramite legs'},
													{id=11363, buy=0, sell=170, name='terramite shell'},
													{id=11184, buy=0, sell=30000, name='terrorbird beak'},
													
													{id=7398, buy=0, sell=500, name='cyclops trophy'},
													{id=11315, buy=0, sell=15000, name='draken trophy'},
													{id=11336, buy=0, sell=8000, name='lizard trophy'},
													{id=7401, buy=0, sell=500, name='minotaur trophy'}
													},

									bigGameHunter_rank = {
													{id=7397, buy=0, sell=3000, name='deer trophy'},
													{id=7400, buy=0, sell=3000, name='lion trophy'},
													{id=7394, buy=0, sell=3000, name='wolf trophy'}
													},

									trophyHunter_rank = {
													{id=7393, buy=0, sell=40000, name='demon trophy'},
													{id=7396, buy=0, sell=20000, name='behemoth trophy'},
													{id=7399, buy=0, sell=10000, name='dragon lord trophy'},
													
													{id=10518, buy=1000, sell=0, name='demon backpack'}
													}
									}
							
							}

local function choose(table)
    return table[math.random(#table)]
end

local function doNPCTalkALot(cid, npc, delay, messages)
	for i = 1, #messages do
		addEvent(function()
						if isPlayer(cid) then
							doCreatureSay(npc, messages[i], TALKTYPE_PRIVATE_NP, false, cid)
						end end,
						(i > 1 and 5000*i+delay or delay),
						cid, messages, i)
	end
end

local function setNewTradeTable(table)
local items = {}
for _, v in ipairs(table) do
	items[v.id] = {itemId = v.id, buyPrice = v.buy, sellPrice = v.sell, subType = 0, realName = v.name}
end
return items
end

local function setNewLineTable(oldTable, newTable)
for k, v in pairs(oldTable) do
	table.insert(newTable, k, v)
end
return true
end

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
	return false
end
local message = ''

local points = getPlayerStorageValue(cid, grizzlyAdamsConfig.storages.points_storage)
local bossStorages = getPlayerStorageValue(cid, grizzlyAdamsConfig.storages.bosses_storage)
local rankStorage = getPlayerStorageValue(cid, grizzlyAdamsConfig.storages.promote_storage)	
local mainStorage = getPlayerStorageValue(cid, grizzlyAdamsConfig.storages.main_storage)
if msg:lower() == 'join' and mainStorage == -1 then
	talkState[cid] = 200
	return doNPCTalkALot(cid, getNpcCid(), 200, {'Do you want join to \'Paw and Fur - Hunting Elite\'?'})
elseif msg:lower() == 'promotion' and mainStorage > -1 then
	for i = #grizzlyAdamsConfig.rank, 1, -1 do
		local v = grizzlyAdamsConfig.rank[i]
		if points >= v.needPoints and rankStorage < i then
			doPlayerAddExp(cid, v.howManyExp)
			doSendAnimatedText(getThingPos(cid), v.howManyExp, TEXTCOLOR_WHITE)
			doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.promote_storage, i)
			if i == 1 then
				doNPCTalkALot(cid, getNpcCid(), 200, {'You have completed 10 tasks! Let me promote you to the first rank: {Huntsman}. Congratulations! ...', 'If you find any trophies that you don\'t need, feel free to ask me for a {trade}.'})
			elseif i == 2 then
				doNPCTalkALot(cid, getNpcCid(), 200, {'You have completed 20 hunting tasks. It\'s time for a promotion. You advance to the rank of {Ranger}. Congratulations! ...', 'Oh, I made a deal with Lorek. He ships Rangers from our society - and higher ranks of course - to Banuta, Chor or near the mountain pass to Darama. Just ask him for a passage.'})
			elseif i == 3 then
				doNPCTalkALot(cid, getNpcCid(), 200, {'Good show! You have completed 40 hunting tasks for the \'Paw and Fur - Hunting Elite\'. You have earned the right to join the ranks of those known as {Big game} {hunter}. Congratulations! ...', 'From now on I\'ll buy more trophies from you!'})
			elseif i == 4 then
				doNPCTalkALot(cid, getNpcCid(), 200, {'Spiffing! You have done 70 hunting tasks! From now on you can call yourself a {Trophy hunter}. As a reward I have this special backpack for you and in addition you can sell some more rare trophies to me.'})
				if v.itemId then
					doPlayerAddItem(cid, v.itemId, 1)
				end
			elseif i == 5 then
				doNPCTalkALot(cid, getNpcCid(), 200, {'Congratulations! You have made the highest rank: {Elite hunter}. If haven\'t yet done so ask me for the {special task}.'})
			end
			return true
		end
	end
elseif msg:lower() == 'rank' and mainStorage > -1 then
	if isInArray({-1,0}, rankStorage) then
		message = {'You don\'t have any rank. You have '..points..' points. On \'Huntsman\' rank you need '.. 10 - points ..' points.'}
	else
		message = {'Your actualy rank is '..grizzlyAdamsConfig.rank[rankStorage].name..'. You have '..points..' points. '..(rankStorage < 5 and 'On next level you need '..grizzlyAdamsConfig.rank[rankStorage+1].needPoints - points..' points.' or '')}
	end
	return doNPCTalkALot(cid, getNpcCid(), 200, message)
elseif isInArray({'trade','offer'}, msg:lower()) and mainStorage > -1 then
	if isInArray({1,2,3,4,5}, rankStorage) then
		if isInArray({1,2}, rankStorage) then
			tradeRank = grizzlyAdamsConfig.ranks.huntsMan_rank
		elseif isInArray({3}, rankStorage) then
			tradeRank = grizzlyAdamsConfig.ranks.bigGameHunter_rank
			setNewLineTable(grizzlyAdamsConfig.ranks.huntsMan_rank, grizzlyAdamsConfig.ranks.bigGameHunter_rank)
		elseif isInArray({4,5}, rankStorage) then
			tradeRank = grizzlyAdamsConfig.ranks.trophyHunter_rank
			setNewLineTable(grizzlyAdamsConfig.ranks.huntsMan_rank, grizzlyAdamsConfig.ranks.bigGameHunter_rank)
			setNewLineTable(grizzlyAdamsConfig.ranks.huntsMan_rank, grizzlyAdamsConfig.ranks.trophyHunter_rank)
		end
		local items = setNewTradeTable(tradeRank)
			local function onBuy(cid, item, subType, amount, ignoreCap, inBackpacks)
			if ignoreCap == false and (getPlayerFreeCap(cid) < getItemWeightById(items[item].itemId, amount) or inBackpacks and getPlayerFreeCap(cid) < (getItemWeightById(items[item].itemId, amount) + getItemWeightById(1988, 1))) then
				return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You don\'t have enough cap.')
			end
			if items[item].buyPrice then
				doPlayerRemoveMoney(cid, amount * items[item].buyPrice)
				for i = 1, amount do
					if inBackpacks then
						local backpack = doCreateItemEx(1988, 1)
						doAddContainerItem(backpack, items[item].itemId, amount)
					else
						doPlayerAddItem(cid, items[item].itemId, amount, true)
					end
				end
				return doNPCTalkALot(cid, getNpcCid(), 200, {'You bought '..amount..'x '..items[item].realName..' for '..items[item].buyPrice * amount..' gold coins.'})
			end
			return true
			end
			 
			local function onSell(cid, item, subType, amount, ignoreCap, inBackpacks)
			if items[item].sellPrice then
				doPlayerAddMoney(cid, items[item].sellPrice * amount)
				doPlayerRemoveItem(cid, items[item].itemId, amount)
				return doNPCTalkALot(cid, getNpcCid(), 200, {'You sell '..amount..'x '..items[item].realName..' for '..items[item].sellPrice * amount..' gold coins.'})
			end
			return true
			end
		openShopWindow(cid, tradeRank, onBuy, onSell)
		return doNPCTalkALot(cid, getNpcCid(), 200, {'It\'s my offer.'})
	else
		return doNPCTalkALot(cid, getNpcCid(), 200, {'You don\'t have any rank.'})
	end
elseif msg:lower() == 'cancel' and mainStorage > -1 then
	if mainStorage > 0 then
		talkState[cid] = 201
		message = {'Do you want cancel actual mission?'}
	else
		message = {'You do not started any {task}.'}
	end
	return doNPCTalkALot(cid, getNpcCid(), 200, message)
elseif isInArray({'yes','ok','alright','yep'}, msg:lower()) and isInArray({200,201,150}, talkState[cid]) then
	if talkState[cid] == 201 then
		for _, v in pairs(grizzlyAdamsConfig.tasks) do
			if mainStorage == v.beginStorageValue then
				if v.monsterStorages then
					for i = 1, #v.monsterStorages do
						doPlayerSetStorageValue(cid, v.monsterStorages[i], 0)
					end
				end
				doPlayerSetStorageValue(cid, v.storage, 0)
			end
		end
		message = {'Speak to me again when you are done hunting.'}
	elseif talkState[cid] == 200 then
		doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.promote_storage, 0)
		doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.points_storage, 0)
		message = {'Congratulations, you are now a member of \'Paw and Fur - Hunting Elite\'.'}
	elseif talkState[cid] == 150 then
		
	end
	doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.bosses_storage, 0)
	doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.main_storage, 0)
	return doNPCTalkALot(cid, getNpcCid(), 200, message)
elseif isInArray({'task','mission'}, msg:lower()) and mainStorage > -1 then
	if mainStorage == 0 and bossStorages == 0 then 
		for i = #grizzlyAdamsConfig.rank, 1, -1 do
			if points >= grizzlyAdamsConfig.rank[i].needPoints and rankStorage < i then
				return doNPCTalkALot(cid, getNpcCid(), 200, {'You are ready to advance one rank in our society Darly. Ask me for a promotion first.'})
			end
		end
		if (getPlayerLevel(cid) >= 6 and getPlayerLevel(cid) <= 49) then
			message = {'All right, what would you like to hunt? {Crocodiles}, {tarantulas}, {badgers}, {gnarlhounds}, {apes}, {terramites}, {thornback tortoises}, {gargoyles}, {carniphilas}, {stone golems} or {mammoths}?'}
			talkState[cid] = 300
		elseif (getPlayerLevel(cid) >= 50 and getPlayerLevel(cid) <= 79) then
			message = {'All right, what would you like to hunt? {Ice golems}, {quara scouts}, {mutated rats}, {crystal spiders}, {ancient scarabs}, {wyverns}, {lancer beetles}, {mutated tigers}, {wailing widows}, {killer caimans} or {bonebeasts}?'}
			talkState[cid] = 301
		elseif (getPlayerLevel(cid) >= 80 and getPlayerLevel(cid) <= 129) then
			message = {'All right, what would you like to hunt? {Giant spiders}, {quaras}, {werewolves}, {nightmares}, {hellspawns}, {high class lizards}, {brimstone bugs} or {mutated bats}?'}
			talkState[cid] = 302
		elseif (getPlayerLevel(cid) >= 130) then
			message = {'All right, what would you like to hunt? {Hydras}, {sea serpents}, {behemoths}, {medusas}, {hellhounds}, {ghastly dragons}, {undead dragons}, {drakens}, {destroyers} '..(rankStorage == 5 and ', {serpent spawns} or {demons}' or 'or {serpent spawns}')..'?'}
			talkState[cid] = 303
		end
		return doNPCTalkALot(cid, getNpcCid(), 200, message)
	end
elseif isInArray({'special task','special'}, msg:lower()) then
	if rankStorage == 5 and getPlayerLevel(cid) >= 130 then
		for k, v in pairs(grizzlyAdamsConfig.specialTask) do
			if isInArray({'tiquandas revenge','demodras'}, k:lower()) and getPlayerStorageValue(cid, v) < 2 then
				if getPlayerStorageValue(cid, v) == -1 then
					doPlayerSetStorageValue(cid, v, 0)
					return doNPCTalkALot(cid, getNpcCid(), 200, (k:lower() == 'tiquandas revenge' and {'Have you heared about Tiquandas Revenge? It is said that the jungle itself is alive and takes revenge for all the bad things people have done to it. ...', 'I myself believe that there is some truth in this clap trap. Something \'real\' which therefore must have a hideout somewhere. Go find it and take revenge yourself! Ask me about the special task when you\'re done.'} or {'Go kill '..k..'.'}))
				elseif getPlayerStorageValue(cid, v) == 0 then
					return doNPCTalkALot(cid, getNpcCid(), 200, {'You don\'t kill '..k..' yet. Come back when you killed him.'})
				elseif getPlayerStorageValue(cid, v) == 1 then
					doPlayerSetStorageValue(cid, v, 2)
					return doNPCTalkALot(cid, getNpcCid(), 200, {'Amazing! You did it! Good job.'})
				end
			end
		end
	end
	return doNPCTalkALot(cid, getNpcCid(), 200, {'You are an eager one. Your rank within our hunting elite is great buuuut I believe you\'re a little inexperienced for the special tasks. Gain more experience and then you will be equal to the special task! I don\'t want to send you to your death!'})
end
for k, v in pairs(grizzlyAdamsConfig.tasks) do
	if msg:lower() == k then
		if talkState[cid] == 300 then
			if k == 'carniphilas' then
				message = {'Damn walking weed-thingies! You\'ll find them deeper in the jungle. Weed out {'..v.count..' '..k..'} for our society. Alright?'}
			elseif k == 'crocodiles' then
				message = {'They are a nuisance! You\'ll find them here in the jungle near the river. Hunt {'..v.count..' '..k..'} and you\'ll get a nice reward. Interested?'}
			elseif k == 'stone golems' then
				message = {'They can be found all over Tibia. You\'ll find them in mountain caves or rocky dungeons. Hunt {'..v.count..'} of them and come back to me. Understood?'}
			elseif k == 'mammoths' then
				message = {'This particular species are found in Svargrond. Impressive beasts, but you wouldn\'t want one in your back garden. Hunt {'..v.count..'} of them. Alright?'}
			else
				message = {'Do you want kill {'..v.count..' '..k..'?}'}
			end
		elseif talkState[cid] == 301 then
			if k == 'ice golems' then
				message = {'The ice golems on the glacier of Hrodmir are becoming a threat to the civilians in Svargrond. Travel to the Ice Islands and hunt {'..v.count..' '..k..'}. Do you accept this task?'}
			elseif k == 'quaras' then
				message = {'As you wish. Seek out a Quara settlement and hunt '..v.count..' '..k..', it doesn\'t matter which type you hunt. Alright?'}
			elseif k == 'mutated rats' then
				message = {'Recently, I heard of a disturbing development in Yalahar - a plague of monstrous Mutated rats! If they were to spread to the rest of Tibia.. <shudders> My task for you is to contain their numbers in Yalahar. Hunt {'..v.count..'} of them. What do you say?'}
			elseif k == 'giant spiders' then
				message = {'Never liked spiders. Entirely too many legs. And I always find them in my bath! Those nasty creepy crawlies are a threat to the hygiene of every living being in Tibia. Hunt {'..v.count..'} of them. Okay?'}
			else
				message = {'Do you want kill {'..v.count..' '..k..'?}'}
			end
		elseif isInArray({302,303}, talkState[cid]) then
			if talkState[cid] == 303 and k:lower() == 'demons' then
				message = {'The spawn of pure evil must be erased from Tibia. You\'ll find demons lurking in the northern ruins of Edron as well as in some of other deeper dungeons of Tibia. Slay 6666 demons for the Greater Good! Do you think you can handle this task?'}
			else
				message = {'Do you want kill {'..v.count..' '..k..'?}'}
			end
		end
		talkState[cid] = v.talkState
		return doNPCTalkALot(cid, getNpcCid(), 200, message)
	elseif isInArray({'yes','ok','alright','yep'}, msg:lower()) and talkState[cid] == v.talkState and mainStorage == 0 then 
        doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.main_storage, v.beginStorageValue)
        doPlayerSetStorageValue(cid, v.storage, 0)
        return doNPCTalkALot(cid, getNpcCid(), 200, {choose(grizzlyAdamsConfig.messages.goodHunting)})
	elseif msgcontains(msg, 'task') then 
        if mainStorage == v.finishStorageValue and bossStorages == 0 then 
            if v.boss then 
                doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.bosses_storage, v.beforeKillBoss) 
                doPlayerSetStorageValue(cid, v.storage, 0) 
                return doNPCTalkALot(cid, getNpcCid(), 200, {'Good job. Now you can kill boss of '..k..'.'}) 
            else
                if v.exp then 
                    doPlayerAddExp(cid, v.exp) 
                    doSendAnimatedText(getThingPos(cid), v.exp, TEXTCOLOR_WHITE) 
                end 
                doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.main_storage, 0)
                doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.bosses_storage, 0)
                doPlayerSetStorageValue(cid, v.storage, 0)
				if v.itemId then doPlayerAddItem(cid, v.itemId, 1, true) end
                return doNPCTalkALot(cid, getNpcCid(), 200, {choose(grizzlyAdamsConfig.messages.goodJob)}) 
            end 
        elseif bossStorages == v.afterKillBoss then 
            if v.exp then 
				doPlayerAddExp(cid, v.exp) 
				doSendAnimatedText(getThingPos(cid), v.exp, TEXTCOLOR_WHITE) 
			end 
			doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.main_storage, 0) 
            doPlayerSetStorageValue(cid, grizzlyAdamsConfig.storages.bosses_storage, 0) 
            doPlayerSetStorageValue(cid, v.storage, 0)
            return doNPCTalkALot(cid, getNpcCid(), 200, {choose(grizzlyAdamsConfig.messages.goodJob)}) 
        elseif bossStorages == v.beforeKillBoss then 
            return doNPCTalkALot(cid, getNpcCid(), 200, {'You do not kill boss of '..k..' yet.'}) 
        end 
    elseif msgcontains(msg, 'no') and talkState[cid] > 0 then  
        return doNPCTalkALot(cid, getNpcCid(), 200, {'Ok then.'}) 
    end
end
return true
end

npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye |PLAYERNAME|!')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Bye then...')
npcHandler:setMessage(MESSAGE_GREET, 'Welcome back |PLAYERNAME|. What brings you here this time?')
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
to czemu nie spytacie o to autora skryptu tylko tutaj spamicie? >.<

Napiszcie własny system, a tak to pytajcie o taki w temacie autora.
 
Przeczytaj najpierw skrypt i sprawdź czy w twoja tablica taska aby na pewno jest dobrze napisana.
Brakuje wartości amount.
 
Back
Top