Ir para conteúdo

Featured Replies

Postado
Em 20/08/2020 em 22:47, Mor3nao disse:

Introdução:

     Eu estava procurando um sistema de tasks diarias funcional, achei alguns, mas nenhum do jeito que eu queria, então eu fiz esse.

Ele tá bem simples, porém funcional, aí vou postar uma "melhoria" dele e linkar AQUI  << tá linkado, dá uma olhada lá ?

 

Como funciona?

        Bom, eu me baseei no sistema de tasks do PxG onde você pode escolher entre tasks de diferentes niveis/dificuldades, no caso, este é possivel que vc escolha entre 4 opções, sendo elas de nivel "easy", "medium", "hard" e "expert", e tem até o server save para entregar.

Como prêmios, coloquei: Quantidade aleatoria de XP, Quantidade fixa de um Item fixo e quantidade aleatoria de um(ou mais) item aleatorio.

 

Como "instalar" o script:

1.1 Vá até /data/npc e crie o arquivo daily.xml, abra-o e coloque tudo isso lá dentro:

  Ocultar conteúdo


<?xml version="1.0" encoding="UTF-8"?>
<npc name="Iwan" walkinterval="2000" floorchange="0" script="dailyTask.lua">
	<health now="100" max="100"/>
	<look type="128" head="0" body="112" legs="107" feet="113" addons="0"/>
</npc>

 

 

1.2 Vá até /data/npc/scripts e adicione o arquivo dailyTask.lua, e dentro dele coloque:

  Ocultar conteúdo


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local condition = Condition(CONDITION_BLEEDING)
condition:setParameter(CONDITION_PARAM_DELAYED, 1)
condition:addDamage(1200, 500, -100)

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 function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end
	local aa, bb, cc, dd, ee, ff = 0
	local player = Player(cid)
		
		if msgcontains(msg, "help") then
			npcHandler:say("I can offer you some {daily tasks}.", cid)
		elseif msgcontains(msg, "task") or msgcontains(msg, "tasks") or msgcontains(msg, "daily") or msgcontains(msg, "tarefa") or  msgcontains(msg, "tarefas") or msgcontains(msg, "diaria") then
			if player:getStorageValue(DT_STORAGES.HAVE_STARTED) > 0 then
				return npcHandler:say("You have already started your daily task today.", cid)
			elseif player:getStorageValue(DT_STORAGES.HAVE_STARTED) == -2 then
				return npcHandler:say("You have already completed your daily task today.", cid)
			end
			npcHandler:say("I have tasks of level {Easy}, {Medium}, {Hard} and {Expert}. Which one do you want to do?", cid)
			npcHandler.topic[cid] = 1
		else
			npcHandler:say("What are you talking about??", cid)
		end
		
	if npcHandler.topic[cid] == 1 then
		if msgcontains(msg, "easy") then
		if DT_PREMIOQTDE_EASY > 0 then
			npcHandler:say("Your EASY daily task today is: Kill {".. DT_NEEDKILL_EASY .."} {".. DT_CHOSENTASK_EASY .."}(s).\nIf you finish before {6:00am (GTM-3)}, you will receive:\n*{".. DT_PREMIOQTDE_EASY .."}x "..getAllTableText(DT_PRIZENAME_EASY, "or")..", chosen at random;\n*{"..DT_PREMIOFIXO_QTDE_EASY.."}x "..DT_PREMIOFIXO_NAME_EASY..";\n*{"..DT_EXPPRIZE_EASY.."} Experience points;\n*{"..DT_TASKPOINTS_EASY.."}x Task Point.\nDo you want to start this {EASY} task?", cid)
		else
			npcHandler:say("Your EASY daily task today is: Kill {".. DT_NEEDKILL_EASY .."} {".. DT_CHOSENTASK_EASY .."}(s).\nIf you finish before {6:00am (GTM-3)}, you will receive:\n*{"..DT_PREMIOFIXO_QTDE_EASY.."}x "..DT_PREMIOFIXO_NAME_EASY..";\n*{"..DT_EXPPRIZE_EASY.."} Experience points;\n*{"..DT_TASKPOINTS_EASY.."}x Task Point.\nDo you want to start this {EASY} task?", cid)
		end
			npcHandler.topic[cid] = 3
		elseif msgcontains(msg, "medium") then
			npcHandler:say("Your MEDIUM daily task today is: Kill {".. DT_NEEDKILL_MEDIUM .."}{ ".. DT_CHOSENTASK_MEDIUM .."}(s).\nIf you finish before {6:00am (GTM-3)}, you will receive:\n*{".. DT_PREMIOQTDE_MEDIUM .."}x "..getAllTableText(DT_PRIZENAME_MEDIUM, "or")..", chosen at random;\n*{"..DT_PREMIOFIXO_QTDE_MEDIUM.."}x "..DT_PREMIOFIXO_NAME_MEDIUM..";\n*{"..DT_EXPPRIZE_MEDIUM.."} Experience points;\n*{"..DT_TASKPOINTS_MEDIUM.."}x Task Point.\nDo you want to start this {MEDIUM} task?", cid)
			npcHandler.topic[cid] = 4		
		elseif msgcontains(msg, "hard") then
			npcHandler:say("Your HARD daily task today is: Kill {".. DT_NEEDKILL_HARD .."}{ ".. DT_CHOSENTASK_HARD .."}(s).\nIf you finish before {6:00am (GTM-3)}, you will receive:\n*{".. DT_PREMIOQTDE_HARD .."}x "..getAllTableText(DT_PRIZENAME_HARD, "or")..", chosen at random;\n*{"..DT_PREMIOFIXO_QTDE_HARD.."}x "..DT_PREMIOFIXO_NAME_HARD..";\n*{"..DT_EXPPRIZE_HARD.."} Experience points;\n*{"..DT_TASKPOINTS_HARD.."}x Task Point.\nDo you want to start this {HARD} task?", cid)
			npcHandler.topic[cid] = 5		
		elseif msgcontains(msg, "expert") then
			npcHandler:say("Your EXPERT daily task today is: Kill {".. DT_NEEDKILL_EXPERT .." }{".. DT_CHOSENTASK_EXPERT .."}(s).\nIf you finish before {6:00am (GTM-3)}, you will receive:\n*{".. DT_PREMIOQTDE_EXPERT .."}x "..getAllTableText(DT_PRIZENAME_EXPERT, "or")..", chosen at random;\n*{"..DT_PREMIOFIXO_QTDE_EXPERT.."}x "..DT_PREMIOFIXO_NAME_EXPERT..";\n*{"..DT_EXPPRIZE_EXPERT.."} Experience points;\n*{"..DT_TASKPOINTS_EXPERT.."}x Task Point.\nDo you want to start this {EXPERT} task?", cid)
			npcHandler.topic[cid] = 6		
		end
	end
	if msgcontains(msg, "yes") then
		if npcHandler.topic[cid] == 3 then	
		npcHandler:say("Ok, don't waste time! You must kill all these monsters and return to receive your reward before {6:00 am}(GMT-3).", cid)
		player:setStorageValue(DT_STORAGES.EASY, 0)
		player:setStorageValue(DT_STORAGES.HAVE_STARTED, 1)
		elseif npcHandler.topic[cid] == 4 then
		npcHandler:say("Ok, don't waste time! You must kill all these monsters and return to receive your reward before {6:00 am}(GMT-3).", cid)
		player:setStorageValue(DT_STORAGES.MEDIUM, 0)
		player:setStorageValue(DT_STORAGES.HAVE_STARTED, 2)
		elseif npcHandler.topic[cid] == 5 then
		npcHandler:say("Ok, don't waste time! You must kill all these monsters and return to receive your reward before {6:00 am}(GMT-3).", cid)
		player:setStorageValue(DT_STORAGES.HARD, 0)
		player:setStorageValue(DT_STORAGES.HAVE_STARTED, 3)
		elseif npcHandler.topic[cid] == 6 then
		npcHandler:say("Ok, don't waste time! You must kill all these monsters and return to receive your reward before {6:00 am}(GMT-3).", cid)
		player:setStorageValue(DT_STORAGES.EXPERT, 0)
		player:setStorageValue(DT_STORAGES.HAVE_STARTED, 4)
		end		
	end

	if msgcontains(msg, "report") then
		if player:getStorageValue(DT_STORAGES.HAVE_STARTED) == 1 then
			if player:getStorageValue(DT_STORAGES.EASY) >= DT_NEEDKILL_EASY then
				npcHandler:say("Just in time! Here are your rewards, come back tomorrow for another task!", cid)
				player:setStorageValue(DT_STORAGES.HAVE_STARTED, -2)
				
				player:addExperience(DT_EXPPRIZE_EASY) --exp
				
				player:addItem(DT_PREMIOFIXO_ID_EASY, DT_PREMIOFIXO_QTDE_EASY) --fixo
				if DT_PREMIOQTDE_EASY > 0 then --rand
					if DT_PREMIOQTDE_EASY == 1 then --rand
						aa = math.random(#DT_PRIZEID_EASY)
						player:addItem(DT_PRIZEID_EASY[aa], 1)
					else
						for i = 1, tonumber(DT_PREMIOQTDE_EASY) do
							aa = math.random(#DT_PRIZEID_EASY)
							player:addItem(DT_PRIZEID_EASY[aa], 1)
						end
					end
				end
			else
				npcHandler:say("You haven't finished your task yet. You still have to kill {"..DT_NEEDKILL_EASY - player:getStorageValue(DT_STORAGES.EASY) .."} "..DT_CHOSENTASK_EASY.."(s).", cid)
			end			
		elseif player:getStorageValue(DT_STORAGES.HAVE_STARTED) == 2 then
			if player:getStorageValue(DT_STORAGES.MEDIUM) >= DT_NEEDKILL_MEDIUM then
				npcHandler:say("Just in time! Here are your rewards, come back tomorrow for another task!", cid)
				player:setStorageValue(DT_STORAGES.HAVE_STARTED, -2)
				
				player:addExperience(DT_EXPPRIZE_MEDIUM) --exp
				
				player:addItem(DT_PREMIOFIXO_ID_MEDIUM, DT_PREMIOFIXO_QTDE_MEDIUM) --fixo
				
				if DT_PREMIOQTDE_MEDIUM > 0 then --rand
					if DT_PREMIOQTDE_MEDIUM == 1 then --rand
						aa = math.random(#DT_PRIZEID_MEDIUM)
						player:addItem(DT_PRIZEID_MEDIUM[aa], 1)
					else
						for i = 1, tonumber(DT_PREMIOQTDE_MEDIUM) do
							aa = math.random(#DT_PRIZEID_MEDIUM)
							player:addItem(DT_PRIZEID_MEDIUM[aa], 1)
						end
					end
				end
			else
				npcHandler:say("You haven't finished your task yet. You still have to kill {"..DT_NEEDKILL_MEDIUM - player:getStorageValue(DT_STORAGES.MEDIUM) .."} "..DT_CHOSENTASK_MEDIUM.."(s).", cid)
			end	
		elseif player:getStorageValue(DT_STORAGES.HAVE_STARTED) == 3 then
			if player:getStorageValue(DT_STORAGES.HARD) >= DT_NEEDKILL_HARD then
				npcHandler:say("Just in time! Here are your rewards, come back tomorrow for another task!", cid)
				player:setStorageValue(DT_STORAGES.HAVE_STARTED, -2)
				
				player:addExperience(DT_EXPPRIZE_HARD) --exp
				
				player:addItem(DT_PREMIOFIXO_ID_HARD, DT_PREMIOFIXO_QTDE_HARD) --fixo
				
				if DT_PREMIOQTDE_HARD > 0 then --rand
					if DT_PREMIOQTDE_HARD == 1 then --rand
						aa = math.random(#DT_PRIZEID_HARD)
						player:addItem(DT_PRIZEID_HARD[aa], 1)
					else
						for i = 1, tonumber(DT_PREMIOQTDE_HARD) do
							aa = math.random(#DT_PRIZEID_HARD)
							player:addItem(DT_PRIZEID_HARD[aa], 1)
						end
					end
				end
			else
				npcHandler:say("You haven't finished your task yet. You still have to kill {"..DT_NEEDKILL_HARD - player:getStorageValue(DT_STORAGES.HARD) .."} "..DT_CHOSENTASK_HARD.."(s).", cid)
			end	
		elseif player:getStorageValue(DT_STORAGES.HAVE_STARTED) == 4 then
			if player:getStorageValue(DT_STORAGES.EXPERT) >= DT_NEEDKILL_EXPERT then
				npcHandler:say("Just in time! Here are your rewards, come back tomorrow for another task!", cid)
				player:setStorageValue(DT_STORAGES.HAVE_STARTED, -2)
				
				player:addExperience(DT_EXPPRIZE_EXPERT) --exp
				
				player:addItem(DT_PREMIOFIXO_ID_EXPERT, DT_PREMIOFIXO_QTDE_EXPERT) --fixo
				
				if DT_PREMIOQTDE_EXPERT > 0 then --rand
					if DT_PREMIOQTDE_EXPERT == 1 then --rand
						aa = math.random(#DT_PRIZEID_EXPERT)
						player:addItem(DT_PRIZEID_EXPERT[aa], 1)
					else
						for i = 1, tonumber(DT_PREMIOQTDE_EXPERT) do
							aa = math.random(#DT_PRIZEID_EXPERT)
							player:addItem(DT_PRIZEID_EXPERT[aa], 1)
						end
					end
				end
			else
				npcHandler:say("You haven't finished your task yet. You still have to kill {"..DT_NEEDKILL_EXPERT - player:getStorageValue(DT_STORAGES.EXPERT) .."} "..DT_CHOSENTASK_EXPERT.."(s).", cid)
			end	
		else
			npcHandler:say("Uhn.. What are you talking about??", cid)
			npcHandler.topic[cid] = 0
		end
	end
end
npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME| i've some {tasks} for u.")
npcHandler:setMessage(MESSAGE_FAREWELL, 'Bye.')

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

 

2.1 Em /data/lib/lib.lua, acrescente a linha:


dofile('data/lib/task/dailytask.lua')

 

2.2 Crie o arquivo dailytask.lua em /data/lib/task/, e dentro coloque:

  Ocultar conteúdo


-- CONFIGS

local easy = {
minQTDE = 50,
maxQTDE = 300,

minEXP = 250000,
maxEXP = 750000,

prizesID = {22607, 22604},
prizesNAME = {"Boss Key", "Hunt Key"},
minQTDEPremios = 0,
maxQTDEPremios = 2,

PremioFixoID = 25377,
PremioFixoNAME = "Gold Token",
PremioFixoQTDE = 1,

taskPoints = 1
}

local medium = {
minQTDE = 100,
maxQTDE = 400,

minEXP = 500000,
maxEXP = 1500000,

prizesID = {22607, 22604},
prizesNAME = {"Boss Key", "Hunt Key"},
minQTDEPremios = 1,
maxQTDEPremios = 3,

PremioFixoID = 25377,
PremioFixoNAME = "Gold Token",
PremioFixoQTDE = 2,

taskPoints = 2
}

local hard = {
minQTDE = 150,
maxQTDE = 500,

minEXP = 1000000,
maxEXP = 3000000,

prizesID = {22607, 22604},
prizesNAME = {"Boss Key", "Hunt Key"},
minQTDEPremios = 2,
maxQTDEPremios = 4,

PremioFixoID = 25377,
PremioFixoNAME = "Gold Token",
PremioFixoQTDE = 3,

taskPoints = 3
}

local expert = {
minQTDE = 200,
maxQTDE = 600,

minEXP = 2000000,
maxEXP = 6000000,

prizesID = {22607, 22604},
prizesNAME = {"Boss Key", "Hunt Key"},
minQTDEPremios = 3,
maxQTDEPremios = 5,

PremioFixoID = 25377,
PremioFixoNAME = "Gold Token",
PremioFixoQTDE = 4,

taskPoints = 4
}

DT_TasksEasy = {"Minotaur", "Minotaur Guard", "Minotaur Mage", "Minotaur Archer", "Larva", "Scarab", "Wyvern", "Rorc", "Wolf", "War Wolf", "Orc Berserker", "Orc Warrior", "Orc Shaman", "Orc Leader", "Orc", "Cyclops", "Orc Rider", "Slime", "Orc Warlord", "Water Elemental", "Quara Mantassin Scout", "Gargoyle", "Mummy", "Crypt Shambler", "Demon Skeleton", "Ghost", "Zombie", "Rotworm", "Carrion Worm", "Rotworm Queen", "Tortoise", "Thornback Tortoise", "Toad", "Crab", "Blood Crab", "Killer Caiman", "Ghoul", "Scorpion", "Banshee", "Fire Devil", "Amazon", "Valkyrie", "Witch", "Leaf Golem", "Forest Fury", "Troll", "Goblin", "Troll Champion", "Goblin Scavanger", "Goblin Assassin", "Corym Vanguard", "Corym Skirmisher", "Corym Charlatan", "Ghost Wolf", "Gloom Wolf", "Elf", "Elf Arcanist", "Elf Scout", "Firestarter", "Bat", "Swamp Troll", "Stonerefiner", "Tarantula", "Dragon Hatchling", "Nomad", "Scorpion", "Dwarf", "Dwarf Soldier", "Dwarf Guard", "Kongra", "Sibang", "Merlkin", "Gazer", "Bonelord", "Elder Bonelord", "Braindeath"}
DT_TasksMedium = {"Vicious Squire", "Vile Grandmaster", "Renegade Knight", "Cult Believer", "Cult Enforcer", "Cult Scholar", "Ghastly Dragon", "Lizard Chosen", "Giant Spider", "Tarantula", "Bog Raider", "Earth Elemental", "Enfeebled Silencer", "Weakened Frazzlemaw", "Noble Lion", "Ancient Scarab", "Roaring Lion", "Souleater", "Mutated Bat", "Mutated Rat", "Mutated Tiger", "Warlock", "Yielothax", "Killer Caiman", "Vampire Bridge", "Vampire Viscount", "Vampire", "Bonebeast", "Necromancer", "Quara Predator", "Quara Constrictor", "Quara Mantassin", "Quara Pincher", "Quara Hydromancer", "Quara Predator Scout", "Quara Constrictor Scout", "Quara Mantassin Scout", "Quara Pincher Scout", "Quara Hydromancer Scout", "Wyrm", "Behemoth", "Nightstalker", "Giant Spider", "Energy Elemental", "Stampor", "Bonebeast", "Orc Cult Inquisitor", "Orc Cult Minion", "Orc Cultist", "Orc Cult Priest", "Orc Cult Fanatic", "Lost Husher", "Lost Basher", "Lost Thrower", "enslaved Dwarf", "Dragon", "Dragon Lord", "Barkless Devotee", "Barkless Fanatic", "Massive Water Elemental", "Minotaur Cult Follower", "Minotaur Cult Prophet", "Minotaur Cult Zealot" }
DT_TasksHard = {"Vicious Squire", "Vile Grandmaster", "Renegade Knight", "Hero", "Necromancer", "Lich", "Werebear", "Wereboar", "Werebadger", "Werewolf", "Askarak Demon", "Shaburak Demon", "Wyrm", "Elder Wyrm", "Vampire Viscount", "Blood Priest", "Shadow Pupil", "White Shade", "Vampire", "Putrid Mummy", "Giant Spider", "Fury", "Massive Fire Elemental", "Dragonling", "Hellfire Fighter", "Diabolic Imp", "Hellhound", "Infernalist", "Behemoth", "Dawnfire Asura", "Midnight Asura", "Hellspawn", "Plaguesmith", "Medusa", "Serpent Spawn", "Hydra", "Dark Faun", "Boogy", "Twisted Pooka", "Draken Elite", "Draken Warmaster", "Draken Spellweaver", "Draken Abomination", "Lizard Legionnaire", "Lizard Dragon Priest", "Lizard High Guard", "Lizard Chosen", "Ghastly Dragon"}
DT_TasksExpert = {"Guzzlemaw", "Sight of Surrender", "Terrorsleep", "Silencer", "Dark Torturer", "Demon Outcast", "Betrayed Wraith", "Plaguesmith", "Blightwalker", "Nightmare", "Juggernault", "Hellhound", "Crazed Winter Rearguard", "Crazed Winter Vanguard", "Crazed Summer Rearguard", "Crazed Summer Vanguard", "Spiky Carnivor", "Lumbering Carnivor", "Menacing Carnivor", "Vexclaw", "Grimeleech", "Demon", "Hellflayer", "Hellfire Fighter", "Fury", "Undead Dragon", "Phantasm", "Nightmare", "Defiler", "Plaguesmith", "Spectre", "Hand of Cursed Fate", "Undead Elite Gladiator", "Skeleton Elite Warrior", "Grim Reaper", "Gravedigger", "Floating Servant", "Lava Luker Attendant", "Cobra Assassin", "Cobra Vizier", "Cobra Scout", "Dread Intruder", "Reality Reaver", "Sparkion", "Breach Brood", "Choking Fear", "Retching Horror", "Animated Feather", "Biting Book", "Brain Squid", "Burning Book", "Cursed Book", "Energetic Book", "Energuardian of Tales", "Flying Book", "Guardian of Tales", "Icecold Book", "Ink Blob", "Knowledge Elemental", "Rage Squid", "Squid Warden", "Lost Soul", "Falcon Knight", "Falcon Paladin"}

-- SCRIPT

	
	DT_STORAGES = {
		PONTOS = 367643975,
		EXPERT = 367643974,
		HARD = 367643973,
		MEDIUM = 367643972,
		EASY = 367643971,
		HAVE_STARTED = 367643970,
			}
			
	--RESETAR STORAGES
		for i = 1, 6 do
		db.query('DELETE FROM `player_storage` WHERE `player_storage`.`key` = '.. 367643969+i ..'')
		end	
		
	-- EASY (100-)
		DT_CHOSENTASK_EASY = DT_TasksEasy[math.random(#DT_TasksEasy)]
		DT_NEEDKILL_EASY = math.ceil(math.random(easy.minQTDE, easy.maxQTDE))
		DT_EXPPRIZE_EASY = math.random(easy.minEXP, easy.maxEXP)
		
		DT_PRIZEID_EASY = easy.prizesID
		DT_PRIZENAME_EASY = easy.prizesNAME
		DT_PREMIOQTDE_EASY = math.random(easy.minQTDEPremios, easy.maxQTDEPremios)
		
		DT_PREMIOFIXO_ID_EASY = easy.PremioFixoID
		DT_PREMIOFIXO_NAME_EASY = easy.PremioFixoNAME
		DT_PREMIOFIXO_QTDE_EASY = easy.PremioFixoQTDE
		
		DT_TASKPOINTS_EASY = easy.taskPoints
		
	-- MEDIUM (150-)
		DT_CHOSENTASK_MEDIUM = DT_TasksMedium[math.random(#DT_TasksMedium)]
		DT_NEEDKILL_MEDIUM = math.ceil(math.random(medium.minQTDE, medium.maxQTDE))
		DT_EXPPRIZE_MEDIUM = math.random(medium.minEXP, medium.maxEXP)
		
		DT_PRIZEID_MEDIUM = medium.prizesID
		DT_PRIZENAME_MEDIUM = medium.prizesNAME
		DT_PREMIOQTDE_MEDIUM = math.random(medium.minQTDEPremios, medium.maxQTDEPremios)
		
		DT_PREMIOFIXO_ID_MEDIUM = medium.PremioFixoID
		DT_PREMIOFIXO_NAME_MEDIUM = medium.PremioFixoNAME
		DT_PREMIOFIXO_QTDE_MEDIUM = medium.PremioFixoQTDE
		
		DT_TASKPOINTS_MEDIUM = medium.taskPoints
	
	--HARD (200-)
		DT_CHOSENTASK_HARD = DT_TasksHard[math.random(#DT_TasksHard)]
		DT_NEEDKILL_HARD = math.ceil(math.random(hard.minQTDE, hard.maxQTDE))
		DT_EXPPRIZE_HARD = math.random(hard.minEXP, hard.maxEXP)
		
		DT_PRIZEID_HARD = hard.prizesID
		DT_PRIZENAME_HARD = hard.prizesNAME
		DT_PREMIOQTDE_HARD = math.random(hard.minQTDEPremios, hard.maxQTDEPremios)
		
		DT_PREMIOFIXO_ID_HARD = hard.PremioFixoID
		DT_PREMIOFIXO_NAME_HARD = hard.PremioFixoNAME
		DT_PREMIOFIXO_QTDE_HARD = hard.PremioFixoQTDE
		
		DT_TASKPOINTS_HARD = hard.taskPoints
		
	--EXPERT (200+)
		DT_CHOSENTASK_EXPERT = DT_TasksExpert[math.random(#DT_TasksExpert)]
		DT_NEEDKILL_EXPERT = math.ceil(math.random(expert.minQTDE, expert.maxQTDE))
		DT_EXPPRIZE_EXPERT = math.random(expert.minEXP, expert.maxEXP)
		
		DT_PRIZEID_EXPERT = expert.prizesID
		DT_PRIZENAME_EXPERT = expert.prizesNAME
		DT_PREMIOQTDE_EXPERT = math.random(expert.minQTDEPremios, expert.maxQTDEPremios)
		
		DT_PREMIOFIXO_ID_EXPERT = expert.PremioFixoID
		DT_PREMIOFIXO_NAME_EXPERT = expert.PremioFixoNAME
		DT_PREMIOFIXO_QTDE_EXPERT = expert.PremioFixoQTDE
		
		DT_TASKPOINTS_EXPERT = expert.taskPoints

		-- FUNÇÃO PRA PEGAR OS NOMES DOS ITEM
function getAllTableText(aa, bb, cc)
local tablecheck = aa

if not tablecheck then
	return false
end

local lang = bb
local ponto = ""
if not lang then
	lang = "and"
end
if cc then
ponto = "."
end
local text = ""
for i = 1, #tablecheck do
	if i == 1 then
	text = tablecheck[i]
	elseif i == #tablecheck then
	text = text .." "..lang.." "..tablecheck[i]..""..ponto..""
	else
	text = text ..", "..tablecheck[i]
	end
end
return text
end

 

 

 

3.1 Em /data/creaturescript/creaturescripts.xml adicione a tag:


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

 

3.2 Registre o "dailyTasks" no seu login.lua

 

3.3 Crie o arquivo dailyTasks.lua em /data/creaturescript/scripts e coloque tudo isso dentro:

  Mostrar conteúdo oculto


function onKill(player, target)
local monster = getCreatureName(target)
	
local KILL_EASY = player:getStorageValue(DT_STORAGES.EASY)
local KILL_MEDIUM = player:getStorageValue(DT_STORAGES.MEDIUM)
local KILL_HARD = player:getStorageValue(DT_STORAGES.HARD)
local KILL_EXPERT = player:getStorageValue(DT_STORAGES.EXPERT)

local isDOING = player:getStorageValue(DT_STORAGES.HAVE_STARTED)

if isDOING == 1 then
	if monster:lower() == DT_CHOSENTASK_EASY:lower() then
				player:setStorageValue(DT_STORAGES.EASY, KILL_EASY + 1)
		if KILL_EASY >= DT_NEEDKILL_EASY then
				player:sendTextMessage(30, "[DAILY TASK] You successully killed "..DT_NEEDKILL_EASY.." "..monster..". Talk to Iwan about it.")
			else
				player:sendTextMessage(30, "[DAILY TASK] You killed a "..monster..". There are still "..DT_NEEDKILL_EASY-KILL_EASY-1 .." to kill.")
		end
	end
elseif isDOING == 2 then
	if monster:lower() == DT_CHOSENTASK_MEDIUM:lower() then
				player:setStorageValue(DT_STORAGES.MEDIUM, KILL_MEDIUM + 1)
		if KILL_MEDIUM >= DT_NEEDKILL_MEDIUM then
				player:sendTextMessage(30, "[DAILY TASK] You successully killed "..DT_NEEDKILL_MEDIUM.." "..monster..". Talk to Iwan about it.")
			else
				player:sendTextMessage(30, "[DAILY TASK] You killed a "..monster..". There are still "..DT_NEEDKILL_MEDIUM-KILL_MEDIUM-1 .." to kill.")		
		end
	end
elseif isDOING == 3 then
	if monster:lower() == DT_CHOSENTASK_HARD:lower() then
				player:setStorageValue(DT_STORAGES.HARD, KILL_HARD + 1)
		if KILL_HARD >= DT_NEEDKILL_HARD then
				player:sendTextMessage(30, "[DAILY TASK] You successully killed "..DT_NEEDKILL_HARD.." "..monster..". Talk to Iwan about it.")
			else
				player:sendTextMessage(30, "[DAILY TASK] You killed a "..monster..". There are still "..DT_NEEDKILL_HARD-KILL_HARD-1 .." to kill.")		
		end
	end
elseif isDOING == 4 then
	if monster:lower() == DT_CHOSENTASK_EXPERT:lower() then
				player:setStorageValue(DT_STORAGES.EXPERT, KILL_EXPERT + 1)
		if KILL_EXPERT >= DT_NEEDKILL_EXPERT then
				player:sendTextMessage(30, "[DAILY TASK] You successully killed "..DT_NEEDKILL_EXPERT.." "..monster..". Talk to Iwan about it.")
			else
				player:sendTextMessage(30, "[DAILY TASK] You killed a "..monster..". There are still "..DT_NEEDKILL_EXPERT-KILL_EXPERT-1 .." to kill.")		
		end
	end
end

return true
end

 

 

Configurando o Script:

Essas configurações estão no:  /data/lib/task/dailytasks.lua

 

 

Imagens de amostra:

Escolhendo as tasks(A da direita é antes de save, e a da esquerda depois).

image.thumb.png.57869453e435c27f1188fd2e0268cf0a.png

 

Server Log contando quantos monstros foram mortos.

image.thumb.png.90ccae6a6675b184b829f25db5165236.png

 

Na bp normal os premios da primeira vez que eu fiz, na azul os premios da segunda (só pra mostrar que é aleatorio, um player não pode repetir a task)

image.png.1b4eb80df7eb59db4212f7f01f79aa9d.png

 

d pra 8.54?¡

  • 3 months later...
  • Respostas 19
  • Visualizações 8.8k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Infelizmente não é compativel com o 0.4, teria que adaptar =\   Abra o: creaturescripts/scripts/login.lua  e coloque essa linha: player:registerEvent("dailyTasks")

  • Corrigi! o basta atualizar o dailyTasks.lua em /data/creaturescript/scripts   Pior que não, sei que a maioria é 0.4 e se tivesse jeito de mudar pra 0.4, eu mudaria, mas não tem um modo "au

Posted Images

  • 4 months later...
  • 1 month later...
  • 4 months later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo