Ir para conteúdo
  • Cadastre-se

Posts Recomendados

  • 5 months later...
  • Respostas 82
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

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.

@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 *-*    

Posted Images

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

Link para o post
Compartilhar em outros sites
  • 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

×   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 Bagon
      Bom, hoje venho trazer á vocês um sistema de Pet System DIFERENCIADO de alguns presentes no fórum. Este sistema tem diversos comandos diferenciados, como: 
       
      !pet nomedopet este comando irá sumonar o pet. 
      !remove irá remover o pet.
      !fale eu sou lindo o pet falará "eu sou lindo"
      !conversar o pet irá conversar com vc. 
       
      Então sem mais delongas vamos ao script.
       
      OBS: SCRIPT TESTADO SOMENTE EM TFS 0.4/0.3, e este script foi feito com a intenção de ser vendido no site do ot ou em poderá usar como quest usando o item selecionado como premio. fique ao seu critério.
       
      Primeiro vá até a pasta talkaction/script e crie um arquivo chamado petsystem.lua, depois coloque o seguinte script:
       
       
      Agora em talkactions/talkactions.xml adicione a seguinte tag:
       
      <talkaction words="!pet;!remove;!fale;!conversar" event="script" value="petsystem.lua" />  
      EXPLICAÇÂO:
      As partes em Negrito, são os pets. Você pode alterar ou criar monstros para fazer eles como pets. (Recomendo criar um monstro para que seja somente pet.)
       
      Exemplo: ["dog"]= {stor=78552},      
       
       
      Lembrando que é necessário mudar esta parte no script do monstro colocado a cima.
       
      <flag attackable="1" /> para :
       
      <flag attackable="0" />  
      agora vá em action/script e crie um arquivo chamado pet com o seguinte script:
       
       
      e vá em action.xml e adiciona a seguinte tag:
       
      <action itemid="10063" script="pet.lua"/> Explicação: Na tag da action o itemid é o item que deverá ser usado para ganhar a storage 78552, e assim podera sumonar o monstro com esta storage.
       
                                              
                                                         CRIE UMA ACTION COM A TAG A CIMA PARA CADA MONSTRO COLOCADO NA TALKACTION,
                                                         BASTA VC ALTERAR A STORAGE DO SCRIPT DA ACTION
                                                         EXEMPLO: em action altere as storage que estão em vermelho, como mostra abaixo
       
                                                              if getPlayerStorageValue(cid, 78552) < 1 then
                                                              setPlayerStorageValue(cid, 78552, 1)
       
                                                         aonde tem 78552 altere para 78553 que no caso é a storage do cyclops escolhido lá no script da talkaction
                                                         e assim susecivelmente.
       
       
       
      CREDITOS:
      Mulizeu
      Smartbox
      Bagon 
       
    • 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 Imperius
      Olá, pessoal! Acabei encontrando um script que tinha feito a um tempo atrás. Estou compartilhando aqui para quem quiser usar ou melhorar.
       
      É bem parecido com os outros sistemas de roleta, igual deste tópico: https://tibiaking.com/forums/topic/101557-action-cassino-roleta-de-items/
       
      Como funciona?
       
      O "Treasure Chest" é um item custom, onde o jogador têm a possibilidade de ganhar itens raros ou bem meia boca. Tudo dependerá da sorte.
       
      O jogador precisa tacar o treasure chest na bancada e acionar a alavanca. O treasure chest irá se transformar em vários itens de forma randômica no qual o jogador poderá ou não ganhar. No final, apenas um item é entregue ao jogador.
       
      Para entender melhor o seu funcionamento, segue o GIF abaixo:
       

       
       
      em data > actions > actions.xml
       
       
      em data > actions > scripts > crie um arquivo chamado leverTreasureChest.lua
       
       
      no banco de dados do servidor, adicione o seguinte código em "SQL":
       
       
       

      Também estou disponibilizando uma página PHP, para quem quiser usar no site do servidor. Na página tem informações sobre o funcionamento, quais são os possíveis prêmios e a lista de jogadores que ganharam os itens raros.
       

       
       
      Espero ter ajudado de alguma forma! : )
       
      treasure_chest.php
    • Por luanluciano93
      Olá pessoal, estou desenvolvendo esse sistema vip para TFS 1.x, se precisarem de alguma função nova é só comentar, criei para usar em um servidor meu e resolvi postar, bom proveito a todos.
       
      É só ir no arquivo data/lib/core/player.lua e adicionar esse código no começo do script:
      -- ALTER TABLE `accounts` ADD `vip_time` BIGINT(20) NOT NULL DEFAULT 0; -- player:getVipTime() function Player.getVipTime(self) local resultId = db.storeQuery("SELECT `vip_time` FROM `accounts` WHERE `id` = '".. self:getAccountId() .."';") local time = resultId ~= false and result.getNumber(resultId, "vip_time") or 0 result.free(resultId) return time end -- player:isVip() function Player.isVip(self) return self:getVipTime() > os.time() and true or false end -- player:addVipDays(days) function Player.addVipDays(self, days) return(self:isVip() and tonumber((days * 86400))) and db.query("UPDATE `accounts` SET `vip_time` = '".. (self:getVipTime() + (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") or db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() + (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:removeVipDays(days) function Player.removeVipDays(self, days) return(self:isVip() and tonumber((days * 86400))) and db.query("UPDATE `accounts` SET `vip_time` = '".. (self:getVipTime() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") or db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:setVipDays(days) function Player.setVipDays(self, days) return db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:removeVip() function Player.removeVip(self) db.query("UPDATE `accounts` SET `vip_time` = '0' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") end -- player:sendVipDaysMessage() function Player.sendVipDaysMessage(self) if self:isVip() then local vipTime = self:getVipTime() - os.time() local vipDays = 1 + (math.floor(vipTime / 86400)) return self:getVipTime() ~= false and self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You have '.. vipDays .. ' vip day(s) in your account.') end end -- player:checkVipLogin() function Player.checkVipLogin(self) if self:getVipTime() > 0 and not self:isVip() then return self:removeVip() and self:teleportTo(self:getTown():getTemplePosition()) end end  
       
      As funções são:
      • player:getVipTime() - Retorna o valor da tabela vip_time (igual esta na database).
      • player:isVip() - Retorna se o player é vip ou não.
      • player:addVipDays(days) - Usa-se em algum script para para adicionar dias de vip ao player (parâmetro de entrada "days").
      • player:removeVipDays(days) - Usa-se em algum script para para remover dias de vip do player (parâmetro de entrada "days").
      • player:setVipDays(days) - Usa-se em algum script para para mudar os dias de vip do player (parâmetro de entrada "days").
      • player:removeVip() - Usa-se em algum script para para remover todo tempo de vip do player.
      • player:sendVipDaysMessage() - Retorna uma mensagem no player mostrando os dias de vip que ainda restam ao player.
      • player:checkVipLogin() - Checa se a vip do player acabou, se sim teleporta ele para o templo.
       

      Qualquer dúvida ou erro/bug poste aqui.
    • Por Linus
      Você  pode configurar se quer que o preço aumente a cada reset, se quer que o level pra resetar aumente e se vc quer que a vida resete junto (e quanto % da vida atual será a vida após resetar).
       
       
      Testado em tfs 1.1, Versão 10.77
       
       
       
       
      Vá em data/npc/lib/ crie npc_resets.lua :
       



       
      Você pode editar mexendo aqui. no script acima :
      config = { minlevel = 150, --- Level inical para resetar price = 10000, --- Preço inicial para resetar newlevel = 20, --- Level após reset priceByReset = 0, --- Preço acrescentado por reset percent = 30, ---- Porcentagem da vida/mana que você terá ao resetar (em relação à sua antiga vida total) maxresets = 50, ---- Maximo de resets levelbyreset = 0 --- Quanto de level vai precisar a mais no próximo reset } agora em data/npc/ crie reseter.XML :
       



       
       
       
      Agora em data/npc/scripts crie reseter.lua :
       



       
       
       
      Img : 
       


×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo