Ir para conteúdo

Featured Replies

Postado
  • Este é um post popular.

Opa boa noite rapaziada, tudo bom?

 

Eu estou treinando um pouco scripts e acabei que tendo a ideia de fazer algo relacionado com as Guilds.
Então resolvi trazer 1 sistema de Guild Dungeon Lever para mim treinar ^^ 

Estou em fase de treinamento, então por favor, deem dicas e criticas ao sistema ! Obrigado ...

Como o sistema funciona?

Terá uma alavanca com local para os jogadores de sua Guild ficarem... O jogador que estiver na posição principal e próxima a alavanca irá clicar na alavanca que fará com que todos entrem na Dungeon. Os jogadores terão um tempo "x" para terminar, porém se o tempo acabar, o jogador será teleportado de volta para a posição principal da alavanca (Aonde o jogador clicou).


300347420_Semttulo.png.89aa8dcb7db5dcd48c7a72cd0d61ca9f.png

Como configurar o script?

local config = {
	time = 10,				-- 1 Second. (1*60 To Minutes)
	level = 100,				-- Level Necessary.
    dungeonPos = Position(1454, 909, 7), 	-- Dungeon Pos.
    needPos = {
        [1] = Position(1447, 915, 7), 		-- Position (where the player will click on the lever) and back position.
        [2] = Position(1449, 914, 7)
    },
    fromPos = {x = 1449, y = 904, z = 7}, 	-- Position /\ < from the dungeon
	toPos = {x = 1456, y = 911, z = 7},	-- Position \/ > from the dungeon

    Storagetime = 39320,			-- Storage Time.
    StorageDay = 39321,				-- Storage Day.

    Timer = 24*60*60				-- To re-enter in the dungeon. (24hours)
}

time ------------------ Tempo que os jogadores ficarão dentro da Dungeon.
level ----------------- Nível que todos precisam ser para entrar.
dungeonPos ------ Posição que todos os jogadores serão teleportados.
needPos ------------ Posição que os jogadores devem estar para serem teleportados.
fromPos ------------- Posição SUPERIOR ESQUERDO da sala.
toPos ----------------- Posição INFERIOR DIREITO da sala.
Storagetime -------- Não mexer se não souber.

StorageDay ----------- Não mexer se não souber.

Timer ------------------ Tempo que o jogador terá que esperar para entrar novamente na Dungeon.

 

 


Sem mais delongas, vamos ao script:
Adicione a linha em:
(data/actions/actions.xml)

	<!-- Script GUILD -->
	<action actionid="29305" script="Dungeon_Guild.lua" />

 

Adicione a linha em:
(data/actions/scripts/Dungeon_Guild.lua)

local config = {
	time = 5,								-- 1 Second. (1*60 To Minutes) inside the dungeon.
	level = 100, 							-- Level Necessary.
    dungeonPos = Position(1454, 909, 7), 	-- Dungeon Pos.
    needPos = {
        [1] = Position(1447, 915, 7), 		-- Position (where the player will click on the lever) and back position.
        [2] = Position(1449, 914, 7)
    },
    fromPos = {x = 1449, y = 904, z = 7}, 	-- Position /\ < from the dungeon
	toPos = {x = 1456, y = 911, z = 7},		-- Position \/ > from the dungeon

    Storagetime = 39320,					-- Storage Time.
    StorageDay = 39321,						-- Storage Day.

    Timer = 24*60*60						-- To re-enter in the dungeon. (24hrs)
}

function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
	
	local guild = player:getGuild()

	for i = 1, #config.needPos do
		
		local playerTile = Tile(config.needPos[i]):getTopCreature()

		if not playerTile or not playerTile:isPlayer() then
			player:getPosition():sendMagicEffect(CONST_ME_POFF)
			player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You need 2 players and stay on the orange floor.")
			return true
		end

		if not playerTile:getGuild() and not player:getGuild() then
			player:getPosition():sendMagicEffect(CONST_ME_POFF)
			return player:sendTextMessage(MESSAGE_STATUS_SMALL, "One of the members does not have guild.")
		end

		if playerTile:getLevel() < config.level then
			player:getPosition():sendMagicEffect(CONST_ME_POFF)
			return player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level "..config.level.." or higher.")
		end

		if player:getGuild():getId() ~= playerTile:getGuild():getId() then
			player:getPosition():sendMagicEffect(CONST_ME_POFF)
			return player:sendTextMessage(MESSAGE_STATUS_SMALL, "Only players in your guild can join you.")
		end	

		if player:getStorageValue(config.Storagetime) - os.time() > 0 and playerTile:getStorageValue(config.Storagetime) - os.time() > 0 then
			player:getPosition():sendMagicEffect(CONST_ME_POFF)
			return false
		end

		if player:getStorageValue(config.StorageDay) - os.time() > 0 and playerTile:getStorageValue(config.StorageDay) - os.time() > 0 then
			player:getPosition():sendMagicEffect(CONST_ME_POFF)
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You're in cooldown to enter in a dungeon again. Cooldown: %s.", string.diff(player:getStorageValue(config.StorageDay)-os.time())))
			return false
		end

		local players = {}

		for x = config.fromPos.x, config.toPos.x do
			for y = config.fromPos.y, config.toPos.y do
				for z = config.fromPos.z, config.toPos.z do
					local tile = Tile(x, y, z)
					local creature = tile:getTopCreature()
					if creature and creature:isPlayer() then
						players[#players+1] = creature
					end
				end
			end
		end

		if #players > 0 then
			player:getPosition():sendMagicEffect(CONST_ME_POFF)
			return player:sendTextMessage(MESSAGE_STATUS_SMALL, "Already has a guild inside.")
		end

		player:teleportTo(config.dungeonPos)
		playerTile:teleportTo(config.dungeonPos)
		playerTile:getPosition():sendMagicEffect(50)
		
		addEvent(function()
    			player:teleportTo(config.needPos[i])
    			playerTile:teleportTo(config.needPos[i])
    			player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    			playerTile:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
    			player:setStorageValue(config.StorageDay, os.time() + config.Timer)
    			playerTile:setStorageValue(config.StorageDay, os.time() + config.Timer)
  		end, config.time*1000)

		return false
	end

	return true
end


Créditos:
@KotZletY

E eu ^^ 

Espero que gostem ? ...


Edit* Adicionado Tempo para que você possa entrar novamente na Dungeon:
1993598438_Semttulo.png.1297b29160be370e2570bfe8f9e7ca72.png

Rep+ ^^

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

  • Respostas 14
  • Visualizações 6.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Opa boa ideia !  Vou colocar aqui quando eu estiver com um tempinho ^^ . @DevMorgan  @Vodkart Script Atualizado !

  • Script Top voce podia por uma storage para usarem a alavanca uma vez por dia assim podia fazer uma Daily Guild dugeon

  • Você colocou as Posições foram colocadas corretamente? em: needPos = { [1] = Position(1447, 915, 7), -- Position (where the player will click on the lever) and back position.

Posted Images

Postado

Parabéns, seu tópico de conteúdo foi aprovado!
Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.

Spoiler

Congratulations, your content has been approved!
Thank you for your contribution, we of Tibia King we are grateful.
Your content will help many other users, you received +1 REP.

 

vodkart_logo.png

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

 

DISCORDvodkart#6090

 

Postado

Script Top voce podia por uma storage para usarem a alavanca uma vez por dia assim podia fazer uma Daily Guild dugeon

1583290_1.png

Postado
  • Autor
29 minutos atrás, DevMorgan disse:

Script Top voce podia por uma storage para usarem a alavanca uma vez por dia assim podia fazer uma Daily Guild dugeon

Opa boa ideia ! 

Vou colocar aqui quando eu estiver com um tempinho ^^ .

@DevMorgan 
@Vodkart
Script Atualizado !

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