Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

tfs 0.4

Qual o motivo deste tópico? 

Preciso que esse npc dê a storage 167943 apenas a primeira vez que eu falar "hi"

eu sei que preciso usar

setPlayerStorageValue(cid, 167943, 1)

mas não sei como fazer ganhar a storage apenas uma vez, visto que é um npc de task e vou precisar falar com ele várias vezes.

 

Você tem o código disponível? Se tiver publique-o aqui: 

Spoiler

domodlib('task_func')
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	local talkUser,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"",""
	local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24
	if isInArray({"task","tasks","missao","mission"}, msg) then
		if task_sys[task] then
			if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
				if getPlayerLevel(cid) >= task_sys[task].level then
					setPlayerStorageValue(cid, task_sys[task].start, 1)
					npcHandler:say("Você deverá derrotar o "..task_sys[task].name.." vence-lo apenas "..task_sys[task].count.." vez."..(#task_sys[task].items > 0 and "Deverá trazer "..getItemsFromList(task_sys[task].items).." para mim." or "").."" , cid)
				else
					npcHandler:say("Desculpe, mas você precisa do level "..task_sys[task].level.." para receber a missão do "..task_sys[task].name.."!", cid)
				end
			else
				npcHandler:say("Desculpe,  "..task_sys[task].name..". Você pode {entregar} caso tenha terminado.", cid)
			end
		else
			npcHandler:say("Desculpe, mas não tenho missões disponíveis para você.", cid)
		end
	elseif isInArray({"diaria","daili","daily","dayli","diario"}, msg) then
		if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then
			npcHandler:say("Desculpe, você deve esperar até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar uma nova missão diaria.!", cid) return true
		elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then
			npcHandler:say("Desculpe, você deve {entregar} sua missão !", cid) return true
		end
		local r = doRandomDailyTask(cid)
		if r == 0 then
			npcHandler:say("Desculpe, mas você não tem level necessário para receber uma missão diaria.", cid) return true
		end
		setPlayerStorageValue(cid, task_sys_storages[4], r)
		setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600)
		setPlayerStorageValue(cid, task_sys_storages[7], 1)
		setPlayerStorageValue(cid, task_sys_storages[5], 0)
       local dtask = daily_task[r]
		npcHandler:say("[Missão Diaria] Você deverá derrotar "..dtask.name.." vence-lo "..dtask.count.." vezes até" ..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Boa Sorte !" , cid)
	elseif isInArray({"receber","reward","recompensa","report","reportar","entregar","entrega"}, msg) then
		local v, k = task_sys[task], daily_task[daily] 
		if v then -- original task
			if getPlayerStorageValue(cid, v.start) > 0 then
				if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then
					if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then
						npcHandler:say("Desculpe, mas você precisa entregar também os items "..getItemsFromList(v.items), cid) return true
					end
			 if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end
		         if v.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+v.points)) str = str.."".. (str == "" and "" or ", ") .." + "..v.points.."task points" end
		         if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end
		         if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end
					npcHandler:say("Receba sua Recompensa: "..(str == "" and "nenhuma" or ""..str.."").." por ter realizado a missão do "..v.name, cid)
					setPlayerStorageValue(cid, task_sys_storages[3], 0)
					setPlayerStorageValue(cid, task_sys_storages[1], (task+1))
				else
					npcHandler:say("Desculpe, mas você ainda não terminou a missão do "..v.name..". Preciso que derrote mais "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." Destes alvos!", cid)
				end
			end
		end
		
		if k then -- daily task
			if getPlayerStorageValue(cid, task_sys_storages[7]) > 0 then
				if getPlayerStorageValue(cid, task_sys_storages[5]) >= k.count then
				if k.exp > 0 then doPlayerAddExp(cid, v.exp) rst = rst.."".. (rst == "" and "" or ", ") .." "..k.exp.." de exp" end
		         if k.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+k.points)) rst = rst.."".. (rst == "" and "" or ", ") .." + "..k.points.."task points" end
		         if k.money > 0 then doPlayerAddMoney(cid, k.money) rst = rst.."".. (rst == "" and "" or ", ") ..""..k.money.." gps" end
		         if table.maxn(k.reward) > 0 then GiveRewardsTask(cid, k.reward) rst = rst.."".. (rst == "" and "" or ", ") ..""..getItemsFromList(k.reward) end
					npcHandler:say("Receba sua Recompensa: "..(rst == "" and "nenhuma" or ""..rst.."").." por realizar a missão do "..k.name, cid)
					setPlayerStorageValue(cid, task_sys_storages[4], 0)
					setPlayerStorageValue(cid, task_sys_storages[5], 0)
					setPlayerStorageValue(cid, task_sys_storages[7], 0)
					else
					npcHandler:say("Desculpe, mas você ainda não terminou a missão do "..k.name..". Preciso que derrote mais "..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and k.count or -(getPlayerStorageValue(cid,task_sys_storages[5])-k.count)).." Destes alvos!", cid)
				end
			end
		end
		
	elseif msg == "no" then 
		selfSay("Ok, até mais.", cid) 
		talkState[talkUser] = 0 
		npcHandler:releaseFocus(cid) 
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

 

  • Respostas 5
  • Visualizações 505
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor
1 hora atrás, Pisces disse:

Não entendi muito bem, você quer que seja possível concluir apenas uma única vez ? Ele entrega o prêmio, e fim da task ?

 

Aliás, existe algum outro arquivo relacionado à este ?

Sim, existe um npc que direciona para essas tasks.

não, eu quero apenas saber qual storage está sendo atribuída antes , quando me mandar fazer a task e qual eu recebo após concluir .

Postado

Pelos sistemas de tasks diárias que eu vi, sempre são ligados à alguma lib (no início fala sobre task_func, tente procurar algo parecido). Este script não indica qual o valor da storage, ele está puxando de outro arquivo.

Aqui ele usou task_sys[task], como um valor pra verificar se o jogador pode iniciar a diária.

if getPlayerStorageValue(cid, task_sys[task].start) <= 0

Aqui ele já atribuiu o valor, para que o jogador consiga executar se tivesse o valor = 1.

 

setPlayerStorageValue(cid, task_sys[task].start, 1)

Mais no finalzinho, vemos que ele usou essas daqui (que ficaram zeradas) :

 

setPlayerStorageValue(cid, task_sys_storages[4], 0)
setPlayerStorageValue(cid, task_sys_storages[5], 0)
setPlayerStorageValue(cid, task_sys_storages[7], 0)

Pra acompanhar, é só você ir lendo as frases (se deu recompensa, se iniciou, se não pôde iniciar, se terminou), e em seguida, conferir qual foi a storage responsável por aquela ação. Recomendo que você procure o outro arquivo que esteja relacionado à este script para descobrir os valores das storages, creio que não seja apenas ele em execução.

 

Geralmente isso é usado pra 'facilitar' a vida de quem está montando o script, porque aí não precisa ir lá no meio modificar o número ou algo do tipo, é só modificar o 'local'. Exemplo:

 

O daily_storage se tornou o valor '167943'

 

local daily_storage = 167943

setPlayerStorageValue (cid, daily_storage, 1)

Postado
  • Autor

@Pisces 

Spoiler

<?xml version="1.0" encoding="ISO-8859-1"?> 
<mod name="Simple Task" version="4.0" author="Vodkart" contact="tibiaking.com" enabled="yes"> 
<config name="task_func"><![CDATA[
task_sys = {
	[1] = {name = "Mizuki", start = 176201, monsters_list = {"Mizuki"}, level = 5, count = 1, points = 1, items = {}, reward = {}, exp = 5100, money = 0},
	[2] = {name = "Zabuza Momochi", start = 176202, monsters_list = {"Zabuza Momochi"}, level = 10, count = 1, points = 1, items = {}, reward = {}, exp = 8300, money = 0},
	[3] = {name = "Jirobo", start = 176203, monsters_list = {"Jirobo"}, level = 15, count = 1, points = 1, items = {}, reward = {}, exp = 9200, money = 0},
	[4] = {name = "Orochimaru", start = 176204, monsters_list = {"Orochimaru"}, level = 20, count = 1, points = 1, items = {}, reward = {}, exp = 17200, money = 0},
	[5] = {name = "Kimimaru", start = 176205, monsters_list = {"Kimimaru"}, level = 25, count = 1, points = 1, items = {}, reward = {}, exp = 27700, money = 0},
	[6] = {name = "Kisame", start = 176206, monsters_list = {"Kisame"}, level = 30, count = 1, points = 1, items = {}, reward = {}, exp = 40700, money = 0},
	[7] = {name = "Deidara", start = 176207, monsters_list = {"Deidara"}, level = 35, count = 1, points = 1, items = {}, reward = {}, exp = 56200, money = 0},
	[8] = {name = "Hidan", start = 176208, monsters_list = {"Hidan"}, level = 40, count = 1, points = 1, items = {}, reward = {}, exp = 74200, money = 0},
	[9] = {name = "Kakuzo", start = 176209, monsters_list = {"Kakuzo"}, level = 45, count = 1, points = 1, items = {}, reward = {}, exp = 94700, money = 0},
	[10] = {name = "Kabuto", start = 176210, monsters_list = {"Kabuto"}, level = 50, count = 1, points = 1, items = {}, reward = {}, exp = 117700, money = 0},
	[11] = {name = "Sasori", start = 176211, monsters_list = {"Sasori"}, level = 55, count = 1, points = 1, items = {}, reward = {}, exp = 143200, money = 0},
	[12] = {name = "Tobi", start = 176212, monsters_list = {"Tobi"}, level = 60, count = 1, points = 1, items = {}, reward = {}, exp = 171200, money = 0},
	[13] = {name = "Shukaku", start = 176213, monsters_list = {"Shukaku"}, level = 60, count = 1, points = 1, items = {}, reward = {}, exp = 81200, money = 0},
	[14] = {name = "Nagato", start = 176214, monsters_list = {"Nagato"}, level = 65, count = 1, points = 1, items = {}, reward = {}, exp = 201700, money = 0},
	[15] = {name = "Matatabi", start = 176215, monsters_list = {"Matatabi"}, level = 65, count = 1, points = 1, items = {}, reward = {}, exp = 101700, money = 0},
	[16] = {name = "Konan", start = 176216, monsters_list = {"Konan"}, level = 70, count = 1, points = 1, items = {}, reward = {}, exp = 234700, money = 0},
	[17] = {name = "Isobu", start = 176217, monsters_list = {"Isobu"}, level = 70, count = 1, points = 1, items = {}, reward = {}, exp = 114700, money = 0},
	[18] = {name = "Danzou", start = 176218, monsters_list = {"Danzou"}, level = 75, count = 1, points = 1, items = {}, reward = {}, exp = 270200, money = 0},
	[19] = {name = "Yonbi", start = 176219, monsters_list = {"Yonbi"}, level = 75, count = 1, points = 1, items = {}, reward = {}, exp = 130200, money = 0},
	[20] = {name = "Obito", start = 176220, monsters_list = {"Obito"}, level = 80, count = 1, points = 1, items = {}, reward = {}, exp = 308200, money = 0},
	[21] = {name = "Saiken", start = 176221, monsters_list = {"Saiken"}, level = 80, count = 1, points = 1, items = {}, reward = {}, exp = 158200, money = 0},
	[22] = {name = "Itachi", start = 176222, monsters_list = {"Itachi"}, level = 85, count = 1, points = 1, items = {}, reward = {}, exp = 348700, money = 0},
	[23] = {name = "Shichibi", start = 176223, monsters_list = {"Shichibi"}, level = 85, count = 1, points = 1, items = {}, reward = {}, exp = 188700, money = 0},
	[24] = {name = "Madara", start = 176224, monsters_list = {"Madara"}, level = 90, count = 1, points = 1, items = {}, reward = {}, exp = 391700, money = 0},
	[25] = {name = "Hachibi", start = 176225, monsters_list = {"Hachibi"}, level = 90, count = 1, points = 1, items = {}, reward = {}, exp = 211700, money = 0},
	[26] = {name = "Kaguya", start = 176226, monsters_list = {"Kaguya"}, level = 100, count = 1, points = 1, items = {}, reward = {}, exp = 437200, money = 0},
	[27] = {name = "Kyuubi", start = 176227, monsters_list = {"Kyuubi"}, level = 100, count = 1, points = 1, items = {}, reward = {}, exp = 237200, money = 0},
	[28] = {name = "Hagoromo", start = 176228, monsters_list = {"Hagoromo"}, level = 110, count = 1, points = 1, items = {}, reward = {}, exp = 485200, money = 0},
	[29] = {name = "End Game", start = 176229, monsters_list = {"End Game"}, level = 999, count = 1, points = 1, items = {}, reward = {}, exp = 485200, money = 0},
	}
daily_task = {
	[1] = {name = "Thief" ,monsters_list = {"Thief","Thief Shinobi","Strong Thief"}, count = 100, points = 1, reward = {}, exp = 8300, money = 20000},
	[2] = {name = "Assassin" ,monsters_list = {"Assassin","Felon Assassin","Armed Assassin"}, count = 100, points = 1, reward = {}, exp = 8300, money = 20000},
	[3] = {name = "Poison Spider" ,monsters_list = {"Poison Spider"}, count = 100, points = 1, reward = {}, exp = 8300, money = 20000},
	
	[4] = {name = "Subordinate" ,monsters_list = {"Subordinate"}, count = 125, points = 1, reward = {}, exp = 17200, money = 30000},
	[5] = {name = "Cursed Young Kekkei" ,monsters_list = {"Cursed Young","Cursed Kekkei"}, count = 125, points = 1, reward = {}, exp = 17200, money = 30000},
	[6] = {name = "Water shinobi" ,monsters_list = {"Water Shinobi"}, count = 125, points = 1, reward = {}, exp = 17200, money = 30000},
	
	[7] = {name = "Lizard" ,monsters_list = {"Lizard"}, count = 150, points = 1, reward = {}, exp = 40700, money = 40000},
	[8] = {name = "Bocune" ,monsters_list = {"Bocune"}, count = 150, points = 1, reward = {}, exp = 40700, money = 40000},
	[9] = {name = "Elite Strong Cursed" ,monsters_list = {"Strong Cursed","Elite Cursed"}, count = 150, points = 1, reward = {}, exp = 40700, money = 40000},
	
	[10] = {name = "Giant Spider" ,monsters_list = {"Giant Spider"}, count = 500, points = 1, reward = {}, exp = 74200, money = 50000},
	[11] = {name = "Nendo Bunshin" ,monsters_list = {"Nendo Bunshin"}, count = 175, points = 1, reward = {}, exp = 74200, money = 17500},
	[12] = {name = "Ancient Creature" ,monsters_list = {"Ancient Creature"}, count = 175, points = 1, reward = {}, exp = 74200, money = 17500},
	
	[13] = {name = "Especialist" ,monsters_list = {"Especialist"}, count = 200, points = 1, reward = {}, exp = 117700, money = 20000},
	[14] = {name = "Giant Axeman" ,monsters_list = {"Giant Axeman"}, count = 200, points = 1, reward = {}, exp = 117700, money = 20000},
	[15] = {name = "Renegade Orochimaru" ,monsters_list = {"Renegade Orochimaru"}, count = 200, points = 1, reward = {}, exp = 117700, money = 20000},
	
	[16] = {name = "Waspoid" ,monsters_list = {"Waspoid"}, count = 250, points = 1, reward = {}, exp = 171200, money = 25000},
	[17] = {name = "Wild Enma" ,monsters_list = {"Wild Enma"}, count = 250, points = 1, reward = {}, exp = 171200, money = 25000},
	[18] = {name = "Dragonearth" ,monsters_list = {"Dragonearth"}, count = 750, points = 1, reward = {}, exp = 171200, money = 75000},
	
	[19] = {name = "Octopus" ,monsters_list = {"Octopus"}, count = 400, points = 1, reward = {}, exp = 234700, money = 40000},
	[20] = {name = "Dragon" ,monsters_list = {"Dragon"}, count = 400, points = 1, reward = {}, exp = 234700, money = 40000},
	[21] = {name = "Hellhound" ,monsters_list = {"Hellhound"}, count = 400, points = 1, reward = {}, exp = 234700, money = 40000},
	[22] = {name = "Hawk" ,monsters_list = {"Hawk"}, count = 400, points = 1, reward = {}, exp = 234700, money = 40000},
	
	[23] = {name = "Aligazor" ,monsters_list = {"Aligazor"}, count = 600, points = 1, reward = {{11329,1}}, exp = 358200, money = 60000},
	[24] = {name = "Rygamata" ,monsters_list = {"Rygamata"}, count = 1000, points = 1, reward = {{11329,1}}, exp = 358200, money = 100000},
	[25] = {name = "Kekkei Lizard" ,monsters_list = {"Kekkei Lizard"}, count = 600, points = 1, reward = {{11329,1}}, exp = 358200, money = 60000},
	[26] = {name = "Minotaur Renegade" ,monsters_list = {"Minotaur Renegade"}, count = 750, points = 1, reward = {{11329,1}}, exp = 358200, money = 80000},
}
task_sys_storages = {176601, 176602, 176603, 176604, 176605, 176606, 176607, 176608, 176609, 176610, 176611, 176612} -- task, points, count, daily task, daily count, daily time , daily start, contador
function getTaskMission(cid)
	return getPlayerStorageValue(cid,task_sys_storages[1]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[1])
end
function getDailyTaskMission(cid)
	return getPlayerStorageValue(cid,task_sys_storages[4]) < 0 and 1 or getPlayerStorageValue(cid,task_sys_storages[4])
end
function getTaskPoints(cid)
	return getPlayerStorageValue(cid,task_sys_storages[2]) < 0 and 0 or getPlayerStorageValue(cid,task_sys_storages[2])
end
function doRandomDailyTask(cid)
	local t = {
		[{10,19}] = {1, 3},
		[{20,29}] = {4, 6},
		[{30,39}] = {7, 9},
		[{40,49}] = {10, 12},
		[{50,59}] = {13, 15},
		[{60,79}] = {16, 18},
		[{80,99}] = {19, 22},
		[{100,math.huge}] = {23, 26},
	}
	for a , b in pairs(t) do
		if getPlayerLevel(cid) >= a[1] and getPlayerLevel(cid) <= a[2] then
			return math.random(b[1], b[2])
		end
	end
	return 0
end

function GetRankTask(cid)
	local ranks = {
		[{0, 19}] = "Aluno Academy", 
		[{20, 39}] = "Genin",
		[{40, 59}] = "Chunin",
		[{60, 99}] = "Jounin",		
		[{100, math.huge}] = "Kage"
	}
	for v , r in pairs(ranks) do
		if getTaskPoints(cid) >= v[1] and getTaskPoints(cid) <= v[2] then
			return r
		end
	end
	return 0
end
function getItemsFromList(items)
	local str = ''
	if table.maxn(items) > 0 then
		for i = 1, table.maxn(items) do
			str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])
			if i ~= table.maxn(items) then str = str .. ', ' 
			end 
		end 
	end
	return str
end

function doRemoveItemsFromList(cid,items)
	local count = 0
	if table.maxn(items) > 0 then
		for i = 1, table.maxn(items) do
			if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then
			count = count + 1 end 
		end 
	end
	if count == table.maxn(items) then
		for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end
	else 
		return false 
	end
	return true 
end

function getMonsterFromList(monster)
	local str = ''
	if #monster > 0 then
		for i = 1, #monster do
			str = str .. monster[i]
			if i ~= #monster then str = str .. ', ' end
		end 
	end
	return str
end

function GiveRewardsTask(cid, items)
	local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
	for _, i_i in ipairs(items) do
		local item, amount = i_i[1],i_i[2]
		if isItemStackable(item) or amount == 1 then
			doAddContainerItem(backpack, item, amount)
		else
			for i = 1, amount do
				doAddContainerItem(backpack, item, 1)
			end
		end
	end
end

function isSummon(cid)
	if(not isCreature(cid)) then
		return false
	end
	return getCreatureMaster(cid) ~= cid
end

]]></config>
<event type="login" name="TaskLogin" event="script"><![CDATA[
function onLogin(cid)
	registerCreatureEvent(cid, "KillTask")
	registerCreatureEvent(cid, "TaskLook")
	return true
end]]></event>
<talkaction words="!missao;!missoes" event="buffer"><![CDATA[
domodlib('task_func')
param,task,daily = param:lower(), getTaskMission(cid), getDailyTaskMission(cid)
if isInArray({"counter","contador"},param) then
	setPlayerStorageValue(cid, task_sys_storages[8], getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and 1 or 0)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"O contador foi "..(getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and "ativado" or "desativado")..".") return true
elseif isInArray({"daily","diaria"},param) then
	if not daily_task[daily] or getPlayerStorageValue(cid, task_sys_storages[7]) <= 0 then
		doPlayerSendCancel(cid, "Desculpe, mas voce não está cadastrado em nenhuma Missão Diaria.") return true
	elseif getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily_task[daily].count then
		doPlayerSendCancel(cid,"Desculpe, mas voce não terminou a Missão Diaria a tempo! Por favor volte e comece uma nova Missão Diaria!") return true
	end
	return doShowTextDialog(cid, 8983, "[->] CURRENT DAILY TASK INFO [<-]\n\nNome: "..daily_task[daily].name.."\nProgresso: ["..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[5])).."/"..daily_task[daily].count.."]\nPrazo para entrega: "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).."\nMonstros para cacar: "..getMonsterFromList(daily_task[daily].monsters_list).."\n\n[->] Recompensa da Task [<-]\n\nDinheiro: "..(daily_task[daily].money > 0 and daily_task[daily].money or 0).."\nExperiencia: "..(daily_task[daily].exp > 0 and daily_task[daily].exp or 0).."\nTask Points: "..daily_task[daily].points.."\nItems: "..(#daily_task[daily].reward > 0 and getItemsFromList(daily_task[daily].reward) or "Nenhum item de recompensa")..".")
end
if not task_sys[task] or getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
	doPlayerSendCancel(cid, "Você não está cadastrado em nenhuma missão, fale com Naruto.") return true
end 
return doShowTextDialog(cid, 8983, "-> Missoes Realizadas ["..getTaskMission(cid).."/"..#task_sys.."] <-\n\nNome da Missao: "..task_sys[task].name.."\nLevel da Missao: "..task_sys[task].level.."\nProgresso da Missao: ["..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 0 or getPlayerStorageValue(cid, task_sys_storages[3])).."/"..task_sys[task].count.."]\nAlvos : "..getMonsterFromList(task_sys[task].monsters_list)..".\nItens Para Entrega: "..(#task_sys[task].items > 0 and getItemsFromList(task_sys[task].items) or "Nenhum")..".\n\n[->] Recompensa da Missao [<-]\n\nDinheiro: "..(task_sys[task].money > 0 and task_sys[task].money or 0).."\nExperiencia: "..(task_sys[task].exp > 0 and task_sys[task].exp or 0).."\nPontos: "..task_sys[task].points.."\nItems: "..(#task_sys[task].reward > 0 and getItemsFromList(task_sys[task].reward) or "Nenhum item de recompensa")..".")
]]></talkaction>

<event type="look" name="TaskLook" event="script"><![CDATA[
domodlib('task_func')
function onLook(cid, thing, position, lookDistance)
	if isPlayer(thing.uid) and getTaskPoints(thing.uid) > 0 then
		doPlayerSetSpecialDescription(thing.uid, "\n É um Shinobi de Graduação : "..GetRankTask(thing.uid))
	end	
	return true
end]]></event> 

<event type="kill" name="KillTask" event="script"><![CDATA[
domodlib('task_func')
function onKill(cid, target, lastHit)
	if(isMonster(target) == true) then
		local t,daily = task_sys[getTaskMission(cid)], daily_task[getDailyTaskMission(cid)]
		if t and getPlayerStorageValue(cid, t.start) > 0 and isInArray(t.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
			setPlayerStorageValue(cid, task_sys_storages[3], getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[3])+1))
			if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[3]) < t.count then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Missao] Contador Total [" .. getPlayerStorageValue(cid, task_sys_storages[3]) .. "/" .. t.count .. "] da Missao do " .. t.name .. ".")
			end 
			if getPlayerStorageValue(cid, task_sys_storages[3]) >= t.count then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Missao] Parabens! Voce terminou a missao do "..t.name..", volte ao Naruto parece receber sua recompensa.")
			end
		end
		if daily and getPlayerStorageValue(cid, task_sys_storages[7]) > 0 and getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() >= 0 and isInArray(daily.monsters_list, getCreatureName(target):lower()) and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
			setPlayerStorageValue(cid, task_sys_storages[5], getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and 1 or (getPlayerStorageValue(cid, task_sys_storages[5])+1))
			if getPlayerStorageValue(cid, task_sys_storages[8]) <= 0 and getPlayerStorageValue(cid, task_sys_storages[5]) < daily.count then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Missao Diaria] Contador Total [" .. getPlayerStorageValue(cid, task_sys_storages[5]) .. "/" .. daily.count .. "] da Missao do " .. daily.name .. ".")
			end
			if getPlayerStorageValue(cid, task_sys_storages[5]) >= daily.count then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Missao Diaria] Parabens! Voce concluiu a Missao do "..daily.name..", volte para o Naruto e receba sua recompensa.")
			end
		end 
	end
	return true
end]]></event>

<movevent type="StepIn" actionid ="46001" event="script"><![CDATA[
domodlib('task_func')
function onStepIn(cid, item, position, fromPosition)
	local amount = 1
	if getTaskPoints(cid) < amount then
		doTeleportThing(cid, fromPosition, true)
		doPlayerSendTextMessage(cid, 25, "[ Area Restrita ] Complete a primeira missao do Hokage Naruto para acessar esse local.")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
		return true
	end
	return true
end]]></movevent>

<movevent type="StepIn" actionid ="46002" event="script"><![CDATA[
domodlib('task_func')
function onStepIn(cid, item, position, fromPosition)
	local amount = 20
	if getTaskPoints(cid) < amount then
		doTeleportThing(cid, fromPosition, true)
		doPlayerSendTextMessage(cid, 25, "[ Area Restrita ] Torne-se Genin para acessar esse local.")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
		return true
	end
	return true
end]]></movevent>

<movevent type="StepIn" actionid ="46003" event="script"><![CDATA[
domodlib('task_func')
function onStepIn(cid, item, position, fromPosition)
	local amount = 40
	if getTaskPoints(cid) < amount then
		doTeleportThing(cid, fromPosition, true)
		doPlayerSendTextMessage(cid, 25, "[ Area Restrita ] Torne-se Chunin para acessar esse local.")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
		return true
	end
	return true
end]]></movevent>

<movevent type="StepIn" actionid ="46004" event="script"><![CDATA[
domodlib('task_func')
function onStepIn(cid, item, position, fromPosition)
	local amount = 60
	if getTaskPoints(cid) < amount then
		doTeleportThing(cid, fromPosition, true)
		doPlayerSendTextMessage(cid, 25, "[ Area Restrita ] Torne-se Jounin para acessar esse local.")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
		return true
	end
	return true
end]]></movevent>

<movevent type="StepIn" actionid ="46005" event="script"><![CDATA[
domodlib('task_func')
function onStepIn(cid, item, position, fromPosition)
	local amount = 100
	if getTaskPoints(cid) < amount then
		doTeleportThing(cid, fromPosition, true)
		doPlayerSendTextMessage(cid, 25, "[ Area Restrita ] Torne-se Kage para acessar esse local.")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
		return true
	end
	return true
end]]></movevent>


</mod>

 

Tipo, cada monstro dessa primeira parte "mizuki, zabuza, orochimaru....." eu preciso informar para o npc a baixo antes.

(hi, missao, e ele me manda matar um deles, quando eu termino , volto nele e falo, hi entregar, ele me da uma recompensa.

Aí eu falo hi, missao novamente e ele me manda para a próxima)

eu entendi que cada missao tem a storage aqui (start = XXXXX,) agr só preciso saber qual numero ele dá depois que mata ex xxxx, 1 ou xxxx, 2 ou xxxx,3 ....

não entendo muito bem como funciona esse numero depois da virgula na storage.

Spoiler

domodlib('task_func')
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	local talkUser,msg, str,rst = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower(),"",""
	local task,daily, hours = getTaskMission(cid),getDailyTaskMission(cid), 24
	if isInArray({"task","tasks","missao","mission"}, msg) then
		if task_sys[task] then
			if getPlayerStorageValue(cid, task_sys[task].start) <= 0 then
				if getPlayerLevel(cid) >= task_sys[task].level then
					setPlayerStorageValue(cid, task_sys[task].start, 1)
					setPlayerStorageValue(cid, 167943, 1)
					npcHandler:say("Você deverá derrotar o "..task_sys[task].name.." vence-lo apenas "..task_sys[task].count.." vez."..(#task_sys[task].items > 0 and "Deverá trazer "..getItemsFromList(task_sys[task].items).." para mim." or "").."" , cid)
				else
					npcHandler:say("Desculpe, mas você precisa do level "..task_sys[task].level.." para receber a missão do "..task_sys[task].name.."!", cid)
				end
			else
				npcHandler:say("Desculpe,  "..task_sys[task].name..". Você pode {entregar} caso tenha terminado.", cid)
			end
		else
			npcHandler:say("Desculpe, mas não tenho missões disponíveis para você.", cid)
		end
	elseif isInArray({"diaria","daili","daily","dayli","diario"}, msg) then
		if getPlayerStorageValue(cid, task_sys_storages[6]) - os.time() > 0 then
			npcHandler:say("Desculpe, você deve esperar até "..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6])).." para iniciar uma nova missão diaria.!", cid) return true
		elseif daily_task[daily] and getPlayerStorageValue(cid, task_sys_storages[5]) >= daily_task[daily].count then
			npcHandler:say("Desculpe, você deve {entregar} sua missão !", cid) return true
		end
		local r = doRandomDailyTask(cid)
		if r == 0 then
			npcHandler:say("Desculpe, mas você não tem level necessário para receber uma missão diaria.", cid) return true
		end
		setPlayerStorageValue(cid, task_sys_storages[4], r)
		setPlayerStorageValue(cid, task_sys_storages[6], os.time()+hours*3600)
		setPlayerStorageValue(cid, task_sys_storages[7], 1)
		setPlayerStorageValue(cid, task_sys_storages[5], 0)
       local dtask = daily_task[r]
		npcHandler:say("[Missão Diaria] Você deverá derrotar "..dtask.name.." vence-lo "..dtask.count.." vezes até" ..os.date("%d %B %Y %X ", getPlayerStorageValue(cid,task_sys_storages[6]))..". Boa Sorte !" , cid)
	elseif isInArray({"receber","reward","recompensa","report","reportar","entregar","entrega"}, msg) then
		local v, k = task_sys[task], daily_task[daily] 
		if v then -- original task
			if getPlayerStorageValue(cid, v.start) > 0 then
				if getPlayerStorageValue(cid,task_sys_storages[3]) >= v.count then
					if #v.items > 0 and not doRemoveItemsFromList(cid, v.items) then
						npcHandler:say("Desculpe, mas você precisa entregar também os items "..getItemsFromList(v.items), cid) return true
					end
			 if v.exp > 0 then doPlayerAddExp(cid, v.exp) str = str.."".. (str == "" and "" or ", ") .." "..v.exp.." de exp" end
		         if v.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+v.points)) str = str.."".. (str == "" and "" or ", ") .." + "..v.points.."task points" end
		         if v.money > 0 then doPlayerAddMoney(cid, v.money) str = str.."".. (str == "" and "" or ", ") ..""..v.money.." gps" end
		         if table.maxn(v.reward) > 0 then GiveRewardsTask(cid, v.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(v.reward) end
					npcHandler:say("Receba sua Recompensa: "..(str == "" and "nenhuma" or ""..str.."").." por ter realizado a missão do "..v.name, cid)
					setPlayerStorageValue(cid, task_sys_storages[3], 0)
					setPlayerStorageValue(cid, task_sys_storages[1], (task+1))
				else
					npcHandler:say("Desculpe, mas você ainda não terminou a missão do "..v.name..". Preciso que derrote mais "..(getPlayerStorageValue(cid, task_sys_storages[3]) < 0 and v.count or -(getPlayerStorageValue(cid,task_sys_storages[3])-v.count)).." Destes alvos!", cid)
				end
			end
		end
		
		if k then -- daily task
			if getPlayerStorageValue(cid, task_sys_storages[7]) > 0 then
				if getPlayerStorageValue(cid, task_sys_storages[5]) >= k.count then
				if k.exp > 0 then doPlayerAddExp(cid, v.exp) rst = rst.."".. (rst == "" and "" or ", ") .." "..k.exp.." de exp" end
		         if k.points > 0 then setPlayerStorageValue(cid, task_sys_storages[2], (getTaskPoints(cid)+k.points)) rst = rst.."".. (rst == "" and "" or ", ") .." + "..k.points.."task points" end
		         if k.money > 0 then doPlayerAddMoney(cid, k.money) rst = rst.."".. (rst == "" and "" or ", ") ..""..k.money.." gps" end
		         if table.maxn(k.reward) > 0 then GiveRewardsTask(cid, k.reward) rst = rst.."".. (rst == "" and "" or ", ") ..""..getItemsFromList(k.reward) end
					npcHandler:say("Receba sua Recompensa: "..(rst == "" and "nenhuma" or ""..rst.."").." por realizar a missão do "..k.name, cid)
					setPlayerStorageValue(cid, task_sys_storages[4], 0)
					setPlayerStorageValue(cid, task_sys_storages[5], 0)
					setPlayerStorageValue(cid, task_sys_storages[7], 0)
					else
					npcHandler:say("Desculpe, mas você ainda não terminou a missão do "..k.name..". Preciso que derrote mais "..(getPlayerStorageValue(cid, task_sys_storages[5]) < 0 and k.count or -(getPlayerStorageValue(cid,task_sys_storages[5])-k.count)).." Destes alvos!", cid)
				end
			end
		end
		
	elseif msg == "no" then 
		selfSay("Ok, até mais.", cid) 
		talkState[talkUser] = 0 
		npcHandler:releaseFocus(cid) 
	end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Editado por diarmaint (veja o histórico de edições)

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo