• 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!

CreatureEvent NPC Grizzly Adams - almost how RL Tibia.

HAHA, is crasy, i tryed to made this another time, but doenst works, but now it works!

realy thx Oscar1121! Great Work bro!

For those who want to use in newer tfs versions, just change the doNPCTalkALot to SelfSay!

Thank you!
 
Refresh.
Here is better function doNPCTalkALot:
PHP:
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,
						delay * i,
						cid, messages, i)
	end
end
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)			npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)		npcHandler:onCreatureDisappear(cid)			end
why do you have this twice in the code?
 
When I say "monster" then npc says: "Do you want to kill '..x monsters..'"
Then I say like: "2000 hydras" or "2000 behemoths" or another one and he doesn't answer.
Is there someone to help me?

PS: I have already joined Paw and Fur Society
 
@kudzu1988
add this function to your data/lib/function.lua

PHP:
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,
                        delay * i,
                        cid, messages, i)
    end
end
 
Look good,Grizzly Adams lua:
PHP:
if mainStorage == v.finish_storage_value and isInArray({-1,0}, bossStorages) then
 
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 storages = {
				main_storage = 10001,
				points_storage = 10002,
				bosses_storage = 10003,
				promote_storage = 10004,
				demodras_storage = 10005,
				tiquandas_revenge_storage = 10006,
				demons_storage = 10007
				}
local mainStorage,bossStorages,points,promote = getPlayerStorageValue(cid, storages.main_storage),getPlayerStorageValue(cid, storages.bosses_storage),getPlayerStorageValue(cid, storages.points_storage),getPlayerStorageValue(cid, storages.promote_storage)
local msgss = ''
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local good_hunting = {'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.'}	
local good_job = {'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}.'}
local huntsMan_rank = {
					{id=11208, buy=0, sell=50, name='antlers'},
					{id=10549, buy=0, sell=100, name='bloody pincers'},
					{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=11193, buy=0, sell=600, name='hydra head'},
					{id=11366, buy=0, sell=80, name='lancer beetle shell'},
					{id=10578, buy=0, sell=420, name='mutated bat ear'},
					{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=7401, buy=0, sell=500, name='minotaur trophy'}
					}

local 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'}
					}
for k,v in pairs(huntsMan_rank) do
	table.insert(bigGameHunter_rank, k, v)
end

local trophyHunter_rank = {
					{id=7396, buy=0, sell=20000, name='behemoth trophy'},
					{id=7393, buy=0, sell=40000, name='demon trophy'},
					{id=7399, buy=0, sell=10000, name='dragon lord trophy'},
					
					{id=10518, buy=1000, sell=0, name='demon backpack'}
					}
for k,v in pairs(bigGameHunter_rank) do
	table.insert(trophyHunter_rank, k, v)
end

local items = {}
for _, item in ipairs(huntsMan_rank) do
	items[item.id] = {storage = item.storage, item_id = item.id, buyPrice = item.buy, sellPrice = item.sell, subType = 0, realName = item.name}
end

local items = {}
for _, item in ipairs(bigGameHunter_rank) do
	items[item.id] = {storage = item.storage, item_id = item.id, buyPrice = item.buy, sellPrice = item.sell, subType = 0, realName = item.name}
end

local items = {}
for _, item in ipairs(trophyHunter_rank) do
	items[item.id] = {storage = item.storage, item_id = item.id, buyPrice = item.buy, sellPrice = item.sell, subType = 0, realName = item.name}
end

local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
	if items[item].buyPrice ~= 0 then
		doPlayerRemoveMoney(cid, amount * items[item].buyPrice)
		for i = 1, amount do
			doPlayerAddItem(cid, items[item].item_id, amount)
		end
		doNPCTalkALot(cid, 200, {'You bought '..amount..' '..items[item].realName..' for '..items[item].buyPrice * amount..' gold coins.'})
	end
end
 
local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)
	if items[item].sellPrice ~= 0 then
		doPlayerAddMoney(cid, items[item].sellPrice * amount)
		doPlayerRemoveItem(cid, items[item].item_id, amount)
		doNPCTalkALot(cid, 200, {'You sell '..amount..' '..items[item].realName..' for '..items[item].sellPrice * amount..' gold coins.'})
	end
