Jump to content

Recommended Posts

Olá,

 

pessoal, estou com alguns problemas nas Tasks em meu servidor... Possuo um servidor global 1076/77 tfs 1.0, as tasks na verdade estão sendo estregas para os players normalmente...

 

O problema que tenho é que o NPC Grizzly Adams não oferece Trade para jogadores mesmo eles possuindo pontos suficientes e nem libera o portal do Demodras.

 

Procurei e não achei em lugar nenhum a solução para meu problema! :/

Meu servidor -> http://atena-global.com/

 

Visite o servidor e ajude-nos a crescer! Atena Global, um novo conceito de Tibia, o verdadeiro RPG você encontra aqui!

Link to post
Share on other sites

eu uso e no meu servidor funciona normalmente, tente esse aqui.

 

npc/scripts/

dofile('data/lib/killingInTheNameOfQuest.lua')

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
 
local choose = {}
local cancel = {}
local available = {}

local grizzlyAdamsConfig = {
							ranks = {
									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=11315, buy=0, sell=15000, name='draken trophy'},
													{id=11330, 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 Topic = {}
function greetCallback(cid)
	Topic[cid] = 0
	return true
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

function creatureSayCallback(cid, type, msg)
	local player = Player(cid)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
	if (msgcontains(msg, "hi") or msgcontains(msg, "hello")) and (not npcHandler:isFocused(cid)) then
		if (player:getStorageValue(JOIN_STOR) == -1) then
			npcHandler:say("Welcome "..getCreatureName(cid)..". Would you like to join the 'Paw and Fur - Hunting Elite'?", cid)
			npcHandler:addFocus(cid)
			npcHandler.topic[cid] = 5
		else
			npcHandler:say("Welcome back old chap. What brings you here this time?", cid)
			npcHandler:addFocus(cid)
			npcHandler.topic[cid] = 0
			end
			return true
		end
	 
		if(not npcHandler:isFocused(cid)) then
			return false
		end
		
		if msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
			npcHandler:say("Happy hunting, old chap!", cid, TRUE)
			Topic[talkUser] = 0
			npcHandler:releaseFocus(cid)
		end
		
		if (isInArray({"yes", "join"}, msg:lower()) and npcHandler.topic[cid] == 5) then 
			player:setStorageValue(JOIN_STOR, 1)
			npcHandler:say("Great! A warm welcome to our newest member: "..getCreatureName(cid).."! Ask me for a {task} if you want to go on a hunt.", cid)
			npcHandler.topic[cid] = 0
		elseif (msg:lower() == "no" and npcHandler.topic[cid] == 5) then
			npcHandler:say("No problem old chap. Come back if you change your mind.", cid)  
		end

		if (player:getStorageValue(JOIN_STOR) == -1) then
				npcHandler:say("You'll have to {join} us to get more information.",cid)
	return false
end
if isInArray({"offer", "trade"}, msg:lower()) then
	if getPlayerRank(cid) >= 2 then 
		if getPlayerRank(cid) == 2 or getPlayerRank(cid) == 3 then
			tradeRank = grizzlyAdamsConfig.ranks.huntsMan_rank
		elseif getPlayerRank(cid) == 4 then
			tradeRank = grizzlyAdamsConfig.ranks.bigGameHunter_rank
			setNewLineTable(grizzlyAdamsConfig.ranks.huntsMan_rank, grizzlyAdamsConfig.ranks.bigGameHunter_rank)
		elseif getPlayerRank(cid) == 5 or getPlayerRank(cid) == 6 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 (player:getFreeCapacity() < getItemWeight(items[item].itemId, amount) or inBackpacks and player:getFreeCap() < (getItemWeight(items[item].itemId, amount) + getItemWeight(1988, 1))) then
				return player:sendTextMessage(MESSAGE_INFO_DESCR, 'You don\'t have enough cap.')
			end
			if items[item].buyPrice then
				player:removeMoney(amount * items[item].buyPrice)
				for i = 1, amount do
					if inBackpacks then
						local backpack = doCreateItemEx(1988, 1)
						doAddContainerItem(backpack, items[item].itemId, amount)
					else
						player:addItem(items[item].itemId, amount, true)
					end
				end
				return player:sendTextMessage(MESSAGE_INFO_DESCR, '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
				player:addMoney(items[item].sellPrice * amount)
				player:removeItem(items[item].itemId, amount)
				return player:sendTextMessage(cid, MESSAGE_INFO_DESCR, 'You sold '..amount..'x '..items[item].realName..' for '..items[item].sellPrice * amount..' gold coins.')
			end
			return true
		end
		openShopWindow(cid, tradeRank, onBuy, onSell)
		return npcHandler:say('It\'s my offer.', player)
	else
		return npcHandler:say('You don\'t have any rank.', player)
		end
end
 
	if isInArray({"tasks", "task", "mission"}, msg:lower()) then
		local can = getTasksByPlayer(cid)
		if (player:getStorageValue(JOIN_STOR) == -1) then
 	        return (npcHandler:say("You'll have to {join}, to get any {tasks}.",cid))
        end
		if #can > 0 then
			local text = ""
			local sep = ", "
			table.sort(can, (function(a, b) return (a < b) end))
			local t = 0
			for _, id in ipairs(can) do
				t = t + 1
				if t == #can - 1 then
					sep = " and "
				elseif t == #can then
					sep = "."
				end
				text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
			end
			npcHandler:say("The current task" .. (#can > 1 and "s" or "") .. " that you can choose " .. (#can > 1 and "are" or "is") .. " " .. text, player)
			npcHandler.topic[cid] = 0
		else
			npcHandler:say("I don't have any task for you right now.", player)
		end
	elseif msg ~= "" and canStartTask(cid, msg) then
		if #getPlayerStartedTasks(cid) >= tasksByPlayer then
			npcHandler:say("Sorry, but you already started " .. tasksByPlayer .. " tasks. You can check their {status} or {cancel} a task.", player)
			return true
		end
		local task = getTaskByName(msg)
		if task and player:getStorageValue(QUESTSTORAGE_BASE + task) > 0 then  
			return false
		end
		npcHandler:say("In this task you must defeat " .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Are you sure that you want to start this task?", player)
		choose[cid] = task
		npcHandler.topic[cid] = 1
	elseif msg:lower() == "yes" and npcHandler.topic[cid] == 1 then
		player:setStorageValue(QUESTSTORAGE_BASE + choose[cid], 1)
		player:setStorageValue(KILLSSTORAGE_BASE + choose[cid], 0)
		npcHandler:say("Excellent! You can check the {status} of your task saying {report} to me. Also you can {cancel} tasks to.", player)
		choose[cid] = nil
		npcHandler.topic[cid] = 0	
	elseif (msg:lower() == "report" or msg:lower() == "status") then
		local started = getPlayerStartedTasks(cid)
		local finishedAtLeastOne = false
		local finished = 0
		if started and #started > 0 then
			for _, id in ipairs(started) do
				if player:getStorageValue(KILLSSTORAGE_BASE + id) >= tasks[id].killsRequired then
					for _, reward in ipairs(tasks[id].rewards) do
						local deny = false
						if reward.storage then
							if player:getStorageValue(reward.storage[1]) >= reward.storage[2] then
								deny = true
							end
						end
						if isInArray({REWARD_MONEY, "money"}, reward.type:lower()) and not deny then
							doPlayerAddMoney(cid, reward.value[1])
						elseif isInArray({REWARD_EXP, "exp", "experience"}, reward.type:lower()) and not deny then
							doPlayerAddExp(cid, reward.value[1], false, reward.value[1], false, true)
							doPlayerSendDefaultCancel(cid, "You gained " .. reward.value[1] .. " experience points.")
						elseif isInArray({REWARD_ACHIEVEMENT, "achievement", "ach"}, reward.type:lower()) and not deny then
						elseif isInArray({REWARD_STORAGE, "storage", "stor"}, reward.type:lower()) and not deny then
							player:setStorageValue(reward.value[1], reward.value[2])
						elseif isInArray({REWARD_POINT, "points", "point"}, reward.type:lower()) and not deny then
							player:setStorageValue(POINTSSTORAGE, player:getStorageValue(POINTSSTORAGE) + reward.value[1])
						elseif isInArray({REWARD_ITEM, "item", "items", "object"}, reward.type:lower()) and not deny then
							doPlayerAddItem(cid, reward.value[1], reward.value[2])
						end
 
						if reward.storage then
							player:setStorageValue(reward.storage[1], reward.storage[2])
						end
					end
 
					if tasks[id].norepeatable then
						player:setStorageValue(QUESTSTORAGE_BASE + id, 2)
					else
						player:setStorageValue(QUESTSTORAGE_BASE + id, 0)
					end
					if player:getStorageValue(REPEATSTORAGE_BASE + id) < 1 then
						player:setStorageValue(REPEATSTORAGE_BASE + id, 0)
					end
					player:setStorageValue(REPEATSTORAGE_BASE + id, player:getStorageValue(REPEATSTORAGE_BASE + id) + 1)
					finishedAtLeastOne = true
					finished = finished + 1
				end
			end
	if (not finishedAtLeastOne) then
 		local started = getPlayerStartedTasks(cid)
		if (started and #started > 0) then	
			local text = ""
			local sep = ", "
			table.sort(started, (function(a, b) return (a < b) end))
			local t = 0
			for _, id in ipairs(started) do
				t = t + 1
				if (t == #started - 1) then
					sep = " and "
				elseif (t == #started) then
					sep = "."
				end
				text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
			end
			    npcHandler:say("The current task" .. (#started > 1 and "s" or "") .. " that you started " .. (#started > 1 and "are" or "is") .. " " .. text, player)
			    Topic[cid] = 1
			else
				npcHandler:say("Awesome! you finished " .. (finished > 1 and "various" or "a") .. " task" .. (finished > 1 and "s" or "") .. ". Talk to me again if you want to start a {task}.", player)
			end
		else
			npcHandler:say("You haven't started any task yet.", player)
		end
	end
	elseif msg:lower() == "started" then
		local started = getPlayerStartedTasks(cid)
		if started and #started > 0 then
			local text = ""
			local sep = ", "
			table.sort(started, (function(a, b) return (a < b) end))
			local t = 0
			for _, id in ipairs(started) do
				t = t + 1
				if t == #started - 1 then
					sep = " and "
				elseif t == #started then
					sep = "."
				end
				text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
			end
 
			npcHandler:say("The current task" .. (#started > 1 and "s" or "") .. " that you started " .. (#started > 1 and "are" or "is") .. " " .. text, player)
		else
			npcHandler:say("You haven't started any task yet.", player)
		end
	elseif msg:lower() == "cancel" then
		local started = getPlayerStartedTasks(cid)
		local task = getTaskByName(msg)
		local text = ""
			local sep = ", "
			table.sort(started, (function(a, b) return (a < b) end))
			local t = 0
			for _, id in ipairs(started) do
				t = t + 1
				if t == #started - 1 then
					sep = " or "
				elseif t == #started then
					sep = "?"
				end
				text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
			end
		if started and #started > 0 then
			npcHandler:say("Cancelling a task will make the counter restart. Which of these tasks you want cancel?" .. (#started > 1 and "" or "") .. " " .. text, player)
			npcHandler.topic[cid] = 2
		else
			npcHandler:say("You haven't started any task yet.", player)
		end
	elseif getTaskByName(msg) and npcHandler.topic[cid] == 2 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then
		local task = getTaskByName(msg)
		if player:getStorageValue(KILLSSTORAGE_BASE + task) > 0 then
			npcHandler:say("You currently killed " .. player:getStorageValue(KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Cancelling this task will restart the count. Are you sure you want to cancel this task?", player)
		else
			npcHandler:say("Are you sure you want to cancel this task?", player)
		end
		npcHandler.topic[cid] = 3
		cancel[cid] = task
	elseif getTaskByName(msg) and Topic[cid] == 1 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then
		local task = getTaskByName(msg)
		if player:getStorageValue(KILLSSTORAGE_BASE + task) > 0 then
			npcHandler:say("You currently killed " .. player:getStorageValue(KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ".", player)
			Topic[cid] = 0
		else
		    npcHandler:say("You currently killed 0/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ".", player)
		end
	elseif msg:lower() == "yes" and npcHandler.topic[cid] == 3 then
		player:setStorageValue(QUESTSTORAGE_BASE + cancel[cid], -1)
		player:setStorageValue(KILLSSTORAGE_BASE + cancel[cid], -1)
		npcHandler:say("You have cancelled the task " .. (tasks[cancel[cid]].name or tasks[cancel[cid]].raceName) .. ".", player)
		npcHandler.topic[cid] = 0
	elseif isInArray({"points", "rank"}, msg:lower()) then
	    if player:getStorageValue(POINTSSTORAGE) < 1 then
		npcHandler:say("At this time, you have 0 Paw & Fur points. You " .. (getPlayerRank(cid) == 6 and "are an Elite Hunter" or getPlayerRank(cid) == 5 and "are a Trophy Hunter" or getPlayerRank(cid) == 4 and "are a Big Game Hunter" or getPlayerRank(cid) == 3 and "are a Ranger" or getPlayerRank(cid) == 2 and "are a Huntsman" or getPlayerRank(cid) == 1 and "are a Member"  or "haven't been ranked yet") .. ".", cid)
		elseif player:getStorageValue(POINTSSTORAGE) >= 1 then 
		npcHandler:say("At this time, you have " .. player:getStorageValue(POINTSSTORAGE) .. " Paw & Fur points. You " .. (getPlayerRank(cid) == 6 and "are an Elite Hunter" or getPlayerRank(cid) == 5 and "are a Trophy Hunter" or getPlayerRank(cid) == 4 and "are a Big Game Hunter" or getPlayerRank(cid) == 3 and "are a Ranger" or getPlayerRank(cid) == 2 and "are a Huntsman" or getPlayerRank(cid) == 1 and "are a Member"  or "haven't been ranked yet") .. ".", cid)
		end
		npcHandler.topic[cid] = 0
	elseif isInArray({"special task"}, msg:lower()) then
	    if player:getStorageValue(POINTSSTORAGE) >= 90 then -- Tiquandas Revenge 90 points
			if player:getStorageValue(22222) == 1 then  -- Check if he has already started the task.
				npcHandler:say("You have already started the task. Go find Tiquandas Revenge and take revenge yourself!", cid)
			else
				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. ...", cid)
				npcHandler:say("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!", cid)
				setPlayerStorageValue(cid, 22555, 1) -- Task needed to enter Tiquandas Revenge TP
				setPlayerStorageValue(cid, 22222, 1) -- Won't give this task again.
			end
		end
		if player:getStorageValue(POINTSSTORAGE) >= 100 then -- Demodras 100 points
			if player:getStorageValue(22223) == 1 then  -- Check if he has already started the task.
			npcHandler:say("You have already started the special task. Find Demodras and kill it.", cid)
				else
				npcHandler:say("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.", cid)
				setPlayerStorageValue(cid, 22556, 1) -- Task needed to enter Demodras TP
				setPlayerStorageValue(cid, 22223, 1) -- Won't give this task again.
			end
		end
		npcHandler.topic[cid] = 0
	end
end
 
npcHandler:setMessage(MESSAGE_FAREWELL, "Happy hunting, old chap!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

libs/killingInTheNameOfQuest.lua

RANK_NONE = 0
RANK_JOIN = 1
RANK_HUNTSMAN = 2
RANK_RANGER = 3
RANK_BIGGAMEHUNTER = 4
RANK_TROPHYHUNTER = 5
RANK_ELITEHUNTER = 6
 
REWARD_MONEY = 1
REWARD_EXP = 2
REWARD_ACHIEVEMENT = 3
REWARD_STORAGE = 4
REWARD_POINT = 5
REWARD_ITEM = 6
 
QUESTSTORAGE_BASE = 1500
JOIN_STOR = 100157
KILLSSTORAGE_BASE = 65000
REPEATSTORAGE_BASE = 48950
POINTSSTORAGE = 2500
tasks =
{
	[1] = {killsRequired = 100, raceName = "Trolls", level = {6, 19}, premium = true, creatures = {"troll", "troll champion", "island troll", "swamp troll"}, rewards = {{type = "exp", value = {200}},{type = "money", value = {200}}}},
	[2] = {killsRequired = 150, raceName = "Goblins", level = {6, 19}, premium = true, creatures = {"goblin", "goblin assassin", "goblin leader"}, rewards = {{type = "exp", value = {300}},{type = "money", value = {250}}}},
	[3] = {killsRequired = 300, raceName = "Crocodiles", level = {6, 49}, premium = true, creatures = {"crocodile"}, rewards = {{type = "exp", value = {800}},{type = "achievement", value = {"Blood-Red Snapper"}},{type = "storage", value = {35000, 1}},{type = "points", value = {1}}}},
	[4] = {killsRequired = 300, raceName = "Badgers", level = {6, 49}, premium = true, creatures = {"badger"}, rewards = {{type = "exp", value = {500}},{type = "points", value = {1}}}},
	[5] = {killsRequired = 300, raceName = "Tarantulas", level = {6, 49}, premium = true, creatures = {"tarantula"}, rewards = {{type = "exp", value = {1500}},{type = "achievement", value = {"No More Hiding"}},{type = "storage", value = {35001, 1}},{type = "points", value = {2}}}},
	[6] = {killsRequired = 150, raceName = "Carniphilas", level = {6, 49}, premium = true, creatures = {"carniphila"}, rewards = {{type = "exp", value = {2500}},{type = "achievement", value = {"Rootless Behaviour"}},{type = "storage", value = {35002, 1}},{type = "points", value = {3}}}},
	[7] = {killsRequired = 200, raceName = "Stone Golems", level = {6, 49}, premium = true, creatures = {"stone golem"}, rewards = {{type = "exp", value = {2000}},{type = "points", value = {3}}}},
	[8] = {killsRequired = 300, raceName = "Mammoths", level = {6, 49}, premium = true, creatures = {"mammoth"}, rewards = {{type = "exp", value = {4000}},{type = "achievement", value = {"Meat Skewer"}},{type = "storage", value = {35003, 1}},{type = "points", value = {3}}}},
	[9] = {killsRequired = 300, raceName = "Gnarlhounds", level = {6, 49}, premium = true, creatures = {"gnarlhound"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[10] = {killsRequired = 300, raceName = "Terramites", level = {6, 49}, premium = true, creatures = {"terramite"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[11] = {killsRequired = 300, raceName = "Apes", level = {6, 49}, premium = true, creatures = {"kongra", "sibang", "merklin"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[12] = {killsRequired = 300, raceName = "Thornback Tortoises", level = {6, 49}, premium = true, creatures = {"thornback tortoise"}, rewards = {{type = "exp", value = {1500}},{type = "points", value = {2}}}},
	[13] = {killsRequired = 300, raceName = "Gargoyles", level = {6, 49}, premium = true, creatures = {"gargoyle"}, rewards = {{type = "exp", value = {1500}}}},
	[14] = {killsRequired = 300, raceName = "Ice Golems", level = {50, 79}, premium = true, creatures = {"ice golem"}, rewards = {{type = "exp", value = {12000}},{type = "achievement", value = {"Breaking The Ice"}},{type = "storage", value = {35004, 1}},{type = "points", value = {2}}}},
	[15] = {killsRequired = 400, raceName = "Quara Scouts", level = {50, 79}, premium = true, creatures = {"quara pincher scout", "quara predator scout", "quara hydromancer scout", "quara constrictor scout", "quara mantassin scout"}, rewards = {{type = "exp", value = {10000}},{type = "points", value = {2}}}},
	[16] = {killsRequired = 400, raceName = "Mutated Rats", level = {50, 79}, premium = true, creatures = {"mutated rat"}, rewards = {{type = "exp", value = {10000}},{type = "achievement", value = {"Twisted Mutation"}},{type = "storage", value = {35005, 1}},{type = "points", value = {2}}}},																								
	[17] = {killsRequired = 250, raceName = "Ancient Scarabs", level = {50, 79}, premium = true, creatures = {"ancient scarab"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Crawling Death"}},{type = "storage", value = {35006, 1}},{type = "points", value = {2}}}},	
	[18] = {killsRequired = 300, raceName = "Wyverns", level = {50, 79}, premium = true, creatures = {"wyvern"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {2}}}},																										
	[19] = {killsRequired = 300, raceName = "Lancer Beetles", level = {50, 79}, premium = true, creatures = {"lancer beetle"}, rewards = {{type = "exp", value = {8000}},{type = "points", value = {2}}}},																										
	[20] = {killsRequired = 400, raceName = "Wailing Widows", level = {50, 79}, premium = true, creatures = {"wailing widow"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {3}}}},																										
	[21] = {killsRequired = 250, raceName = "Killer Caimans", level = {50, 79}, premium = true, creatures = {"killer caiman"}, rewards = {{type = "exp", value = {10000}},{type = "points", value = {2}}}},																										
	[22] = {killsRequired = 300, raceName = "Bonebeasts", level = {50, 79}, premium = true, creatures = {"bonebeast"}, rewards = {{type = "exp", value = {12000}},{type = "achievement", value = {"Spareribs for Dinner"}},{type = "storage", value = {35007, 1}},{type = "points", value = {2}}}},	
	[23] = {killsRequired = 300, raceName = "Crystal Spiders", level = {50, 79}, creatures = {"crystal spider"}, premium = true, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Arachnoise"}},{type = "storage", value = {35008, 1}},{type = "points", value = {3}}}},	
	[24] = {killsRequired = 300, raceName = "Mutated Tigers", level = {50, 79}, premium = true, creatures = {"mutated tiger"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {2}}}},	
	[25] = {killsRequired = 600, raceName = "Underwater Quara", level = {80, 129}, premium = true, creatures = {"quara hydromancer", "quara predator", "quara constrictor", "quara mantassin", "quara pincher"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Back into the Abyss"}},{type = "storage", value = {35009, 1}},{type = "points", value = {3}}}},	
	[26] = {killsRequired = 500, raceName = "Giant Spiders", level = {80, 129}, premium = true, creatures = {"giant spider"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Choking on Her Venom"}},{type = "storage", value = {35010, 1}},{type = "points", value = {3}}}},	
	[27] = {killsRequired = 300, raceName = "Werewolves", level = {80, 129}, premium = true, creatures = {"werewolf"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Howly Silence"}},{type = "storage", value = {35011, 1}},{type = "points", value = {4}}}},
	[28] = {killsRequired = 400, raceName = "Nightmares", level = {80, 129}, premium = true, creatures = {"nightmare", "nightmare scion"}, rewards = {{type = "exp", value = {25000}},{type = "achievement", value = {"Dream is Over"}},{type = "storage", value = {35012, 1}},{type = "points", value = {3}}}},		
	[29] = {killsRequired = 600, raceName = "Hellspawns", level = {80, 129}, premium = true, creatures = {"hellspawn"}, rewards = {{type = "exp", value = {25000}},{type = "achievement", value = {"Scorched Flames"}},{type = "storage", value = {35013, 1}}}},
	[30] = {killsRequired = 800, raceName = "High Class Lizards", level = {80, 129}, premium = true, creatures = {"lizard chosen", "lizard dragon priest", "lizard high guard", "lizard legionnaire"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Zzztill Zzztanding!"}},{type = "storage", value = {35014, 1}},{type = "points", value = {3}}}},
	[31] = {killsRequired = 600, raceName = "Stampors", level = {80, 129}, premium = true, creatures = {"stampor"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Stepped on a Big Toe"}},{type = "storage", value = {35015, 1}},{type = "points", value = {3}}}},		
	[32] = {killsRequired = 500, raceName = "Brimstone Bugs", level = {80, 129}, premium = true, creatures = {"brimstone bug"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Something Smells"}},{type = "storage", value = {35016, 1}},{type = "points", value = {3}}}},	
	[33] = {killsRequired = 400, raceName = "Mutated Bats", level = {80, 129}, premium = true, creatures = {"mutated bat"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Kapow!"}},{type = "storage", value = {35017, 1}},{type = "points", value = {2}}}},											
	[34] = {killsRequired = 650, raceName = "Hydras", level = {130, 9999}, premium = true, creatures = {"hydra"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"One Less"}},{type = "storage", value = {35018, 1}},{type = "points", value = {3}}}},	
	[35] = {killsRequired = 800, raceName = "Serpent Spawns", level = {130, 9999}, premium = true, creatures = {"serpent spawn"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Hissing Downfall"}},{type = "storage", value = {35019, 1}},{type = "points", value = {4}}}},		
	[36] = {killsRequired = 500, raceName = "Medusa", level = {130, 9999}, premium = true, creatures = {"medusa"}, rewards = {{type = "exp", value = {40000}},{type = "achievement", value = {"The Serpent's Bride"}},{type = "storage", value = {35020, 1}},{type = "points", value = {5}}}},	
	[37] = {killsRequired = 700, raceName = "Behemoths", level = {130, 9999}, premium = true, creatures = {"behemoth"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Just Cracked Me Up!"}},{type = "storage", value = {35021, 1}},{type = "points", value = {4}}}},	
	[38] = {killsRequired = 900, raceName = "Sea Serpents and Young Sea Serpents", level = {130, 9999}, premium = true, creatures = {"sea serpent", "young sea serpent"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"The Drowned Sea God"}},{type = "storage", value = {35022, 1}},{type = "points", value = {4}}}},		
	[39] = {killsRequired = 250, raceName = "Hellhounds", level = {130, 9999}, premium = true, creatures = {"hellhound"}, rewards = {{type = "exp", value = {40000}},{type = "achievement", value = {"The Gates of Hell"}},{type = "storage", value = {35023, 1}},{type = "points", value = {5}}}},		
	[40] = {killsRequired = 500, raceName = "Ghastly Dragons", level = {130, 9999}, premium = true, creatures = {"ghastly dragon"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Beautiful Agony"}},{type = "storage", value = {35024, 1}},{type = "points", value = {5}}}},		
	[41] = {killsRequired = 900, raceName = "Drakens", level = {130, 9999}, premium = true, creatures = {"draken spellweaver", "draken warmaster", "draken abomination", "draken elite"} , rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Enter zze Draken!"}},{type = "storage", value = {35025, 1}},{type = "points", value = {3}}}},	
	[42] = {killsRequired = 650, raceName = "Destroyers", level = {130, 9999}, premium = true, creatures = {"destroyer"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Best there was!"}},{type = "storage", value = {35026, 1}},{type = "points", value = {4}}}},			
	[43] = {killsRequired = 400, raceName = "Undead Dragons", level = {130, 9999}, premium = true, creatures = {"undead dragon"}, rewards = {{type = "exp", value = {50000}},{type = "achievement", value = {"Back from the Dead"}},{type = "storage", value = {35027, 1}},{type = "points", value = {6}}}},	
	[44] = {killsRequired = 6666, raceName = "Demons", level = {130, 9999}, rank = RANK_ELITEHUNTER, norepeatable = true, premium = true, creatures = {"demon"}, rewards = {{type = "storage", value = {41300, 1}}}},																																	
}
 
tasksByPlayer = 3
repeatTimes = 3
 
function getPlayerRank(cid)
	local p = Player(cid)
	return (p:getStorageValue(POINTSSTORAGE) >= 100 and RANK_ELITEHUNTER or p:getStorageValue(POINTSSTORAGE) >= 70 and RANK_TROPHYHUNTER or p:getStorageValue(POINTSSTORAGE) >= 40 and RANK_BIGGAMEHUNTER or p:getStorageValue(POINTSSTORAGE) >= 20 and RANK_RANGER or p:getStorageValue(POINTSSTORAGE) >= 10 and RANK_HUNTSMAN or p:getStorageValue(JOIN_STOR) == 1 and RANK_JOIN or RANK_NONE)
end
 
function getTaskByName(name, table)
	local t = (table and table or tasks)
	for k, v in pairs(t) do
		if(v.name) then
			if(v.name:lower() == name:lower()) then
				return k
			end
		else
			if(v.raceName:lower() == name:lower()) then
				return k
			end
		end
	end
return false
end
 
function getTasksByPlayer(cid)
	local p = Player(cid)
	local canmake = {}
	local able = {}
	for k, v in pairs(tasks) do
		if(p:getStorageValue(QUESTSTORAGE_BASE + k) < 1 and p:getStorageValue(REPEATSTORAGE_BASE + k) < repeatTimes) then
			able[k] = true
			if(p:getLevel() < v.level[1] or p:getLevel() > v.level[2]) then
				able[k] = false
			end
			if(v.storage and p:getStorageValue(v.storage[1]) < v.storage[2]) then
				able[k] = false
			end
 
			if(v.rank) then
				if(getPlayerRank(cid) < v.rank) then
					able[k] = false
				end
			end
 
			if(v.premium) then
				if(not(isPremium(cid))) then
					able[k] = false
				end
			end
 
			if(able[k]) then
				table.insert(canmake, k)
			end
		end
	end
return canmake
end
 
 
function canStartTask(cid, name, table)
	local p = Player(cid)
	local v = ""
	local id = 0
	local t = (table and table or tasks)
	for k, i in pairs(t) do
		if(i.name) then
			if(i.name:lower() == name:lower()) then
				v = i
				id = k
				break
			end
		else
			if(i.raceName:lower() == name:lower()) then
				v = i
				id = k
				break
			end
		end
	end
	if(v == "") then
		return false
	end
	if(p:getStorageValue(QUESTSTORAGE_BASE + id) > 0) then
		return false
	end
	if(p:getStorageValue(REPEATSTORAGE_BASE +  id) >= repeatTimes) or (v.norepeatable and p:getStorageValue(REPEATSTORAGE_BASE +  id) > 0) then
		return false
	end
	if(p:getLevel() >= v.level[1] and p:getLevel() <= v.level[2]) then
		if(v.premium) then
			if(isPremium(cid)) then
				if(v.rank) then
					if(getPlayerRank(cid) >= v.rank) then
						if(v.storage) then 
							if(p:getStorageValue(v.storage[1]) >= v.storage[2]) then
								return true
							end
						else
							return true
						end
					end
				else
					return true
				end
			end
		else
			return true
		end
	end
return false
end
 
function getPlayerStartedTasks(cid)
	local p = Player(cid)
	local tmp = {}
	for k, v in pairs(tasks) do
		if(p:getStorageValue(QUESTSTORAGE_BASE + k) > 0 and p:getStorageValue(QUESTSTORAGE_BASE + k) < 2) then
			table.insert(tmp, k) 
		end
	end
return tmp
end

 

creaturescript/killingInTheNameOfQuestKills

dofile('data/lib/killingInTheNameOfQuest.lua')

function onKill(cid, target, lastHit)
	local started = getPlayerStartedTasks(cid)
	if isPlayer(target) or isSummon(target) then return true end
	if started and #started > 0 then
		for _, id in ipairs(started) do
			if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
				if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
					setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) + 1)
				end
			end
		end
	end
	return true
end

tag 

	<event type="kill" name="killingInTheNameOfQuestKills" script="killingInTheNameOfQuestKills.lua"/>
Edited by Jobs (see edit history)
Link to post
Share on other sites

 

eu uso e no meu servidor funciona normalmente, tente esse aqui.

 

npc/scripts/

dofile('data/lib/killingInTheNameOfQuest.lua')

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
 
local choose = {}
local cancel = {}
local available = {}

local grizzlyAdamsConfig = {
							ranks = {
									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=11315, buy=0, sell=15000, name='draken trophy'},
													{id=11330, 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 Topic = {}
function greetCallback(cid)
	Topic[cid] = 0
	return true
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

function creatureSayCallback(cid, type, msg)
	local player = Player(cid)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid
	if (msgcontains(msg, "hi") or msgcontains(msg, "hello")) and (not npcHandler:isFocused(cid)) then
		if (player:getStorageValue(JOIN_STOR) == -1) then
			npcHandler:say("Welcome "..getCreatureName(cid)..". Would you like to join the 'Paw and Fur - Hunting Elite'?", cid)
			npcHandler:addFocus(cid)
			npcHandler.topic[cid] = 5
		else
			npcHandler:say("Welcome back old chap. What brings you here this time?", cid)
			npcHandler:addFocus(cid)
			npcHandler.topic[cid] = 0
			end
			return true
		end
	 
		if(not npcHandler:isFocused(cid)) then
			return false
		end
		
		if msgcontains(msg, "bye") or msgcontains(msg, "farewell") then
			npcHandler:say("Happy hunting, old chap!", cid, TRUE)
			Topic[talkUser] = 0
			npcHandler:releaseFocus(cid)
		end
		
		if (isInArray({"yes", "join"}, msg:lower()) and npcHandler.topic[cid] == 5) then 
			player:setStorageValue(JOIN_STOR, 1)
			npcHandler:say("Great! A warm welcome to our newest member: "..getCreatureName(cid).."! Ask me for a {task} if you want to go on a hunt.", cid)
			npcHandler.topic[cid] = 0
		elseif (msg:lower() == "no" and npcHandler.topic[cid] == 5) then
			npcHandler:say("No problem old chap. Come back if you change your mind.", cid)  
		end

		if (player:getStorageValue(JOIN_STOR) == -1) then
				npcHandler:say("You'll have to {join} us to get more information.",cid)
	return false
end
if isInArray({"offer", "trade"}, msg:lower()) then
	if getPlayerRank(cid) >= 2 then 
		if getPlayerRank(cid) == 2 or getPlayerRank(cid) == 3 then
			tradeRank = grizzlyAdamsConfig.ranks.huntsMan_rank
		elseif getPlayerRank(cid) == 4 then
			tradeRank = grizzlyAdamsConfig.ranks.bigGameHunter_rank
			setNewLineTable(grizzlyAdamsConfig.ranks.huntsMan_rank, grizzlyAdamsConfig.ranks.bigGameHunter_rank)
		elseif getPlayerRank(cid) == 5 or getPlayerRank(cid) == 6 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 (player:getFreeCapacity() < getItemWeight(items[item].itemId, amount) or inBackpacks and player:getFreeCap() < (getItemWeight(items[item].itemId, amount) + getItemWeight(1988, 1))) then
				return player:sendTextMessage(MESSAGE_INFO_DESCR, 'You don\'t have enough cap.')
			end
			if items[item].buyPrice then
				player:removeMoney(amount * items[item].buyPrice)
				for i = 1, amount do
					if inBackpacks then
						local backpack = doCreateItemEx(1988, 1)
						doAddContainerItem(backpack, items[item].itemId, amount)
					else
						player:addItem(items[item].itemId, amount, true)
					end
				end
				return player:sendTextMessage(MESSAGE_INFO_DESCR, '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
				player:addMoney(items[item].sellPrice * amount)
				player:removeItem(items[item].itemId, amount)
				return player:sendTextMessage(cid, MESSAGE_INFO_DESCR, 'You sold '..amount..'x '..items[item].realName..' for '..items[item].sellPrice * amount..' gold coins.')
			end
			return true
		end
		openShopWindow(cid, tradeRank, onBuy, onSell)
		return npcHandler:say('It\'s my offer.', player)
	else
		return npcHandler:say('You don\'t have any rank.', player)
		end
end
 
	if isInArray({"tasks", "task", "mission"}, msg:lower()) then
		local can = getTasksByPlayer(cid)
		if (player:getStorageValue(JOIN_STOR) == -1) then
 	        return (npcHandler:say("You'll have to {join}, to get any {tasks}.",cid))
        end
		if #can > 0 then
			local text = ""
			local sep = ", "
			table.sort(can, (function(a, b) return (a < b) end))
			local t = 0
			for _, id in ipairs(can) do
				t = t + 1
				if t == #can - 1 then
					sep = " and "
				elseif t == #can then
					sep = "."
				end
				text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
			end
			npcHandler:say("The current task" .. (#can > 1 and "s" or "") .. " that you can choose " .. (#can > 1 and "are" or "is") .. " " .. text, player)
			npcHandler.topic[cid] = 0
		else
			npcHandler:say("I don't have any task for you right now.", player)
		end
	elseif msg ~= "" and canStartTask(cid, msg) then
		if #getPlayerStartedTasks(cid) >= tasksByPlayer then
			npcHandler:say("Sorry, but you already started " .. tasksByPlayer .. " tasks. You can check their {status} or {cancel} a task.", player)
			return true
		end
		local task = getTaskByName(msg)
		if task and player:getStorageValue(QUESTSTORAGE_BASE + task) > 0 then  
			return false
		end
		npcHandler:say("In this task you must defeat " .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Are you sure that you want to start this task?", player)
		choose[cid] = task
		npcHandler.topic[cid] = 1
	elseif msg:lower() == "yes" and npcHandler.topic[cid] == 1 then
		player:setStorageValue(QUESTSTORAGE_BASE + choose[cid], 1)
		player:setStorageValue(KILLSSTORAGE_BASE + choose[cid], 0)
		npcHandler:say("Excellent! You can check the {status} of your task saying {report} to me. Also you can {cancel} tasks to.", player)
		choose[cid] = nil
		npcHandler.topic[cid] = 0	
	elseif (msg:lower() == "report" or msg:lower() == "status") then
		local started = getPlayerStartedTasks(cid)
		local finishedAtLeastOne = false
		local finished = 0
		if started and #started > 0 then
			for _, id in ipairs(started) do
				if player:getStorageValue(KILLSSTORAGE_BASE + id) >= tasks[id].killsRequired then
					for _, reward in ipairs(tasks[id].rewards) do
						local deny = false
						if reward.storage then
							if player:getStorageValue(reward.storage[1]) >= reward.storage[2] then
								deny = true
							end
						end
						if isInArray({REWARD_MONEY, "money"}, reward.type:lower()) and not deny then
							doPlayerAddMoney(cid, reward.value[1])
						elseif isInArray({REWARD_EXP, "exp", "experience"}, reward.type:lower()) and not deny then
							doPlayerAddExp(cid, reward.value[1], false, reward.value[1], false, true)
							doPlayerSendDefaultCancel(cid, "You gained " .. reward.value[1] .. " experience points.")
						elseif isInArray({REWARD_ACHIEVEMENT, "achievement", "ach"}, reward.type:lower()) and not deny then
						elseif isInArray({REWARD_STORAGE, "storage", "stor"}, reward.type:lower()) and not deny then
							player:setStorageValue(reward.value[1], reward.value[2])
						elseif isInArray({REWARD_POINT, "points", "point"}, reward.type:lower()) and not deny then
							player:setStorageValue(POINTSSTORAGE, player:getStorageValue(POINTSSTORAGE) + reward.value[1])
						elseif isInArray({REWARD_ITEM, "item", "items", "object"}, reward.type:lower()) and not deny then
							doPlayerAddItem(cid, reward.value[1], reward.value[2])
						end
 
						if reward.storage then
							player:setStorageValue(reward.storage[1], reward.storage[2])
						end
					end
 
					if tasks[id].norepeatable then
						player:setStorageValue(QUESTSTORAGE_BASE + id, 2)
					else
						player:setStorageValue(QUESTSTORAGE_BASE + id, 0)
					end
					if player:getStorageValue(REPEATSTORAGE_BASE + id) < 1 then
						player:setStorageValue(REPEATSTORAGE_BASE + id, 0)
					end
					player:setStorageValue(REPEATSTORAGE_BASE + id, player:getStorageValue(REPEATSTORAGE_BASE + id) + 1)
					finishedAtLeastOne = true
					finished = finished + 1
				end
			end
	if (not finishedAtLeastOne) then
 		local started = getPlayerStartedTasks(cid)
		if (started and #started > 0) then	
			local text = ""
			local sep = ", "
			table.sort(started, (function(a, b) return (a < b) end))
			local t = 0
			for _, id in ipairs(started) do
				t = t + 1
				if (t == #started - 1) then
					sep = " and "
				elseif (t == #started) then
					sep = "."
				end
				text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
			end
			    npcHandler:say("The current task" .. (#started > 1 and "s" or "") .. " that you started " .. (#started > 1 and "are" or "is") .. " " .. text, player)
			    Topic[cid] = 1
			else
				npcHandler:say("Awesome! you finished " .. (finished > 1 and "various" or "a") .. " task" .. (finished > 1 and "s" or "") .. ". Talk to me again if you want to start a {task}.", player)
			end
		else
			npcHandler:say("You haven't started any task yet.", player)
		end
	end
	elseif msg:lower() == "started" then
		local started = getPlayerStartedTasks(cid)
		if started and #started > 0 then
			local text = ""
			local sep = ", "
			table.sort(started, (function(a, b) return (a < b) end))
			local t = 0
			for _, id in ipairs(started) do
				t = t + 1
				if t == #started - 1 then
					sep = " and "
				elseif t == #started then
					sep = "."
				end
				text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
			end
 
			npcHandler:say("The current task" .. (#started > 1 and "s" or "") .. " that you started " .. (#started > 1 and "are" or "is") .. " " .. text, player)
		else
			npcHandler:say("You haven't started any task yet.", player)
		end
	elseif msg:lower() == "cancel" then
		local started = getPlayerStartedTasks(cid)
		local task = getTaskByName(msg)
		local text = ""
			local sep = ", "
			table.sort(started, (function(a, b) return (a < b) end))
			local t = 0
			for _, id in ipairs(started) do
				t = t + 1
				if t == #started - 1 then
					sep = " or "
				elseif t == #started then
					sep = "?"
				end
				text = text .. "{" .. (tasks[id].name or tasks[id].raceName) .. "}" .. sep
			end
		if started and #started > 0 then
			npcHandler:say("Cancelling a task will make the counter restart. Which of these tasks you want cancel?" .. (#started > 1 and "" or "") .. " " .. text, player)
			npcHandler.topic[cid] = 2
		else
			npcHandler:say("You haven't started any task yet.", player)
		end
	elseif getTaskByName(msg) and npcHandler.topic[cid] == 2 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then
		local task = getTaskByName(msg)
		if player:getStorageValue(KILLSSTORAGE_BASE + task) > 0 then
			npcHandler:say("You currently killed " .. player:getStorageValue(KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ". Cancelling this task will restart the count. Are you sure you want to cancel this task?", player)
		else
			npcHandler:say("Are you sure you want to cancel this task?", player)
		end
		npcHandler.topic[cid] = 3
		cancel[cid] = task
	elseif getTaskByName(msg) and Topic[cid] == 1 and isInArray(getPlayerStartedTasks(cid), getTaskByName(msg)) then
		local task = getTaskByName(msg)
		if player:getStorageValue(KILLSSTORAGE_BASE + task) > 0 then
			npcHandler:say("You currently killed " .. player:getStorageValue(KILLSSTORAGE_BASE + task) .. "/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ".", player)
			Topic[cid] = 0
		else
		    npcHandler:say("You currently killed 0/" .. tasks[task].killsRequired .. " " .. tasks[task].raceName .. ".", player)
		end
	elseif msg:lower() == "yes" and npcHandler.topic[cid] == 3 then
		player:setStorageValue(QUESTSTORAGE_BASE + cancel[cid], -1)
		player:setStorageValue(KILLSSTORAGE_BASE + cancel[cid], -1)
		npcHandler:say("You have cancelled the task " .. (tasks[cancel[cid]].name or tasks[cancel[cid]].raceName) .. ".", player)
		npcHandler.topic[cid] = 0
	elseif isInArray({"points", "rank"}, msg:lower()) then
	    if player:getStorageValue(POINTSSTORAGE) < 1 then
		npcHandler:say("At this time, you have 0 Paw & Fur points. You " .. (getPlayerRank(cid) == 6 and "are an Elite Hunter" or getPlayerRank(cid) == 5 and "are a Trophy Hunter" or getPlayerRank(cid) == 4 and "are a Big Game Hunter" or getPlayerRank(cid) == 3 and "are a Ranger" or getPlayerRank(cid) == 2 and "are a Huntsman" or getPlayerRank(cid) == 1 and "are a Member"  or "haven't been ranked yet") .. ".", cid)
		elseif player:getStorageValue(POINTSSTORAGE) >= 1 then 
		npcHandler:say("At this time, you have " .. player:getStorageValue(POINTSSTORAGE) .. " Paw & Fur points. You " .. (getPlayerRank(cid) == 6 and "are an Elite Hunter" or getPlayerRank(cid) == 5 and "are a Trophy Hunter" or getPlayerRank(cid) == 4 and "are a Big Game Hunter" or getPlayerRank(cid) == 3 and "are a Ranger" or getPlayerRank(cid) == 2 and "are a Huntsman" or getPlayerRank(cid) == 1 and "are a Member"  or "haven't been ranked yet") .. ".", cid)
		end
		npcHandler.topic[cid] = 0
	elseif isInArray({"special task"}, msg:lower()) then
	    if player:getStorageValue(POINTSSTORAGE) >= 90 then -- Tiquandas Revenge 90 points
			if player:getStorageValue(22222) == 1 then  -- Check if he has already started the task.
				npcHandler:say("You have already started the task. Go find Tiquandas Revenge and take revenge yourself!", cid)
			else
				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. ...", cid)
				npcHandler:say("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!", cid)
				setPlayerStorageValue(cid, 22555, 1) -- Task needed to enter Tiquandas Revenge TP
				setPlayerStorageValue(cid, 22222, 1) -- Won't give this task again.
			end
		end
		if player:getStorageValue(POINTSSTORAGE) >= 100 then -- Demodras 100 points
			if player:getStorageValue(22223) == 1 then  -- Check if he has already started the task.
			npcHandler:say("You have already started the special task. Find Demodras and kill it.", cid)
				else
				npcHandler:say("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.", cid)
				setPlayerStorageValue(cid, 22556, 1) -- Task needed to enter Demodras TP
				setPlayerStorageValue(cid, 22223, 1) -- Won't give this task again.
			end
		end
		npcHandler.topic[cid] = 0
	end
end
 
npcHandler:setMessage(MESSAGE_FAREWELL, "Happy hunting, old chap!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

libs/killingInTheNameOfQuest.lua

RANK_NONE = 0
RANK_JOIN = 1
RANK_HUNTSMAN = 2
RANK_RANGER = 3
RANK_BIGGAMEHUNTER = 4
RANK_TROPHYHUNTER = 5
RANK_ELITEHUNTER = 6
 
REWARD_MONEY = 1
REWARD_EXP = 2
REWARD_ACHIEVEMENT = 3
REWARD_STORAGE = 4
REWARD_POINT = 5
REWARD_ITEM = 6
 
QUESTSTORAGE_BASE = 1500
JOIN_STOR = 100157
KILLSSTORAGE_BASE = 65000
REPEATSTORAGE_BASE = 48950
POINTSSTORAGE = 2500
tasks =
{
	[1] = {killsRequired = 100, raceName = "Trolls", level = {6, 19}, premium = true, creatures = {"troll", "troll champion", "island troll", "swamp troll"}, rewards = {{type = "exp", value = {200}},{type = "money", value = {200}}}},
	[2] = {killsRequired = 150, raceName = "Goblins", level = {6, 19}, premium = true, creatures = {"goblin", "goblin assassin", "goblin leader"}, rewards = {{type = "exp", value = {300}},{type = "money", value = {250}}}},
	[3] = {killsRequired = 300, raceName = "Crocodiles", level = {6, 49}, premium = true, creatures = {"crocodile"}, rewards = {{type = "exp", value = {800}},{type = "achievement", value = {"Blood-Red Snapper"}},{type = "storage", value = {35000, 1}},{type = "points", value = {1}}}},
	[4] = {killsRequired = 300, raceName = "Badgers", level = {6, 49}, premium = true, creatures = {"badger"}, rewards = {{type = "exp", value = {500}},{type = "points", value = {1}}}},
	[5] = {killsRequired = 300, raceName = "Tarantulas", level = {6, 49}, premium = true, creatures = {"tarantula"}, rewards = {{type = "exp", value = {1500}},{type = "achievement", value = {"No More Hiding"}},{type = "storage", value = {35001, 1}},{type = "points", value = {2}}}},
	[6] = {killsRequired = 150, raceName = "Carniphilas", level = {6, 49}, premium = true, creatures = {"carniphila"}, rewards = {{type = "exp", value = {2500}},{type = "achievement", value = {"Rootless Behaviour"}},{type = "storage", value = {35002, 1}},{type = "points", value = {3}}}},
	[7] = {killsRequired = 200, raceName = "Stone Golems", level = {6, 49}, premium = true, creatures = {"stone golem"}, rewards = {{type = "exp", value = {2000}},{type = "points", value = {3}}}},
	[8] = {killsRequired = 300, raceName = "Mammoths", level = {6, 49}, premium = true, creatures = {"mammoth"}, rewards = {{type = "exp", value = {4000}},{type = "achievement", value = {"Meat Skewer"}},{type = "storage", value = {35003, 1}},{type = "points", value = {3}}}},
	[9] = {killsRequired = 300, raceName = "Gnarlhounds", level = {6, 49}, premium = true, creatures = {"gnarlhound"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[10] = {killsRequired = 300, raceName = "Terramites", level = {6, 49}, premium = true, creatures = {"terramite"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[11] = {killsRequired = 300, raceName = "Apes", level = {6, 49}, premium = true, creatures = {"kongra", "sibang", "merklin"}, rewards = {{type = "exp", value = {1000}},{type = "points", value = {2}}}},
	[12] = {killsRequired = 300, raceName = "Thornback Tortoises", level = {6, 49}, premium = true, creatures = {"thornback tortoise"}, rewards = {{type = "exp", value = {1500}},{type = "points", value = {2}}}},
	[13] = {killsRequired = 300, raceName = "Gargoyles", level = {6, 49}, premium = true, creatures = {"gargoyle"}, rewards = {{type = "exp", value = {1500}}}},
	[14] = {killsRequired = 300, raceName = "Ice Golems", level = {50, 79}, premium = true, creatures = {"ice golem"}, rewards = {{type = "exp", value = {12000}},{type = "achievement", value = {"Breaking The Ice"}},{type = "storage", value = {35004, 1}},{type = "points", value = {2}}}},
	[15] = {killsRequired = 400, raceName = "Quara Scouts", level = {50, 79}, premium = true, creatures = {"quara pincher scout", "quara predator scout", "quara hydromancer scout", "quara constrictor scout", "quara mantassin scout"}, rewards = {{type = "exp", value = {10000}},{type = "points", value = {2}}}},
	[16] = {killsRequired = 400, raceName = "Mutated Rats", level = {50, 79}, premium = true, creatures = {"mutated rat"}, rewards = {{type = "exp", value = {10000}},{type = "achievement", value = {"Twisted Mutation"}},{type = "storage", value = {35005, 1}},{type = "points", value = {2}}}},																								
	[17] = {killsRequired = 250, raceName = "Ancient Scarabs", level = {50, 79}, premium = true, creatures = {"ancient scarab"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Crawling Death"}},{type = "storage", value = {35006, 1}},{type = "points", value = {2}}}},	
	[18] = {killsRequired = 300, raceName = "Wyverns", level = {50, 79}, premium = true, creatures = {"wyvern"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {2}}}},																										
	[19] = {killsRequired = 300, raceName = "Lancer Beetles", level = {50, 79}, premium = true, creatures = {"lancer beetle"}, rewards = {{type = "exp", value = {8000}},{type = "points", value = {2}}}},																										
	[20] = {killsRequired = 400, raceName = "Wailing Widows", level = {50, 79}, premium = true, creatures = {"wailing widow"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {3}}}},																										
	[21] = {killsRequired = 250, raceName = "Killer Caimans", level = {50, 79}, premium = true, creatures = {"killer caiman"}, rewards = {{type = "exp", value = {10000}},{type = "points", value = {2}}}},																										
	[22] = {killsRequired = 300, raceName = "Bonebeasts", level = {50, 79}, premium = true, creatures = {"bonebeast"}, rewards = {{type = "exp", value = {12000}},{type = "achievement", value = {"Spareribs for Dinner"}},{type = "storage", value = {35007, 1}},{type = "points", value = {2}}}},	
	[23] = {killsRequired = 300, raceName = "Crystal Spiders", level = {50, 79}, creatures = {"crystal spider"}, premium = true, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Arachnoise"}},{type = "storage", value = {35008, 1}},{type = "points", value = {3}}}},	
	[24] = {killsRequired = 300, raceName = "Mutated Tigers", level = {50, 79}, premium = true, creatures = {"mutated tiger"}, rewards = {{type = "exp", value = {12000}},{type = "points", value = {2}}}},	
	[25] = {killsRequired = 600, raceName = "Underwater Quara", level = {80, 129}, premium = true, creatures = {"quara hydromancer", "quara predator", "quara constrictor", "quara mantassin", "quara pincher"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Back into the Abyss"}},{type = "storage", value = {35009, 1}},{type = "points", value = {3}}}},	
	[26] = {killsRequired = 500, raceName = "Giant Spiders", level = {80, 129}, premium = true, creatures = {"giant spider"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Choking on Her Venom"}},{type = "storage", value = {35010, 1}},{type = "points", value = {3}}}},	
	[27] = {killsRequired = 300, raceName = "Werewolves", level = {80, 129}, premium = true, creatures = {"werewolf"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Howly Silence"}},{type = "storage", value = {35011, 1}},{type = "points", value = {4}}}},
	[28] = {killsRequired = 400, raceName = "Nightmares", level = {80, 129}, premium = true, creatures = {"nightmare", "nightmare scion"}, rewards = {{type = "exp", value = {25000}},{type = "achievement", value = {"Dream is Over"}},{type = "storage", value = {35012, 1}},{type = "points", value = {3}}}},		
	[29] = {killsRequired = 600, raceName = "Hellspawns", level = {80, 129}, premium = true, creatures = {"hellspawn"}, rewards = {{type = "exp", value = {25000}},{type = "achievement", value = {"Scorched Flames"}},{type = "storage", value = {35013, 1}}}},
	[30] = {killsRequired = 800, raceName = "High Class Lizards", level = {80, 129}, premium = true, creatures = {"lizard chosen", "lizard dragon priest", "lizard high guard", "lizard legionnaire"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Zzztill Zzztanding!"}},{type = "storage", value = {35014, 1}},{type = "points", value = {3}}}},
	[31] = {killsRequired = 600, raceName = "Stampors", level = {80, 129}, premium = true, creatures = {"stampor"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Stepped on a Big Toe"}},{type = "storage", value = {35015, 1}},{type = "points", value = {3}}}},		
	[32] = {killsRequired = 500, raceName = "Brimstone Bugs", level = {80, 129}, premium = true, creatures = {"brimstone bug"}, rewards = {{type = "exp", value = {15000}},{type = "achievement", value = {"Something Smells"}},{type = "storage", value = {35016, 1}},{type = "points", value = {3}}}},	
	[33] = {killsRequired = 400, raceName = "Mutated Bats", level = {80, 129}, premium = true, creatures = {"mutated bat"}, rewards = {{type = "exp", value = {20000}},{type = "achievement", value = {"Kapow!"}},{type = "storage", value = {35017, 1}},{type = "points", value = {2}}}},											
	[34] = {killsRequired = 650, raceName = "Hydras", level = {130, 9999}, premium = true, creatures = {"hydra"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"One Less"}},{type = "storage", value = {35018, 1}},{type = "points", value = {3}}}},	
	[35] = {killsRequired = 800, raceName = "Serpent Spawns", level = {130, 9999}, premium = true, creatures = {"serpent spawn"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Hissing Downfall"}},{type = "storage", value = {35019, 1}},{type = "points", value = {4}}}},		
	[36] = {killsRequired = 500, raceName = "Medusa", level = {130, 9999}, premium = true, creatures = {"medusa"}, rewards = {{type = "exp", value = {40000}},{type = "achievement", value = {"The Serpent's Bride"}},{type = "storage", value = {35020, 1}},{type = "points", value = {5}}}},	
	[37] = {killsRequired = 700, raceName = "Behemoths", level = {130, 9999}, premium = true, creatures = {"behemoth"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Just Cracked Me Up!"}},{type = "storage", value = {35021, 1}},{type = "points", value = {4}}}},	
	[38] = {killsRequired = 900, raceName = "Sea Serpents and Young Sea Serpents", level = {130, 9999}, premium = true, creatures = {"sea serpent", "young sea serpent"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"The Drowned Sea God"}},{type = "storage", value = {35022, 1}},{type = "points", value = {4}}}},		
	[39] = {killsRequired = 250, raceName = "Hellhounds", level = {130, 9999}, premium = true, creatures = {"hellhound"}, rewards = {{type = "exp", value = {40000}},{type = "achievement", value = {"The Gates of Hell"}},{type = "storage", value = {35023, 1}},{type = "points", value = {5}}}},		
	[40] = {killsRequired = 500, raceName = "Ghastly Dragons", level = {130, 9999}, premium = true, creatures = {"ghastly dragon"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Beautiful Agony"}},{type = "storage", value = {35024, 1}},{type = "points", value = {5}}}},		
	[41] = {killsRequired = 900, raceName = "Drakens", level = {130, 9999}, premium = true, creatures = {"draken spellweaver", "draken warmaster", "draken abomination", "draken elite"} , rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Enter zze Draken!"}},{type = "storage", value = {35025, 1}},{type = "points", value = {3}}}},	
	[42] = {killsRequired = 650, raceName = "Destroyers", level = {130, 9999}, premium = true, creatures = {"destroyer"}, rewards = {{type = "exp", value = {30000}},{type = "achievement", value = {"Best there was!"}},{type = "storage", value = {35026, 1}},{type = "points", value = {4}}}},			
	[43] = {killsRequired = 400, raceName = "Undead Dragons", level = {130, 9999}, premium = true, creatures = {"undead dragon"}, rewards = {{type = "exp", value = {50000}},{type = "achievement", value = {"Back from the Dead"}},{type = "storage", value = {35027, 1}},{type = "points", value = {6}}}},	
	[44] = {killsRequired = 6666, raceName = "Demons", level = {130, 9999}, rank = RANK_ELITEHUNTER, norepeatable = true, premium = true, creatures = {"demon"}, rewards = {{type = "storage", value = {41300, 1}}}},																																	
}
 
tasksByPlayer = 3
repeatTimes = 3
 
function getPlayerRank(cid)
	local p = Player(cid)
	return (p:getStorageValue(POINTSSTORAGE) >= 100 and RANK_ELITEHUNTER or p:getStorageValue(POINTSSTORAGE) >= 70 and RANK_TROPHYHUNTER or p:getStorageValue(POINTSSTORAGE) >= 40 and RANK_BIGGAMEHUNTER or p:getStorageValue(POINTSSTORAGE) >= 20 and RANK_RANGER or p:getStorageValue(POINTSSTORAGE) >= 10 and RANK_HUNTSMAN or p:getStorageValue(JOIN_STOR) == 1 and RANK_JOIN or RANK_NONE)
end
 
function getTaskByName(name, table)
	local t = (table and table or tasks)
	for k, v in pairs(t) do
		if(v.name) then
			if(v.name:lower() == name:lower()) then
				return k
			end
		else
			if(v.raceName:lower() == name:lower()) then
				return k
			end
		end
	end
return false
end
 
function getTasksByPlayer(cid)
	local p = Player(cid)
	local canmake = {}
	local able = {}
	for k, v in pairs(tasks) do
		if(p:getStorageValue(QUESTSTORAGE_BASE + k) < 1 and p:getStorageValue(REPEATSTORAGE_BASE + k) < repeatTimes) then
			able[k] = true
			if(p:getLevel() < v.level[1] or p:getLevel() > v.level[2]) then
				able[k] = false
			end
			if(v.storage and p:getStorageValue(v.storage[1]) < v.storage[2]) then
				able[k] = false
			end
 
			if(v.rank) then
				if(getPlayerRank(cid) < v.rank) then
					able[k] = false
				end
			end
 
			if(v.premium) then
				if(not(isPremium(cid))) then
					able[k] = false
				end
			end
 
			if(able[k]) then
				table.insert(canmake, k)
			end
		end
	end
return canmake
end
 
 
function canStartTask(cid, name, table)
	local p = Player(cid)
	local v = ""
	local id = 0
	local t = (table and table or tasks)
	for k, i in pairs(t) do
		if(i.name) then
			if(i.name:lower() == name:lower()) then
				v = i
				id = k
				break
			end
		else
			if(i.raceName:lower() == name:lower()) then
				v = i
				id = k
				break
			end
		end
	end
	if(v == "") then
		return false
	end
	if(p:getStorageValue(QUESTSTORAGE_BASE + id) > 0) then
		return false
	end
	if(p:getStorageValue(REPEATSTORAGE_BASE +  id) >= repeatTimes) or (v.norepeatable and p:getStorageValue(REPEATSTORAGE_BASE +  id) > 0) then
		return false
	end
	if(p:getLevel() >= v.level[1] and p:getLevel() <= v.level[2]) then
		if(v.premium) then
			if(isPremium(cid)) then
				if(v.rank) then
					if(getPlayerRank(cid) >= v.rank) then
						if(v.storage) then 
							if(p:getStorageValue(v.storage[1]) >= v.storage[2]) then
								return true
							end
						else
							return true
						end
					end
				else
					return true
				end
			end
		else
			return true
		end
	end
return false
end
 
function getPlayerStartedTasks(cid)
	local p = Player(cid)
	local tmp = {}
	for k, v in pairs(tasks) do
		if(p:getStorageValue(QUESTSTORAGE_BASE + k) > 0 and p:getStorageValue(QUESTSTORAGE_BASE + k) < 2) then
			table.insert(tmp, k) 
		end
	end
return tmp
end

 

creaturescript/killingInTheNameOfQuestKills

dofile('data/lib/killingInTheNameOfQuest.lua')

function onKill(cid, target, lastHit)
	local started = getPlayerStartedTasks(cid)
	if isPlayer(target) or isSummon(target) then return true end
	if started and #started > 0 then
		for _, id in ipairs(started) do
			if isInArray(tasks[id].creatures, getCreatureName(target):lower()) then
				if getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) < tasks[id].killsRequired then
					setPlayerStorageValue(cid, KILLSSTORAGE_BASE + id, getPlayerStorageValue(cid, KILLSSTORAGE_BASE + id) + 1)
				end
			end
		end
	end
	return true
end

tag 

	<event type="kill" name="killingInTheNameOfQuestKills" script="killingInTheNameOfQuestKills.lua"/>

 

Olá!! :D Obrigado por ajudar mas o meu estava idêntico, só tive que mudar os pontos para trade e demodras e o npc não reconhece trade só o offer, mas dei REP+ pela ajuda, valeu!!! s2

Meu servidor -> http://atena-global.com/

 

Visite o servidor e ajude-nos a crescer! Atena Global, um novo conceito de Tibia, o verdadeiro RPG você encontra aqui!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Cat
      Em alguns casos, o tibia 8.60 comum não abre de jeito nenhum no map editor, mesmo desmarcando check file signatures e configurando o path corretamente.
       
      Este é o client 8.60 adaptado para o Remere's Map Editor. Resolvi postar já que ele foi removido do site oficial do RME. (ficou apenas a versão para linux lá)
      Se estiver tendo problemas para abrir a versão 8.60, tente utilizar este.
                                                                                                                     
      Baixar o Tibia Client 8.60 que funciona no Remere’s Map Editor
      Essa versão do Tibia 8.60 client resolve o erro unsupported client version ou Could not locate tibia.dat and/or tibia.spr, please navigate to your tibia 8.60 installation folder.
       
      Downloads
       https://drive.google.com/file/d/0B2-sMQkWYzhGQXJuNHNRalJLMzA/view?usp=sharing

      Scan: Virus Total Scan
       
    • By Leohige
      Esse script é até bem simples, você adquire uma storage e ganha a permissão de entrar em uma sala especial através de um tile/portal para matar um Boss.
       
      Apenas uma pessoa por vez poderá entrar na sala.
      O jogador tem X minutos para matar o boss.
      A sala é aberta novamente em X minutos.
       
      Demonstrações
       
       
       
       
       
      Bom se você se você gostaria de implementar este script, você vai precisar criar uma área do seu gosto, posicionar um tile/teleport que desejar para o jogador poder entrar no local e outro para ele poder sair. O de tile/teleport de entrada precisará ter a actionid igual a 65535, e o de saida 65534. Após ter feito isso crie e modifique os arquivos abaixo.
       
      data/movements/scripts/boss.lua (configure as primeiras linhas a seu gosto)
       
       
      data/movements/movements.xml (se for usar 1 tile/teleport diferente para entrada e saída coloque duas linhas com os 2 ids)
       
       
      **Não se esqueça de configurar a areascan e areacenter, coloque a altura e largura minima e máxima da área onde o Boss estará, caso você não faça isso o Boss não será removido quando o local for fechado, e nem o player será expulso. 
       
      **Recomendo que coloque no logout por toda a sala do Boss, evitando assim que engraçadinhos tentem atrapalhar os outros jogadores.
    • By axebruno
      BOM DIA , BOA TARDE, BOA NOITE, 
      PRECISO DE AJUDA URGENTE, TENHO UM SERVIDOR 8.54 NÃO ESTÁ ONLINE NO MOMENTO POIS ESTÁ 8.54.
      PRECISO DE AJUDA PARA MUDAR ELE PARA 8.60, COMO CONSIGO FAZER ISSO?
      ALGUEM PODE ME AJUDAR? OBRIGADO!
    • By Cat
      Extensions Customizadas II - Walls
      Extensions Customizadas I - Grounds
      Extensions Customizadas III - Doodads (objetos montados)
       


       
      Sumário
      A. Escolha do item e arquivos que serão alterados.
      B. Edição do arquivo grounds.xml e adição da base para um novo brush.
      C. Explicação sobre o que modificar nas linhas adicionadas.
      D. Edição do arquivo borders.xml e adição da base para as bordas do brush anterior.
      E. Configuração dos Ids das bordas e do brush.
      F. Cadastramento do brush na paleta terrain, editando o arquivo tilesets.xml
       
       
       
      COMEÇAR
      (Dica: Utilize Notepad++)
       
       

       

       

       

       
      A.
      Tudo que está em azul nas imagens acima é onde você vai clicar e/ou editar. Recomendo backup. Cuidado para não modificar qualquer linha por acidente ou sem saber o que está fazendo, uma letra errada já é o suficiente pra dar erro na hora de abrir o mapa. Escolha o piso que você quer adicionar. Vou escolher o dark spikes para usar como exemplo, ok? (na imagem, ele já está pronto e adicionado na paleta)  
        
       
      B.
      Abra grounds.xml. Repare que o documento começa com <materials> e termina com </materials> Desça até o final do código. Antes do </materials> há algum item cadastrado, um </brush> Alguma coisa ... </brush>. Após o último brush, e antes do </materials>, cole o seguinte código:  
      <brush name="ITEMNOME" type="ground" server_lookid="ITEMID - ID PRA APARECER NA PALETA" z-order="NUMERO"> <item id="ID" chance="100"/> <item id="ID" chance="100"/> <item id="ID" chance="100"/> <item id="ID" chance="100"/> <border align="outer" id="NUMEROBORDA"/> </brush>  
      C.
      Server_lookid é pra por o ID da sprite que vai aparecer na paleta, pra identificar o atalho. Coloque o ID do ground principal caso tenha mais versões do mesmo. Em Z-order, se o brush X tiver z-order maior que brush Y, a borda de brush X vai sobrepor a do Y. Item Id e chances, adicione os grounds e mude o valor da chance para definir qual deles vai predominar caso houver vários, como por exemplo o grass, que tem diversas sprites diferentes. Se for apenas uma sprite, pode deixar uma linha. Border align, tem outer e inner. São para as duas finalidades apresentadas nas imagens abaixo.  
       

      (No inner dessa imagem, fora utilizado  <border align="inner" to="none" id="1"/>, que é padrão para vários brushs)
       
      O codigo do Dark Spikes ficará assim:
      <brush name="dark spikes" type="ground" server_lookid="12234" z-order="3200"> <item id="12234" chance="2500"/> <item id="12235" chance="2500"/> <item id="12236" chance="2500"/> <item id="12237" chance="2500"/> <border align="outer" id="155"/> </brush>  
       
      D.
      Revise o que você modificou e salve. Abra borders.xml. O esquema é o mesmo, desça até o final e depois de  </border> e antes de </materials>, adicione o código abaixo:    
      <border id="NUMEROBORDA"> -- NOME -- <borderitem edge="n" item="ID"/> <borderitem edge="e" item="ID"/> <borderitem edge="s" item="ID"/> <borderitem edge="w" item="ID"/> <borderitem edge="cnw" item="ID"/> <borderitem edge="cne" item="ID"/> <borderitem edge="csw" item="ID"/> <borderitem edge="cse" item="ID"/> <borderitem edge="dnw" item="ID"/> <borderitem edge="dne" item="ID"/> <borderitem edge="dsw" item="ID"/> <borderitem edge="dse" item="ID"/> </border>  
      E.
      O número que estiver em border id vai servir para ligar essass bordas ao brush criado anteriormente. Identifique o nome do brush a qual essa borda pertence para ficar fácil encontrar mais tarde ( -- exemplo -- ) Siga a tabela abaixo para configurar as bordas, conforme a posição delas:  

       
       
      O código das bordas do dark spikes ficará assim:
      <border id="155"> -- dark spikes border -- <borderitem edge="n" item="12255"/> <borderitem edge="e" item="12256"/> <borderitem edge="s" item="12254"/> <borderitem edge="w" item="12257"/> <borderitem edge="cnw" item="12264"/> <borderitem edge="cne" item="12265"/> <borderitem edge="csw" item="12263"/> <borderitem edge="cse" item="12262"/> <borderitem edge="dnw" item="12260"/> <borderitem edge="dne" item="12261"/> <borderitem edge="dsw" item="12259"/> <borderitem edge="dse" item="12258"/> </border>  
      F.
      Agora que o ground foi criado e as bordas configuradas, é preciso adicionar o atalho na paleta, para poder usá-lo. Abra tilesets.xml. Dê um ctrl + f e procure por: <tileset name="Nature"> em terrain. Ou no local que você preferir. Também pode colocar na ordem que quiser, reinicie o editor e teste.  
      Dúvidas? Comente.
       
       
       
       
       
       
       
       
       
       
    • By ossanes
      Galera, estou a mais de uma semana batendo cabeça e não consigo de jeito algum compilar as source que me mandaram pra uma distro win, lembrando q ela é a base otx. alguem pode me dar uma luz ?
  • Recently Browsing   0 members

    No registered users viewing this page.


×
×
  • Create New...

Important Information

Confirmação de Termo