Ir para conteúdo

Featured Replies

  • 5 months later...
  • Respostas 82
  • Visualizações 15.9k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @Jobs hehehe, nice, nice, nice, não mexo com modalwindow, meu servidor é 8.60, usando OTX 1.3, então como não tem diferença os scripts para as versões 1.x, então resolvi postar, vai pegar em todos, se

  • ja tô usando seu lindão!  mais pra frente, seria muito foda se você fizesse modal window! beijos, otimo sistema *-*    

  • Saquei, sim funcionou direitinho aqui, 10x tfs 1.2 xd 

Posted Images

Postado
Em 01/10/2017 em 23:44, KotZletY disse:

Salve geral, recentemente fiz um Task System para meu servidor, então gostaria de compartilha ele com vocês, assim como outros scripts que fiz e gostaria de compartilhar. Bom, vamos ao que interessa.

                  

 

                                                                                                         Informações!!

Task Normal - Você 1x por vez, quantas vezes quiser, repetindo a task se também quiser.

Task Diaria -  Você faz uma vez por dia, não podendo repeti em quanto as 24 horas não terminar.

Task Rank - É mostrado na descrição do player qual rank task ele possui.

Task Rank Quest - Um extra desse task system é o piso task, será explicado na parte do script, leiam com atenção.

Task Comandos - Comandos task, 1 para ver o progresso das suas task e outro para mostrar informações do seu personagem, como uma consulta, os comandos são: !task que mostra quais task você ta fazendo, tanto diaria quanto normal e !task me que mostrar informações do seu personagem, como rank, quantidade de pontos task e quantidade de pontos task rank.

Well, o resto é surpresa, cabe você descobrir! xD

 

 

Para não ficar só nas palavras, mostrarei algumas imagens, várias no caso: Removida, colocarei novas!

 

                                                                                                         Instalação!!

Muito bem, chega de conversa, como instalar logo essa bagaça. Primeiramente vá em data/lib e abra o arquivo lib.lua e adicione:


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

Ainda na pasta lib crie um arquivo.lua chamado task system.lua e adicione esse code dentro:

  Mostrar conteúdo oculto


task_monsters = {
   [1] = {name = "monster1", mons_list = {"monster_t2", "monster_t3"},  storage = 30000, amount = 20, exp = 5000, pointsTask = {1, 1}, items = {{id = 2157, count = 1}, {id = 2160, count = 3}}},
   [2] = {name = "monster2", mons_list = {"", ""}, storage = 30001, amount = 10, exp = 10000, pointsTask = {1, 1}, items = {{id = 10521, count = 1}, {id = 2160, count = 5}}},
   [3] = {name = "monster3", mons_list = {"", ""}, storage = 30002, amount = 10, exp = 18000, pointsTask = {1, 1}, items = {{id = 2195, count = 1}, {id = 2160, count = 8}}},
   [4] = {name = "monster4", mons_list = {"", ""}, storage = 30003, amount = 10, exp = 20000, pointsTask = {1, 1}, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}}
}

task_daily = {
   [1] = {name = "monsterDay1", mons_list = {"monsterDay1_t2", "monsterDay1_t3"}, storage = 40000, amount = 10, exp = 5000, pointsTask = {1, 1}, items = {{id = 2157, count = 1}, {id = 2160, count = 3}}},
   [2] = {name = "monsterDay2", mons_list = {"", ""}, storage = 40001, amount = 10, exp = 10000, pointsTask = {1, 1}, items = {{id = 10521, count = 1}, {id = 2160, count = 5}}},
   [3] = {name = "monsterDay3", mons_list = {"", ""}, storage = 40002, amount = 10, exp = 18000, pointsTask = {1, 1}, items = {{id = 2195, count = 1}, {id = 2160, count = 8}}},
   [4] = {name = "monsterDay4", mons_list = {"", ""}, storage = 40003, amount = 10, exp = 20000, pointsTask = {1, 1}, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}}
}

task_storage = 20020 -- storage que verifica se está fazendo alguma task e ver qual task é - task normal
task_points = 20021 -- storage que retorna a quantidade de pontos task que o player tem.
task_sto_time = 20022 -- storage de delay para não poder fazer a task novamente caso ela for abandonada.
task_time = 20 -- tempo em horas em que o player ficará sem fazer a task como punição
task_rank = 20023 -- storage do rank task
taskd_storage = 20024 -- storage que verifica se está fazendo alguma task e ver qual task é - task daily
time_daySto = 20025 -- storage do tempo da task daily, no caso para verificar e add 24 horas para fazer novamente a task daily


local ranks_task = {
[{1, 20}] = "Newbie", 
[{21, 50}] = "Elite",
[{51, 100}] = "Master",
[{101, 200}] = "Destroyer",		
[{201, math.huge}] = "Juggernaut"
}

local RankSequence = {
["Newbie"] = 1,
["Elite"] = 2,
["Master"] = 3,
["Destroyer"] = 4,
["Juggernaut"] = 5,
}

function rankIsEqualOrHigher(myRank, RankCheck)
	local ret_1 = RankSequence[myRank]
	local ret_2 = RankSequence[RankCheck]
	return ret_1 >= ret_2
end

function getTaskInfos(player)
	local player = Player(player)
	return task_monsters[player:getStorageValue(task_storage)] or false
end

function getTaskDailyInfo(player)
	local player = Player(player)
	return task_daily[player:getStorageValue(taskd_storage)] or false
end


function taskPoints_get(player)
	local player = Player(player)
	if player:getStorageValue(task_points) == -1 then
		return 0 
	end
	return player:getStorageValue(task_points)
end

function taskPoints_add(player, count)
	local player = Player(player)
	return player:setStorageValue(task_points, taskPoints_get(player) + count)
end

function taskPoints_remove(player, count)
	local player = Player(player)
	return player:setStorageValue(task_points, taskPoints_get(player) - count)
end

function taskRank_get(player)
	local player = Player(player)
	if player:getStorageValue(task_rank) == -1 then
		return 1 
	end
	return player:getStorageValue(task_rank)
end

function taskRank_add(player, count)
	local player = Player(player)
	return player:setStorageValue(task_rank, taskRank_get(player) + count)
end

function getRankTask(player)
	local pontos = taskRank_get(player)
	local ret
	for _, z in pairs(ranks_task) do
		if pontos >= _[1] and pontos <= _[2] then
			ret = z
		end
	end
	return ret
end

function getItemsFromTable(itemtable)
     local text = ""
     for v = 1, #itemtable do
         count, info = itemtable[v].count, ItemType(itemtable[v].id)
         local ret = ", "
         if v == 1 then
             ret = ""
         elseif v == #itemtable then
             ret = " - "
         end
         text = text .. ret
         text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName())
     end
     return text
end

 

 

No final do tópico, ensinarei a configurar a lib. Agora vai em, data/npc e crie um arquivo.xml chamado  task.xml e coloque esse code dentro:


<?xml version="1.0" encoding="UTF-8"?>
<npc name="NPC Task" script="task system.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="430"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I'm in charge of delivering missions to the players. Would you like to do a {normal} task, {daily} task, {receive} your reward from a task or {abandon} a task ? You can also see the {normal task list} and the {daily task list}."/>
<parameter key="message_farewell" value="See you later." />
		<parameter key="message_walkaway" value="See you later." />
        </parameters>
</npc>

Ainda na pasta npc, entre na pasta scripts e crie um arquivo.lua chamado task system.lua e adicione esse code dentro:

  Mostrar conteúdo oculto


local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end

npcHandler:addModule(FocusModule:new())

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
local player = Player(cid)
local msg = msg:lower()
------------------------------------------------------------------
if npcHandler.topic[cid] == 0 and msg == 'normal' then
	npcHandler:say("Great. Which monster task would you like to do ?", cid)
	npcHandler.topic[cid] = 1
elseif npcHandler.topic[cid] == 1 then
	if player:getStorageValue(task_sto_time) < os.time() then
		if player:getStorageValue(task_storage) == -1 then 
			for mon, l in ipairs(task_monsters) do
				if msg == l.name then
					npcHandler:say("Okay, you're now doing the {"..l.name:gsub("^%l", string.upper).."} task,  you need to kill "..l.amount.." of them. Good luck!", cid)
					player:setStorageValue(task_storage, mon)
					player:setStorageValue(l.storage, 0)
					npcHandler.topic[cid] = 0
					npcHandler:releaseFocus(cid)
					break
				elseif mon == #task_monsters then
					npcHandler:say("Sorry but we don't have this task.", cid)
					npcHandler.topic[cid] = 0
					npcHandler:releaseFocus(cid)
				end
			end
		else
			npcHandler:say("You're already doing a task. You can only do one at a time. Say {!task} to see information about your current task.", cid)
			npcHandler.topic[cid] = 0
			npcHandler:releaseFocus(cid)
		end
	else
		npcHandler:say("I'm not allowed to give you any task because you have abandoned the previous one. Wait for the "..task_time.." hours of punishment to end.", cid)
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
	end
elseif npcHandler.topic[cid] == 0 and msg == 'daily' then
	if player:getStorageValue(time_daySto) < os.time() then
		npcHandler:say("Remember, it is of great importance that the daily tasks are done. Now tell me, which monster task would you like to do? ", cid)
		npcHandler.topic[cid] = 2
	else
		npcHandler:say('You have completed a daily task today, expect to spend as 24 hours to do it again.', cid)
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
	end
elseif npcHandler.topic[cid] == 2 then
	if player:getStorageValue(task_sto_time) < os.time() then
		if player:getStorageValue(taskd_storage) == -1 then 
			for mon, l in ipairs(task_daily) do 
				if msg == l.name then
					npcHandler:say("Very well, you're now doing the daily {"..l.name:gsub("^%l", string.upper).."} task, you need to kill "..l.amount.." of them. Good luck!", cid)
					player:setStorageValue(taskd_storage, mon)
					player:setStorageValue(l.storage, 0)
					npcHandler.topic[cid] = 0
					npcHandler:releaseFocus(cid)
					break
				elseif mon == #task_daily then
					npcHandler:say("Sorry we don't have this daily task.", cid)
					npcHandler.topic[cid] = 0
					npcHandler:releaseFocus(cid)
				end
			end
		else
			npcHandler:say("You're already doing a daily task. You can only do one per day. Say {!task} to see information about your current task.", cid)
			npcHandler.topic[cid] = 0
			npcHandler:releaseFocus(cid)
		end
	else
		npcHandler:say("I'm not allowed to give you any task because you have abandoned the previous one. Wait for the "..task_time.." hours of punishment to end.", cid)
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
	end
elseif msg == 'receive' then
	if npcHandler.topic[cid] == 0 then
		npcHandler:say("What kind of task did you finish, {normal} or {daily} ?", cid)
		npcHandler.topic[cid] = 3
	end
elseif npcHandler.topic[cid] == 3 then
	if msgcontains(msg, 'normal') then
	local ret_t = getTaskInfos(player)
		if ret_t then
			if player:getStorageValue(ret_t.storage) == ret_t.amount then
				local pt1 = ret_t.pointsTask[1]
				local pt2 = ret_t.pointsTask[2]
				local txt = 'Thanks for finishing the task, your awards are: '..(pt1 > 1 and pt1..' task points' or pt1 <= 1 and pt1..' task point')..' and '..(pt2 > 1 and pt2..' rank points' or pt2 <= 1 and pt2..' rank point')..', '
				if #getItemsFromTable(ret_t.items) > 0 then
					txt = txt..'in addition to winning: '..getItemsFromTable(ret_t.items)..', '
				for g = 1, #ret_t.items do
					player:addItem(ret_t.items[g].id, ret_t.items[g].count)
				end
				end

				local exp = ret_t.exp
				if exp > 0 then
					txt = txt..'I will also give you '..exp..' experience, '
					player:addExperience(exp)
				end

				taskPoints_add(player, pt1)
				taskRank_add(player, pt2)
				player:setStorageValue(ret_t.storage, -1)
				player:setStorageValue(task_storage, -1)
				npcHandler:say(txt..'thanks again and see you again!', cid)
				npcHandler.topic[cid] = 0
				npcHandler:releaseFocus(cid)
			else
				npcHandler:say('You have not finished your current task yet. You will receive it when you finish.', cid)
				npcHandler.topic[cid] = 0
				npcHandler:releaseFocus(cid)
			end
		else
			npcHandler:say("You aren't doing any tasks.", cid)
			npcHandler.topic[cid] = 0
			npcHandler:releaseFocus(cid)
		end
	elseif npcHandler.topic[cid] == 3 and msg == 'daily' then
		if player:getStorageValue(time_daySto)-os.time() <= 0 then
		local ret_td = getTaskDailyInfo(player)
			if ret_td then
				if getTaskDailyInfo(player) then
					if player:getStorageValue(getTaskDailyInfo(player).storage) == getTaskDailyInfo(player).amount then
					local pt1 = getTaskDailyInfo(player).pointsTask[1]
					local pt2 = getTaskDailyInfo(player).pointsTask[2]
					local txt = 'Thanks for finishing the task, your awards are: '..(pt1 > 1 and pt1..' task points' or pt1 <= 1 and pt1..' task point')..' e '..(pt2 > 1 and pt2..' rank points' or pt2 <= 1 and pt2..' rank point')..', '
						if #getTaskDailyInfo(player).items > 0 then
							txt = txt..'in addition to winning: '..getItemsFromTable(getTaskDailyInfo(player).items)..', '
						for g = 1, #getTaskDailyInfo(player).items do
							player:addItem(getTaskDailyInfo(player).items[g].id, getTaskDailyInfo(player).items[g].count)
						end
						end
						local exp = getTaskDailyInfo(player).exp
						if exp > 0 then
							txt = txt..'I will also give you '..exp..' experience, '
							player:addExperience(exp)
						end
						npcHandler:say(txt..' thanks again and see you again!', cid)
						taskPoints_add(player, pt1)
						taskRank_add(player, pt2)
						player:setStorageValue(getTaskDailyInfo(player).storage, -1)
						player:setStorageValue(taskd_storage, -1)
						player:setStorageValue(time_daySto, 1*60*60*24+os.time())
						npcHandler.topic[cid] = 0
						npcHandler:releaseFocus(cid)
					else
						npcHandler:say('You have not finished your current task yet. You will receive it when you finish.', cid)
						npcHandler.topic[cid] = 0
						npcHandler:releaseFocus(cid)
					end
				else
					npcHandler:say("You aren't doing any tasks.", cid)
					npcHandler.topic[cid] = 0
					npcHandler:releaseFocus(cid)
				end
			end
		else
			npcHandler:say("You've done a daily task, wait 24 hours to do another one again.", cid)
			npcHandler.topic[cid] = 0
			npcHandler:releaseFocus(cid)
		end
	end

elseif msg == 'abandon' then
	if npcHandler.topic[cid] == 0 then
		npcHandler:say("Aff, what kind of task do you want to quit, {normal} or {daily}?", cid)
		npcHandler.topic[cid] = 4
	end
elseif npcHandler.topic[cid] == 4 and msgcontains(msg, 'normal') then
	local ret_t = getTaskInfos(player)
	if ret_t then
		npcHandler:say('Unfortunate this situation, had faith that you would bring me this task done, but I was wrong. As punishment will be '..task_time..' hours without being able to do any task.', cid)
		player:setStorageValue(task_sto_time, os.time()+task_time*60*60)
		player:setStorageValue(ret_t.storage, -1)
		player:setStorageValue(task_storage, -1)
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
	else
		npcHandler:say("You're not doing any task to be able to abandon it.", cid)
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
	end
elseif npcHandler.topic[cid] == 4 and msg == 'daily' then
	local ret_td = getTaskDailyInfo(player)
	if ret_td then
		npcHandler:say('Unfortunate this situation, had faith that you would bring me this task done, but I was wrong. As punishment will be '..task_time..' hours without being able to do any task.', cid)
		player:setStorageValue(task_sto_time, os.time()+task_time*60*60)
		player:setStorageValue(ret_td.storage, -1)
		player:setStorageValue(taskd_storage, -1)
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
	else
		npcHandler:say("You're not doing any daily tasks to be able to abandon it.", cid)
		npcHandler.topic[cid] = 0
		npcHandler:releaseFocus(cid)
	end
elseif msg == "normal task list" then
	local text = "----**| -> Normal Tasks <- |**----\n\n"
		for _, d in pairs(task_monsters) do
			text = text .."------ [*] "..d.name.." [*] ------ \n[+] Amount [+] -> ["..(player:getStorageValue(d.storage) + 1).."/"..d.amount.."]:\n[+] Awards [+] -> "..(#d.items > 1 and getItemsFromTable(d.items).." - " or "")..""..d.exp.." experience \n\n"
		end

		player:showTextDialog(1949, "" .. text)
		npcHandler:say("Here is the list of normal tasks.", cid)
elseif msg == "daily task list" then
	local text = "----**| -> Tasks Dailys <- |**----\n\n"
		for _, d in pairs(task_daily) do
			text = text .."------ [*] "..d.name.." [*] ------ \n[+] Amount [+] -> ["..(player:getStorageValue(d.storage) + 1).."/"..d.amount.."]:\n[+] Awards [+] -> "..(#d.items > 1 and getItemsFromTable(d.items).." - " or "")..""..d.exp.." experience \n\n"
		end

		player:showTextDialog(1949, "" .. text)
		npcHandler:say("Here is the daily tasks list.", cid)
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

 

 

Agora vá em data/talkactions e abra o arquivo talkactions.xml e adicione a seguinte tag:


<talkaction words="!task" separator=" " script="task system.lua" />

Ainda na pasta talkactions entre na pasta scripts e crie um arquivo.lua chamado task system.lua e adicione esse code dentro dele:

  Mostrar conteúdo oculto



function onSay(player, words, param)
	local text = '---------------------------**| -> Tasks System Infos <- |**---------------------------\n'

	if param:lower() == "me" then
		text = text .. '[+] Task Points [+]: You have '..taskPoints_get(player)..' task points.\n[+] Task Rank Points [+]: Você tem '..taskRank_get(player)..' rank points.\n[+] Rank Task [+]: '..getRankTask(player)..''
		return false,  player:popupFYI(text)
	end

	local ret_t = getTaskInfos(player)
	if ret_t then
		text = text .. '\n\n      [ -> ----- [+] Normal Task [+] ----- <- ]\n      \n[*] Current Task [*]: '..ret_t.name..' - You need to kill: '..ret_t.amount..'.\n[*] Awards [*]: '..getItemsFromTable(ret_t.items)..' - '..ret_t.pointsTask[1]..' Task Points - '..ret_t.pointsTask[2]..' Task Ranks. \n[*] Progress [*]: ['..(player:getStorageValue(ret_t.storage))..'/'..ret_t.amount..']\n[*] Task Status [*]: '..(player:getStorageValue(ret_t.storage) == ret_t.amount and 'Complete' or 'Incomplete')..'!'			
	else
		text = text .. "\n\n      [ -> ----- [+] Normal Task [+] ----- <- ]\n      \n--- You aren't doing any Daily Task."
	end

	local ret_td = getTaskDailyInfo(player)
	if ret_td then
		text = text .. '\n\n\n      [ -> ----- [+] Daily Task [+] ----- <- ]\n      \n[*] Current Task [*]: '..ret_td.name..' - You need to kill: '..ret_td.amount..'.\n[*] Awards [*]: '..getItemsFromTable(ret_td.items)..' - '..ret_td.pointsTask[1]..' Task Points - '..ret_td.pointsTask[2]..' Task Ranks \n[*] Progress [*]: ['..(player:getStorageValue(ret_td.storage))..'/'..ret_td.amount..']\n[*] Task Status [*]: '..(player:getStorageValue(ret_td.storage) == ret_td.amount and 'Complete' or 'Incomplete')..'!'			
	else
		text = text .. "\n\n\n      [ -> ----- [+] Daily Task [+] ----- <- ]\n      \n--- You aren't doing any Daily Task."
	end

	return false,  player:popupFYI(text)
end

 

 

Agora vá em data/creaturescripts e abra o arquivo creaturescripts.xl e adicione a seguinte tag:


<event type="kill" name="tasksystem" script="task system.lua"/>

Ainda na pasta creaturescripts entre na pasta scripts e crie um arquivo.lua chamado task system.lua e adicione esse code dentro dele:

  Mostrar conteúdo oculto


function onKill(player, target)
	if target:isPlayer()  or target:getMaster() then
		return true
	end

	local mon_name = target:getName():lower()

	local ret_t = getTaskInfos(player)
	if ret_t then
		if mon_name == ret_t.name or isInArray(ret_t.mons_list, mon_name) then
		local sto_value = player:getStorageValue(ret_t.storage)
			if sto_value < ret_t.amount then
				sto_value = sto_value + 1
				player:setStorageValue(ret_t.storage, sto_value)
				if sto_value < ret_t.amount then
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System] Killed ['..(sto_value)..'/'..ret_t.amount..'] '..mon_name..'.')
				else
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System] Killed You finished your task.')
				end
			end
		end
	end

	local ret_td = getTaskDailyInfo(player)
	if ret_td then
		if mon_name == ret_td.name or isInArray(ret_td.mons_list, mon_name) then
			local sto_value = player:getStorageValue(ret_td.storage)
			if sto_value < ret_td.amount then
				sto_value = sto_value + 1
				player:setStorageValue(ret_td.storage, sto_value)
				if sto_value < ret_td.amount then
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System Daily] Killed ['..(sto_value)..'/'..ret_td.amount..'] '..mon_name..'.')
				else
					player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[Task System Daily] Killed You finished your task.')
				end
			end
		end
	end

	return true
end

 

Ainda na pasta script  abra o login.lua e adicione dentro:


player:registerEvent("tasksystem")

Agora vá em data/events/scripts e abra o arquivo player.lua, depois de aberto, antes de:


self:sendTextMessage(MESSAGE_INFO_DESCR, description)

adicione:


	if thing:isCreature() then
		if thing:isPlayer() then
			description = string.format("%s\nTask Rank: "..getRankTask(thing), description)
		end
	end

 

                                                                                        Extra(Opcional)!!

 

Extra,  vá em data/movements/scripts e crie um  arquivo chamado tile task.lua, depois de aberto, antes de:

  Mostrar conteúdo oculto


local points_need = 25 -- Points required to pass.
local removePoints =  false -- True to remove and false to not remove the points.

function onStepIn(creature, item, position, fromPosition)
	if creature:isPlayer() then
		if taskPoints_get(creature) >= 25 then
			creature:sendTextMessage(MESSAGE_EVENT_ORANGE,"Good luck!!")
			if removePoints then
				taskPoints_remove(creature, points_need)
			end
		else
			creature:teleportTo(fromPosition, true)
			creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,"You must have "..points_need.." task points to pass.")
		end
	end
	return true
end

 

      

Vá em data/movements/movements.xml adicione: 


<movevent event="StepIn" actionid="XXXX" script="tile task.lua"/>

 

Explicação: Com esse movements acima, você só poderá passar por o piso caso tenha pontos task necessário para passar, se ativar a opção, removePoints então a mesma quantidade de pontos necessária para passar, será removida, ao passar, caso esteja desativada, então

apenas será necessário ter os pontos task para passar. Em XXXX coloque o actionid, e o actionid coloque no piso desejado!

 

New Extra: Vá em data/movements/scripts e crie um arquivo chamado tile task2.lua e adicione o seguinte scripts:

  Mostrar conteúdo oculto


local rank = "Elite" -- Required or higher rank to pass.


function onStepIn(creature, item, position, fromPosition)
	if creature:isPlayer() then
		if rankIsEqualOrHigher(getRankTask(creature), rank) then
			creature:sendTextMessage(MESSAGE_EVENT_ORANGE,"Good luck!!")
		else
			creature:teleportTo(fromPosition, true)
			creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,"Your task rank must be equal to or higher than "..rank.." to pass.")
		end
	end
	return true
end

 

 

Vá em data/movements/movements.xml adicione:  


<movevent event="StepIn" actionid="XXXX" script="tile task2.lua"/>

Explicação: Ao adicionar esse movements acima, você só poderá passar pelo piso caso seu rank task seja igual ou superior ao rank definido na variável, caso não seja igual e nem superior, não será possível passar.

Configure na lib, a sequência de ranks de acordo com a sequência de rank da tabela de pontos, assim:

  Mostrar conteúdo oculto


local ranks_task = {
[{1, 20}] = "Newbie", 
[{21, 50}] = "Elite",
[{51, 100}] = "Master",
[{101, 200}] = "Destroyer",		
[{201, math.huge}] = "Juggernaut"
}

local RankSequence = {
["Newbie"] = 1,
["Elite"] = 2,
["Master"] = 3,
["Destroyer"] = 4,
["Juggernaut"] = 5,
}

 

 

A sequência precisa está igual e numeradas.

                                                                                         Configurando!!


task_monsters = {
   [1] = {name = "monster1", mons_list = {"monster_t2", "monster_t3"},  storage = 30000, amount = 20, exp = 5000, pointsTask = {1, 1}, items = {{id = 2157, count = 1}, {id = 2160, count = 3}}},
   [2] = {name = "monster2", mons_list = {"", ""}, storage = 30001, amount = 10, exp = 10000, pointsTask = {1, 1}, items = {{id = 10521, count = 1}, {id = 2160, count = 5}}},
   [3] = {name = "monster3", mons_list = {"", ""}, storage = 30002, amount = 10, exp = 18000, pointsTask = {1, 1}, items = {{id = 2195, count = 1}, {id = 2160, count = 8}}},
   [4] = {name = "monster4", mons_list = {"", ""}, storage = 30003, amount = 10, exp = 20000, pointsTask = {1, 1}, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}}
}

task_daily = {
   [1] = {name = "monsterDay1", mons_list = {"monsterDay1_t2", "monsterDay1_t3"}, storage = 40000, amount = 10, exp = 5000, pointsTask = {1, 1}, items = {{id = 2157, count = 1}, {id = 2160, count = 3}}},
   [2] = {name = "monsterDay2", mons_list = {"", ""}, storage = 40001, amount = 10, exp = 10000, pointsTask = {1, 1}, items = {{id = 10521, count = 1}, {id = 2160, count = 5}}},
   [3] = {name = "monsterDay3", mons_list = {"", ""}, storage = 40002, amount = 10, exp = 18000, pointsTask = {1, 1}, items = {{id = 2195, count = 1}, {id = 2160, count = 8}}},
   [4] = {name = "monsterDay4", mons_list = {"", ""}, storage = 40003, amount = 10, exp = 20000, pointsTask = {1, 1}, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}}
}

                                       
                                              
nome - Nome do monstro.

mons_list - Nome dos monstro que são semelhantes e que matando eles também contará.

Exemplo:

name = "troll", mons_list = {"troll","frost troll","island troll"} e assim matando,  troll, frost troll e island troll contará na task também.
storage - É a storage que salva a quantidade de monstros já matados.
amount - É a quantidade necessária de monstros matados para finalizar a task.
exp - É a quantidade de Experiência que vai ganhar ao finalizar a task, caso não queira dar experiência, basta deixar em 0.
pointsTask = {Task Points Que vai ganhar(Pontos usado no piso e etc..), Pontos Rank, que irá ganhar e aumentar seu rank.}
items - Itens que o player vai ganhar, devem está tabelados, dentro da tabela item, adicione das tabelas contendo o id do item e count, quantidade de items que irá ganhar.
Ex: items = {{id = 2157, count = 1}, {id = 2160, count = 3}} -- Aqui contém 2x tipos de itens, o 2157 e o 2160, e suas devidas quantidades que irá ganhar.
items = {{id = 2157, count = 1}} -- Aqui só tem 1 tipo de item e a quantidade que vai ganhar.
Adicione quantos itens quiser. O mesmo vale para as task diarias!

 

 

 

Bom, é isso ae, qualquer duvida, crítica, sugestões, deixem ae, se precisa de suporte na instalação ou está com erro em algo estarei dando suporte, abraços e bom uso do sistema.

É totalmente proibido leva meu sistema para outro site, blog ou fórum!

eu tentei adptar isso em um poketibia deu uns erros  mas se eu nao conseguir resolver vou pedir ajuda heuheuheu

  • 2 years 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