end
local tasks = {
			--level 5-49--
			['carniphilas'] = {storage = 9999, mob_storage = 19999, expe = 'yes', how_many = 1500,
					begin_storage_value = 1, finish_storage_value = 2, talkstate = 1},
			['crocodiles'] = {storage = 9998, mob_storage = 19998, expe = 'yes', how_many = 800,
					begin_storage_value = 3, finish_storage_value = 4, boss = 'yes',
					before_kill_boss = 1, after_kill_boss = 2, talkstate = 2},
			['tarantulas'] = {storage = 9997, mob_storage = 19997, expe = 'yes', how_many = 1500,
					begin_storage_value = 5, finish_storage_value = 6, boss = 'yes',
					before_kill_boss = 3, after_kill_boss = 4, talkstate = 3},
			['stone golems'] = {storage = 9996, mob_storage = 19996, expe = 'yes', how_many = 2000,
					begin_storage_value = 7, finish_storage_value = 8, talkstate = 4},
			['mammoths'] = {storage = 9995, mob_storage = 19995, expe = 'yes', how_many = 4000,
					begin_storage_value = 9, finish_storage_value = 10, boss = 'yes',
					before_kill_boss = 5, after_kill_boss = 6, talkstate = 5},
			--level 50-89--
			['ice golems'] = {storage = 9994, mob_storage = 19994, expe = 'yes', how_many = 15000,
					begin_storage_value = 11, finish_storage_value = 12, boss = 'yes',
					before_kill_boss = 7, after_kill_boss = 8, talkstate = 6},
			['quara'] = {talkstate = 49},
			['elementals'] = {talkstate = 48},
			
			['mutated rats'] = {storage = 9987, mob_storage = 19975, expe = 'yes', how_many = 10000,
					begin_storage_value = 13, finish_storage_value = 14, boss = 'yes',
					before_kill_boss = 9, after_kill_boss = 10, talkstate = 7},
			['giant spiders'] = {storage = 9986, mob_storage = 19974, expe = 'yes', how_many = 5000,
					begin_storage_value = 15, finish_storage_value = 16, boss = 'yes',
					before_kill_boss = 11, after_kill_boss = 12, talkstate = 8},
			--level 90+ --
			['hydras'] = {storage = 9985, mob_storage = 19973,
					begin_storage_value = 17, finish_storage_value = 18, boss = 'yes',
					before_kill_boss = 13, after_kill_boss = 14, talkstate = 9},
			['sea serpents'] = {storage = 9984, mob_storage = 19972,
					begin_storage_value = 19, finish_storage_value = 20, boss = 'yes',
					before_kill_boss = 15, after_kill_boss = 16, talkstate = 10},
			['behemoths'] = {storage = 9983, mob_storage = 19971,
					begin_storage_value = 21, finish_storage_value = 22, boss = 'yes',
					before_kill_boss = 17, after_kill_boss = 18, talkstate = 11},
			['serpent spawns'] = {storage = 9982, mob_storage = 19970,
					begin_storage_value = 23, finish_storage_value = 24, boss = 'yes',
					before_kill_boss = 19, after_kill_boss = 20, talkstate = 12},
			--quaras
			['quaras'] = {storage = 9992, expe = 'yes', how_many = 12000,
					begin_storage_value = 24, finish_storage_value = 25, boss = 'yes',
					before_kill_boss = 21, after_kill_boss = 22, talkstate = 13},
			['quara scouts'] = {storage = 9993, expe = 'yes', how_many = 10000,
					begin_storage_value = 26, finish_storage_value = 27, talkstate = 14},
			--elementals--
			['fire'] = {storage = 9991, expe = 'yes', how_many = 7000,
					begin_storage_value = 28, finish_storage_value = 29, talkstate = 15},
			['water'] = {storage = 9990, expe = 'yes', how_many = 7000,
					begin_storage_value = 30, finish_storage_value = 31, talkstate = 16},
			['earth'] = {storage = 9989, expe = 'yes', how_many = 10000,
					begin_storage_value = 32, finish_storage_value = 33, talkstate = 17},
			['energy'] = {storage = 9988, expe = 'yes', how_many = 10000,
					begin_storage_value = 34, finish_storage_value = 35, talkstate = 18}
			}
local rank = {
			[1] = {need_points = 5, name = 'Huntsman', storage_value = 0, talkstate = 50},
			[2] = {need_points = 10, name = 'Ranger', storage_value = 1, talkstate = 51},
			[3] = {need_points = 20, name = 'Big Game Hunter', storage_value = 2, talkstate = 52},
			[4] = {need_points = 30, name = 'Trophy Hunter', storage_value = 3, talkstate = 53},
			[5] = {need_points = 50, name = 'Elite Hunter', storage_value = 4, talkstate = 54}
			}
local promotion = {
				[1] = {talktype = 50, how_many_exp = 5000, finish_storage_values = 1},
				[2] = {talktype = 51, how_many_exp = 8000, finish_storage_values = 2},
				[3] = {talktype = 52, how_many_exp = 10000, finish_storage_values = 3},
				[4] = {talktype = 53, how_many_exp = 15000, item = 'yes', what = 10518, count = 1, finish_storage_values = 4},
				[5] = {talktype = 54, how_many_exp = 30000, finish_storage_values = 5}
				}
if msgcontains(msg, 'join') and mainStorage == -1 then
	talkState[talkUser] = 104
	return doNPCTalkALot(cid, 200, {'Do you want join to \'Paw and Fur - Hunting Elite\'?'})
elseif msgcontains(msg, 'special task') then
	if promote == 5 then
		if getPlayerLevel(cid) >= 90 then
			if getPlayerStorageValue(cid, storages.tiquandas_revenge_storage) == -1 then
				doNPCTalkALot(cid, 200, {'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. ...'})
				doNPCTalkALot(cid, 10000, {'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.'})
				return doPlayerSetStorageValue(cid, storages.tiquandas_revenge_storage, 0)
			elseif getPlayerStorageValue(cid, storages.tiquandas_revenge_storage) == 1 then
				doPlayerSetStorageValue(cid, storages.tiquandas_revenge_storage, 2)
				return doNPCTalkALot(cid, 200, {'Great accievement, old chap! You are an outstanding hunter, no doubt about it!'})
			end
		else
			return doNPCTalkALot(cid, 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
		if getPlayerLevel(cid) >= 100 then
			if getPlayerStorageValue(cid, storages.tiquandas_revenge_storage) == 2 then
				if getPlayerStorageValue(cid, storages.demodras_storage) == -1 then
					doPlayerSetStorageValue(cid, storages.demodras_storage, 0)
					return doNPCTalkALot(cid, 200, {'Go kill Demodras.'})
				elseif getPlayerStorageValue(cid, storages.demodras_storage) == 1 then
					doPlayerSetStorageValue(cid, storages.demodras_storage, 2)
					return doNPCTalkALot(cid, 200, {'Good job.'})
				end
			end
			if getPlayerStorageValue(cid, storages.demodras_storage) == 2 then
				if getPlayerStorageValue(cid, storages.demons_storage) == -1 then
					doPlayerSetStorageValue(cid, storages.demons_storage, 0)
					doPlayerSetStorageValue(cid, 9981, 0)
					doPlayerSetStorageValue(cid, storages.main_storage, 36)
					return doNPCTalkALot(cid, 200, {'Go kill 6666 Demons.'})
				elseif getPlayerStorageValue(cid, storages.demons_storage) == 1 and getPlayerStorageValue(cid, storages.main_storage) == 37 then
					doPlayerSetStorageValue(cid, storages.demons_storage, 2)
					doPlayerSetStorageValue(cid, storages.main_storage, 0)
					return doNPCTalkALot(cid, 200, {'Amazing! You kill all 6666 dmeons!'})
				end
			end
		else
			return doNPCTalkALot(cid, 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
	end
elseif msgcontains(msg, 'trade') or msgcontains(msg, 'offer') then
	if isInArray({1,2,3,4,5}, promote) then
		if isInArray({1,2}, promote) then
			openShopWindow(cid, huntsMan_rank, onBuy, onSell)
		elseif isInArray({3}, promote) then
			openShopWindow(cid, bigGameHunter_rank, onBuy, onSell)
		elseif isInArray({4,5}, promote) then
			openShopWindow(cid, trophyHunter_rank, onBuy, onSell)
		end
		return doNPCTalkALot(cid, 200, {'It\'s my offer.'})
	else
		return doNPCTalkALot(cid, 200, {'You don\'t have any rank.'})
	end
elseif msgcontains(msg, 'cancel') then
	if mainStorage > 0 then
		if bossStorages <= 0 then
			if isInArray({36,37}, mainStorage) == false then
				talkState[talkUser] = 103
				msgss = {'Do you want cancel actual mission?'}
			end
		else
			msgss = {'Now you must defeat boss.'}
		end
	else
		msgss = {'You do not started any {task}.'}
	end
	return doNPCTalkALot(cid, 200, msgss)
elseif msgcontains(msg, 'yes') then
	if talkState[talkUser] == 103 then
		for k, v in pairs(tasks) do
			if isInArray({0,1}, getPlayerStorageValue(cid, v.storage)) then
				doPlayerSetStorageValue(cid, v.storage, -1)
			end
		end
		doPlayerSetStorageValue(cid, storages.main_storage, 0)
		doPlayerSetStorageValue(cid, storages.bosses_storage, 0)
		return doNPCTalkALot(cid, 200, {'Speak to me again when you are done hunting.'})
	elseif talkState[talkUser] == 104 and promote == -1 then
		doPlayerSetStorageValue(cid, storages.promote_storage, 0)
		doPlayerSetStorageValue(cid, storages.main_storage, 0)
		doPlayerSetStorageValue(cid, storages.points_storage, 0)
		return doNPCTalkALot(cid, 200, {'Congratulations, you are now a member of \'Paw and Fur - Hunting Elite\'.'})
	end
elseif msgcontains(msg, 'task') then
	if mainStorage == 0 and isInArray({-1,0}, bossStorages) then 
		if (getPlayerLevel(cid) > 5 and getPlayerLevel(cid) < 50) then
			msgss = {'All right, what would you like to hunt? {Crocodiles}, {tarantulas}, {carniphilas}, {stone golems} or {mammoths}?'}
			talkState[talkUser] = 100
		elseif (getPlayerLevel(cid) > 49 and getPlayerLevel(cid) < 90) then
			msgss = {'All right, what would you like to hunt? {Ice golems}, {quara}, {elementals}, {mutated rats} or {giant spiders}?'}
			talkState[talkUser] = 101
		elseif (getPlayerLevel(cid) > 89) then
			msgss = {'All right, what would you like to hunt? {Hydras}, {sea serpents}, {behemoths} or {serpent spawns}?'}
			talkState[talkUser] = 102
		end
		return doNPCTalkALot(cid, 200, msgss)
	end
end
local v = tasks[msg:lower()]
	if v then
		if talkState[talkUser] == 100 then
			if msg:lower() == 'carniphilas' then
				msgss = {'Damn walking weed-thingies! You\'ll find them deeper in the jungle. Weed out {150 '..msg:lower()..'} for our society. Alright?'}
			elseif msg:lower() == 'crocodiles' then
				msgss = {'They are a nuisance! You\'ll find them here in the jungle near the river. Hunt {300 '..msg:lower()..'} and you\'ll get a nice reward. Interested?'}
			elseif msg:lower() == 'tarantulas' then
				msgss = {'Do you want kill {300 tarantulas?}'}
			elseif msg:lower() == 'stone golems' then
				msgss = {'They can be found all over Tibia. You\'ll find them in mountain caves or rocky dungeons. Hunt {200} of them and come back to me. Understood?'}
			elseif msg:lower() == 'mammoths' then
				msgss = {'This particular species are found in Svargrond. Impressive beasts, but you wouldn\'t want one in your back garden. Hunt {300} of them. Alright?'}
			end
		elseif talkState[talkUser] == 101 then
			if msg:lower() == 'ice golems' then
				msgss = {'The ice golems on the glacier of Hrodmir are becoming a threat to the civilians in Svargrond. Travel to the Ice Islands and hunt {300 '..msg:lower()..'}. Do you accept this task?'}
			elseif msg:lower() == 'quara' then
				msgss = {'What do you want, {quaras} or {quara scouts?}'}
			elseif msg:lower() == 'elementals' then
				msgss = {'What do you want, {fire}, {water}, {earth} or {energy?}'}
			elseif msg:lower() == 'mutated rats' then
				msgss = {'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 {200} of them. What do you say?'}
			elseif msg:lower() == 'giant spiders' then
				msgss = {'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 {500} of them. Okay?'}
			end
		elseif talkState[talkUser] == 102 then
			if msg:lower() == 'hydras' then
				msgss = {'Do you want kill {2000 '..msg:lower()..'?}'}
			elseif msg:lower() == 'sea serpents' then
				msgss = {'Do you want kill {2000 '..msg:lower()..'?}'}
			elseif msg:lower() == 'behemoths' then
				msgss = {'Do you want kill {2000 '..msg:lower()..'?}'}
			elseif msg:lower() == 'serpent spawns' then
				msgss = {'Do you want kill {1500 '..msg:lower()..'?}'}
			end
		elseif talkState[talkUser] == 49 then
			if msg:lower() == 'quaras' then
				msgss = {'Do you want kill {300 '..msg:lower()..'?}'}
			elseif msg:lower() == 'quara scouts' then
				msgss = {'Do you want kill {300 '..msg:lower()..'?}'}
			end
		elseif talkState[talkUser] == 48 then
			if msg:lower() == 'fire' then
				msgss = {'Don\'t get burnt! Your challenge, should you choose to accept it, is to kill {70 fire elementals or massive fire elementals}. Are you ready?'}
			elseif msg:lower() == 'water' then
				msgss = {'Alright, go hunt {70 water elementals or massive water elementals}. Don\'t forget your umbrella! Alright?'}
			elseif msg:lower() == 'earth' then
				msgss = {'Good choice! I need you to slay {70 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?'}
			elseif msg:lower() == 'energy' then
				msgss = {'A brave hunter! Kill {70 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?'}
			end
		end
		talkState[talkUser] = v.talkstate
		return doNPCTalkALot(cid, 200, msgss)
	elseif msgcontains(msg, 'yes') and talkState[talkUser] == v.talkstate and mainStorage == 0 then
		if isInArray({100,101,102}, talkState[talkUser]) then
			doPlayerSetStorageValue(cid, v.mob_storage, 0)
		end
		doPlayerSetStorageValue(cid, storages.main_storage, v.begin_storage_value)
		doPlayerSetStorageValue(cid, v.storage, 0)
		return doNPCTalkALot(cid, 200, {good_hunting[math.random(1, #good_hunting)]})
	elseif msgcontains(msg, 'task') then
		if mainStorage == v.finish_storage_value and isInArray({-1,0}, bossStorages) then
			if v.boss == 'yes' then
				doPlayerSetStorageValue(cid, storages.bosses_storage, v.before_kill_boss)
				doPlayerSetStorageValue(cid, v.storage, 2)
				return doNPCTalkALot(cid, 200, {'Good job, go kill boss.'})
			else 
				if v.expe == 'yes' then
					doPlayerAddExp(cid, v.how_many)
					doSendAnimatedText(getPlayerPosition(cid), v.how_many, TEXTCOLOR_WHITE)
				end
				doPlayerSetStorageValue(cid, storages.main_storage, 0)
				doPlayerSetStorageValue(cid, v.storage, 0)
				doPlayerSetStorageValue(cid, storages.bosses_storage, 0)
				return doNPCTalkALot(cid, 200, {good_job[math.random(1, #good_job)]})
			end
		elseif bossStorages == v.after_kill_boss then
			doPlayerSetStorageValue(cid, storages.main_storage, 0)
			doPlayerSetStorageValue(cid, storages.bosses_storage, 0)
			doPlayerSetStorageValue(cid, v.storage, 0)
			return doNPCTalkALot(cid, 200, {good_job[math.random(1, #good_job)]})
		elseif  mainStorage == 36 then
			return doNPCTalkALot(cid, 200, {'You killed '..getPlayerStorageValue(cid, 9981)..' of 6666 Demons.'})
		elseif isInArray(v.before_kill_boss, bossStorages) then
			return doNPCTalkALot(cid, 200, {'You do not kill boss yet.'})
		end
	elseif msgcontains(msg, 'no') and talkState[talkUser] ~= 0 then 
		return doNPCTalkALot(cid, 200, {'Ok then.'})
	end
for i = 1, #rank do
	if msgcontains(msg, 'rank') and mainStorage ~= -1 then
		if points >= rank[i].need_points then
			if promote == rank[i].storage_value then
				if rank[i].need_points >= 5 and promote == 0 then
					msgss = {'Welcome back '..getCreatureName(cid)..'. You have completed 5 tasks for our society. Ask me for a {promotion} to advance your rank!'}
				elseif rank[i].need_points >= 10 and promote == 1 then
					msgss = {'Welcome back '..getCreatureName(cid)..'. You have completed 10 tasks for our society. Ask me for a {promotion} to advance your rank!'}
				elseif rank[i].need_points >= 20 and promote == 2 then
					msgss = {'Salutations '..getCreatureName(cid)..'. You have completed 20 tasks for our society. Ask me for a {promotion} to advance your rank!'}
				elseif rank[i].need_points >= 30 and promote == 3 then
					msgss = {'Welcome back '..getCreatureName(cid)..'. You have completed 30 tasks for our society. Ask me for a {promotion} to advance your rank!'}
				elseif rank[i].need_points == 50 and promote == 4 then
					msgss = {'By the gods....50 hunting tasks....this is austoding! Ask me for a {promotion} to advance your rank! And while you are here, I also have another special task for you.'}
				end
				talkState[talkUser] = rank[i].talkstate
				return doNPCTalkALot(cid, 200, msgss)
			end
		elseif points <= rank[i].need_points then
			if isInArray({-1,0}, promote) then
				msgss = {'You don\'t have any rank. You have '..points..' points. On next level you need '..rank[i].need_points - points..' points.'}
			else
				msgss = {'Your actualy rank is '..rank[i-1].name..'. You have '..points..' points. On next level you need '..rank[i].need_points - points..' points.'}
			end
			return doNPCTalkALot(cid, 200, msgss)
		end
	end
end
for i = 1, #promotion do
	if msgcontains(msg, 'promotion') then
		if talkState[talkUser] == promotion[i].talktype then
			if promote == promotion[i].finish_storage_values - 1 then
				doPlayerAddExp(cid, promotion[i].how_many_exp)
				doSendAnimatedText(getPlayerPosition(cid), promotion[i].how_many_exp, TEXTCOLOR_WHITE)
				doPlayerSetStorageValue(cid, storages.promote_storage, promotion[i].finish_storage_values)
					if talkState[talkUser] == 50 then
						doNPCTalkALot(cid, 200, {'You have completed 5 tasks! Let me promote you to the first rank: {Huntsman}. Congratulations! ...'})
						doNPCTalkALot(cid, 10000, {'If you find any trophies that you don\'t need, feel free to ask me for a {trade}.'})
					elseif talkState[talkUser] == 51 then
						doNPCTalkALot(cid, 200, {'You have completed 10 hunting tasks. It\'s time for a promotion. You advance to the rank of {Ranger}. Congratulations! ...'})
						doNPCTalkALot(cid, 10000, {'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 talkState[talkUser] == 52 then
						doNPCTalkALot(cid, 200, {'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! ...'})
						doNPCTalkALot(cid, 10000, {'From now on I\'ll buy more trophies from you!'})
					elseif talkState[talkUser] == 53 then
						doNPCTalkALot(cid, 200, {'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.'})
					elseif talkState[talkUser] == 54 then
						doNPCTalkALot(cid, 200, {'Congratulations! You have made the highest rank: {Elite hunter}. If haven\'t yet done so ask me for the {special task}.'})
							if promotion[i].item == 'yes' then
								doPlayerAddItem(cid, promotion[i].what, promotion[i].count)
							end
					end
					return true
			end
		end
	end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Npc continue dont counting in 0.4 dev, the bug is in the creaturescript i think.

I ask for task, the npc answer, he add the main storage in the character, storage 9985 = hydras, but when kill a hydra the storage dont upgrade like one - two - three...

Somebody use this system in 0.4 without this bug?
 
Last edited:
:( The system dont show the message "You killed xxx hydras" and the storage dont change, 9985 is the hydra task storage, the correct is 9985 (1) 9985 (2) but in my 0.4 dev its always 9985(0) i can kill 99999 hydras the number 0 never change.
 
Hello,

I was looking for how to do your tasks and found very interesting, but the Grizzly is not working well.

When I say ''Task'' he does not answer anything, and when I say ''Trade'' the following error appears on the console:

[Error - Npc interface]
data/npc/scripts/Grizzly_Adams.lua: onCreatureSay
Description:
data/npc/scripts/Grizzly_Adams.lua:227: attempt to call global 'doNPCTalkALot' (a nil value) stack traceback:
data/npc/scripts/Grizzly_Adams.lua:227: in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:383: in function 'onCreatureSay'
data/npc/scripts/Grizzly_Adams.lua:7: in function <data/npc/scripts/Grizzly_Adams.lua:7>

Thanks if you can help me :)
 
i have problem

i say hi not respond nothing
i say trade not nothing and cosola say
[Error - Npc interface]
data/npc/scripts/Grizzly_Adams.lua: onCreatureSay
Description:
data/npc/scripts/Grizzly_Adams.lua:227: attempt to call global 'doNPCTalkALot' (a nil value) stack traceback:
data/npc/scripts/Grizzly_Adams.lua:227: in function 'callback'
data/npc/lib/npcsystem/npchandler.lua:383: in function 'onCreatureSay'
data/npc/scripts/Grizzly_Adams.lua:7: in function <data/npc/scripts/Grizzly_Adams.lua:7>
 
Back
Top