Ir para conteúdo
  • Cadastre-se

(Resolvido)como abrir quantas tasks quiser? script do vodkart


Ir para solução Resolvido por Vodkart,

Posts Recomendados

@poko360 entendi, então eu fiz de forma individual, para colocar na propria tabela...:

 

 

<?xml version="1.0" encoding="ISO-8859-1"?> 
<mod name="Automatic Simple Task" version="1.0" author="Vodkart" contact="tibiaking.com" enabled="yes"> 
<config name="auto_stask"><![CDATA[

automatic_task = {
	[1] = {name = "Trolls", storage = 761000, monsters_list = {"Troll","Troll champion"}, can_repeat = true, level_min = 10, count = 5, reward = {{2173,1}}, exp = 2000, money = 2000},
	[2] = {name = "rotworms", storage = 761001, monsters_list = {"rotworm","carrion worm","Rotworm Queen"}, can_repeat = true, level_min = 11, count = 6, reward = {{2173,1},{2159,10}}, exp = 2500, money = 3000},
	[3] = {name = "cyclops", storage = 761002, monsters_list = {"cyclops","cyclops smith","cyclops drone"}, can_repeat = true, level_min = 12, count = 7, reward = {{2173,2},{2159,50}}, exp = 3000, money = 3000},
	[4] = {name = "ORSHABAAL BOSS", storage = 761003, monsters_list = {"orshabaal"}, can_repeat = false, level_min = 15, count = 1, reward = {{2173,2},{2159,100}}, exp = 10000, money = 10000}
}

automatic_task_config = {
	reward_type = MESSAGE_STATUS_CONSOLE_BLUE,
	defeat_type = MESSAGE_STATUS_CONSOLE_ORANGE,
	defeat_storage = 963850,
	lvl_advance_control = 963851
}

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 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
]]></config>
<event type="advance" name="TaskAutAdvance" event="script"><![CDATA[
domodlib('auto_stask')
function onAdvance(cid, skill, oldLevel, newLevel)
	if (skill == SKILL__LEVEL) then
		if getPlayerStorageValue(cid, automatic_task_config.lvl_advance_control) < newLevel then
			for k, v in pairs(automatic_task) do
				if v.level_min == newLevel then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Task System] Voce Desbloqueou a "..v.name.." Task! Parabéns!")
				end
			end
			setPlayerStorageValue(cid, automatic_task_config.lvl_advance_control, newLevel)
		end
	end
	return true
end]]></event>
<talkaction words="/task;!task" event="buffer"><![CDATA[
domodlib('auto_stask')
param, str = param:lower(),"Task(s) Disponiveis:\n\n"
if isInArray({"counter","contador","count"},param) then
	setPlayerStorageValue(cid, automatic_task_config.defeat_storage, getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and 1 or 0)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"[Task System] O contador foi "..(getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and "ativado" or "desativado")..".") return true
end
for k, v in pairs(automatic_task) do
	if getPlayerLevel(cid) >= v.level_min and getPlayerStorageValue(cid, v.storage) < v.count then
	local amount = getPlayerStorageValue(cid, v.storage) <= 0 and 0 or getPlayerStorageValue(cid, v.storage)
		str = str.."[+] "..v.name .." Task [+]\n\nMonster Count: ["..amount.."/"..v.count.."]\n\nMonsters Killing: "..getMonsterFromList(v.monsters_list)..".\n\nLevel: "..v.level_min.." or More.\n\nCan repeat: ".. ( v.can_repeat == true and "yes" or "no" )..".\n\nRewards: ".. (table.maxn(v.reward) > 0 and getItemsFromList(v.reward) or "Nothing") ..".\n\nExp: ".. (v.exp > 0 and v.exp or 0) ..".\n\nMoney: ".. (v.money > 0 and v.money or 0) ..".\n\n"
	end
end
return doShowTextDialog(cid, 8983, str)
]]></talkaction>
<event type="login" name="TaskAutLogin" event="script"><![CDATA[
function onLogin(cid)
	registerCreatureEvent(cid, "KillAutTask")
	registerCreatureEvent(cid, "TaskAutAdvance")
	return true
end]]></event>
<event type="kill" name="KillAutTask" event="script"><![CDATA[
domodlib('auto_stask')
function onKill(cid, target)
	local str = ""
	if isPlayer(cid) and isMonster(target) then
		for task , info in pairs(automatic_task) do
			if isInArray(info.monsters_list, getCreatureName(target):lower()) and getPlayerLevel(cid) >= info.level_min then
				local ret = getPlayerStorageValue(cid, info.storage) <= 0 and 0 or getPlayerStorageValue(cid, info.storage)
				if ret < info.count then
					setPlayerStorageValue(cid, info.storage, getPlayerStorageValue(cid, info.storage) <= 0 and 1 or (getPlayerStorageValue(cid, info.storage)+1))
					if getPlayerStorageValue(cid, automatic_task_config.defeat_storage) <= 0 and getPlayerStorageValue(cid, info.storage) < info.count then
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,"[Task System] defeated Total [" .. getPlayerStorageValue(cid, info.storage) .. "/" .. info.count .. "] da Task do " .. info.name .. ".")
					end
					if getPlayerStorageValue(cid, info.storage) >= info.count then
						if info.exp > 0 then doPlayerAddExp(cid, info.exp) str = str.."".. (str == "" and "" or ", ") .." "..info.exp.." de exp" end
						if info.money > 0 then doPlayerAddMoney(cid, info.money) str = str.."".. (str == "" and "" or ", ") ..""..info.money.." gps" end
						if table.maxn(info.reward) > 0 then GiveRewardsTask(cid, info.reward) str = str.."".. (str == "" and "" or ", ") ..""..getItemsFromList(info.reward) end
						doPlayerSendTextMessage(cid, automatic_task_config.reward_type, "[Task System] Voce completou a "..info.name.." Task. Obrigado pela sua ajuda!! Suas Recompensas: "..(str == "" and "nenhuma" or str))
						if info.can_repeat == true then
							setPlayerStorageValue(cid, info.storage, 0)
						end
					end
				end
			end
		end
	end
	return true
end]]></event>
</mod>

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
  • Respostas 30
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Está aqui:   https://pastebin.com/raw/Z7KtXhXT   Obrigado pela sua ajuda!   OBS: Não esqueça de excluir a outra task, para não dar conflito com a talkactions !task e task     Features da Automatic Task:     [+] Comando que mostra as tasks disponiveis pelo level. ( se já feita, ela não mostra mais) [+] Contador de monstros mortos [+] Talkactions para ativar e desativar o contador [+] Script de onAdvance que mostra qual tas

@poko360 tinha mta coisa faltando, quando vc copiou saiu várias funções n sei pq   pega daqui:     https://pastebin.com/raw/kF7TLf9A

@Vodkart lindo, conseguiu? esquece de mim nauu :C

Posted Images

@poko360 é qndo termina a task? ou em algum monstro especifico? testei aqui e não apareceu esse erro... vc não está usando as mesmas storages da task antiga né?

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

@Vodkart

nao, nao estou usando as mesmas storages das tasks antigas

tipo, funcionou 100% desde que daquele dia que te dei rep +, so que hoje começou a dar esse error, algum player tentou burlar (nao sei)
tipo, n tem como eu saber oq ocorreu, o server so começou a travar e ficava spammando essa msg da foto varias vezes

Link para o post
Compartilhar em outros sites

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.

  • Estatísticas dos Fóruns

    96847
    Tópicos
    519606
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo