Ir para conteúdo
  • Cadastre-se

NPC TFS 1.X [NPC] Daily Task com 4 opções diarias.


Posts Recomendados

  • Moderador

Tópico aprovado e agradecemos pela contribuição.

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
  • 3 weeks later...
9 horas atrás, diarmaint disse:

Não tem, estou usando tfs 0.4

Infelizmente não é compativel com o 0.4, teria que adaptar =\

 

2 horas atrás, wizinx disse:

Registre o "dailyTasks" no seu login.lua <<- como registro eso en tfs 1.3 ???, gracias

Abra o: creaturescripts/scripts/login.lua  e coloque essa linha: player:registerEvent("dailyTasks")

MEUS POSTS:

 

SE AJUDEI, DÁ O REP+, ESQUECE NÃO, VLW BB <3

Link para o post
Compartilhar em outros sites
18 horas atrás, Mor3nao disse:

Infelizmente não é compativel com o 0.4, teria que adaptar =\

 

Abra o: creaturescripts/scripts/login.lua  e coloque essa linha: player:registerEvent("dailyTasks")

teria como colocar compatível com 0.4? já que é bastante usado pela comunidade. 

Link para o post
Compartilhar em outros sites
5 horas atrás, wizinx disse:

Hola amigo, tengo un problema, en la task expert no baja el contador de monster, te adjunto una imagen.

task.png

Corrigi! o basta atualizar o dailyTasks.lua em /data/creaturescript/scripts

 

23 horas atrás, XGaduX disse:

teria como colocar compatível com 0.4? já que é bastante usado pela comunidade. 

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 "automatico" de se fazer isso, eu teria meio q 'refazer' o script, e como nao tenho costume com o 0.4, iria demorar muito =\

MEUS POSTS:

 

SE AJUDEI, DÁ O REP+, ESQUECE NÃO, VLW BB <3

Link para o post
Compartilhar em outros sites
  • 4 months later...
Em 30/01/2021 em 05:37, VictorSkyer disse:

I was looking like this and the best, it works great. Thanks bro! Could you give me your discord?

@Mor3não#7661

 

MEUS POSTS:

 

SE AJUDEI, DÁ O REP+, ESQUECE NÃO, VLW BB <3

Link para o post
Compartilhar em outros sites
  • 1 month later...
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?¡

Link para o post
Compartilhar em outros sites
  • 3 months later...
  • 4 months later...
  • 1 month later...

tentei por o sistema no meu server TFS 1.3, porém quando eu mato os monstros da task não aparece o texto falando quantos falta e também não conta pra task, sempre que vou no npc checar ainda precisa matar tudo

Editado por Bamz (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por ambrozii0
      Gostaria de fazer um pedido de um NPC de Task progressiva,

      Ele iniciaria dando missões para level 8 para caçar Troll, Rotworm e Ghoul.
       
      No level 30 liberaria: Cyclops, Dragon e Wyrm... e assim em diante se puder deixar comentado eu faço as criaturas na sequencia dos leveis seguintes.
       
      O jogador pode fazer as tasks dos leveis anteriores mesmo que já tenha ultrapassado o level do próximo nível de task.
       
      E o jogador ao terminar a missão poderia escolher a recompensa em gold ou experiência. As tasks podem se repetir sem problema, mas apenas pode pegar uma de cada vez.
       
      Ao finalizar todas as tasks o jogador ganha uma montaria.
       
      Minha versão de cliente é 12.91
      Versão da Canary 2.6.1
      Não sei qual o TFS do meu servidor.
    • Por zGiovani
      Olá Galera, acabei de editar o npc para que funcione de maneira correta na nova versão v1.4.0
      do server: https://github.com/opentibiabr/otservbr-global/releases/download/stable-v1.4.0/otservbr.otbm
       
       
      Server/data/npc
       
      Imbuement Assistant.lua ?     "PADRÃO - SEM ITENS IMBUEMENT DE HOLY"
       
       
       
      Server/data/npc
      Imbuement Assistant.lua ?     "COM ITENS IMBUEMENT DE HOLY"
       
       
      EDITE TAMBÉM: imbuements.xml
      LOCALIZADO EM:      data/xml/imbuements.xml    edite ele  para funcionar os ITENS IMBUEMENT DE HOLY
      Editei ele na linha 99 a 118
       
       
       
      Valeu Galera! 
      Aproveitem esse ótimo conteúdo que vai poupar muito tempo de vocês, até a próxima!!! 
    • Por Gustavo0098
      Bom queria um NPC  teleportasse um player para uma position e so poderia ser usado novamente depois de 24 horas, alguem para ajudar? OBG 
    • Por Garou
      QUIZ







      Fala, grande reino! Tudo beleza?

      Eu estava aqui a deriva, sem nada para fazer, quando um colega me chamou no msn e pediu para eu revisar um código que ele havia feito para um NPC. A função era bem simples, o tal NPC iria fazer perguntas ao jogador que devia responder-las corretamente, caso errasse, duas criaturas configuráveis iriam aparecer.

      Quando eu dei uma olhada no código, tomei um grande susto, era algo caótico, tudo embaralhado. Se você quer dar uma olhada, tenha certeza de ter um coração forte.



      --[[ NPC de Perguntas e Respostas Criado por Bruno Lopes / Lpz &#169; 2011 TibiaKing ]]-- local focuses = {} local talk_start = 0 local topic = {} local var = 0 local quiz = { [1] = {"What is the ring of mana?", "energy ring"}, [2] = {"Who sells addons?", "raphael"} } local monster = {"Orc", 2} local prize = { question = 100, all = 10000 } function onCreatureSay(cid, type, msg) local msg = msg:lower() or "" if getNpcDistanceTo(cid) > 3 then return false end if doMessageCheck(msg, {"hi", "hello"}) and not(isFocused(cid, focuses)) then selfSay("Hello, ".. getCreatureName(cid) ..". Can you answer my questions? heh...", cid) addFocus(cid, focuses) selfFocus(cid) topic[cid] = 100 talk_start = os.clock() elseif doMessageCheck(msg, {"hi", "hello"}) and #focuses ~= 0 then selfSay("Sorry, ".. getCreatureName(cid) ..". I am talking with another person, wait!", cid) end if doMessageCheck(msg, {"bye", "farewell", "goodbye"}) and isFocused(cid, focuses) then selfSay("Bye-bye, hehe!", cid) removeFocus(cid, focuses) end if topic[cid] == 100 then if doMessageCheck(msg, "yes") then selfSay("To start my challenge, just say {ready}. I will ask you some questions.", cid) topic[cid] = 1 elseif doMessageCheck(msg, "no") then selfSay("Huh? Why are you here then?", cid) removeFocus(cid, focuses) topic[cid] = 0 end elseif topic[cid] == 1 then if var == 0 then if doMessageCheck(msg, "ready") then var = 1 selfSay(quiz[var][1], cid) end elseif var >= 1 then if var <= #quiz then if doMessageCheck(msg, quiz[var][2]) then selfSay("CORRECT!", cid) doPlayerAddMoney(cid, prize.question) var = var+1 if var > #quiz then selfSay("CONGRATULATIONS! YOU HAVE FINISHED ALL QUESTIONS!", cid) doPlayerAddMoney(cid, prize.all) else selfSay(quiz[var][1], cid) end else selfSay("YOU HAVE WRONG MY QUESTION! GUARDS, COME HERE!", cid) var = 0 topic[cid] = 0 removeFocus(cid, focuses) for i = 1, monster[2] do doCreateMonster(monster[1], getNpcPos()) end end end end end return true end function onThink() for _, cid in ipairs(focuses) do if isPlayer(cid) and isFocused(cid, focuses) then if os.clock() > (talk_start + 180) then talk_start = 0 selfSay("Hmph!") closeShopWindow(cid) removeFocus(cid, focuses) elseif getNpcDistanceTo(cid) > 3 then talk_start = 0 selfSay("How Rude!") closeShopWindow(cid) removeFocus(cid, focuses) end end end lookAtFocus(focuses) end Bom, eu fiz o arquivo .lua que você iria associar a algum npc de seu servidor, deixo o arquivo .xml por sua conta. Como é um NPC que faz perguntas, você pode configurar o seu NPC do jeito que você quiser, com as perguntas que você quiser. Veja abaixo como proceder: local quiz = { [1] = {"What is the ring of mana?", "energy ring"}, [2] = {"Who sells addons?", "raphael"} } Para adicionar novas perguntas, basta você colocar uma vírgula na última linha e criar uma nova linha conforme o modelo: local quiz = { [1] = {"What is the ring of mana?", "energy ring"}, [2] = {"Who sells addons?", "raphael"}, [3] = {"PERGUNTA", "RESPOSTA"}, [4] = {"PERGUNTA", "RESPOSTA"} } Há também algumas outras configurações básicas para você fazer, as criaturas que irão aparecer caso o jogador erre a pergunta e a quantidade. Também você pode configurar a quantidade de dinheiro que o jogador ganha quando acerta uma pergunta e a quantidade de dinheiro do prêmio final. local monster = {"Orc", 2} local prize = { question = 100, all = 10000 } OBSERVAÇÕES Para evitar quaisquer erros no script, substitua o conteúdo de npc.lua em data/npc/lib por este que estou passando abaixo:



      É isso aê, galerinha do tibiaKing!

      Até o próximo tópico.
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo