Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Olá tibianos.

 

Criei um script de bless automático com base nessa solicitação:

 

A bless será aplicada somente se o player estiver carregando X item.

A bless não será aplicada se o player já tiver bless.

Essa bless é somente aplicada no momento em que o player morrer.

 

Configurações:

ID do item que o player deve ter para receber a bless automática;

Quantidade de bless disponíveis no servidor (para servidores custom);

Remover o item ao ativar o sistema ou mantê-lo (bless infinita);

Level mínimo para o sistema ser ativado.

 

 

deathBless.lua

 

config = {
	id = 2195, -- id do item
	bless = 6, -- quantidade de blessings do servidor
	remover = true, -- remover item? true/false
	minLvl = 100 -- level minimo
	}
	
-- hasAllBlessings(player) by Luiz Henrique Marsilio. 
function hasAllBlessings(player) --Verifica se o player tem todas blessings
	local cont = 0
	for i=1,config.bless do
		if player:hasBlessing(i) then
			cont = cont+1
		end
	end
	if cont >= config.bless then -- se nao tiver alguma bless prossegue com o sitema
		return true
	else
		return false
	end
end

function onPrepareDeath(creature, killer)

	if not creature:isPlayer() then
		return true
	end
	if hasAllBlessings(creature) then -- function by Luiz Henrique Marsilio
		creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You are already protected by blessings.")
		return true
	end
	if creature:getLevel() >= config.minLvl then
		if creature:getItemCount(config.id) >= 1 then
			for i = 1, config.bless do
				creature:addBlessing(i)
			end
			if config.remover then
				creature:removeItem(config.id, 1)
				creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You were protected by a blessing charm.")
			end
			creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You have been blessed by the charm before dying.")
		else
			creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You were not wearing a blessing charm and was not blessed when died.")
		end
	else
		creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You need level " .. config.minLvl .. " or higher to be automatic blessed.")
	end
	return true
end

 

Link para o post
Compartilhar em outros sites

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.

 

Link para o post
Compartilhar em outros sites

criativo e interessante, curti. ?

 

 http://baiakuza.com/
IP: baiakuza.com
TIBIA: 10.96
Baiak Custom [ High Exp Rate ]

 

 

 

 

Link para o post
Compartilhar em outros sites
  • 1 month later...
Em 11/06/2018 em 19:35, luiz.marsilio disse:

Obrigado. Eu estou aprimorando minhas habilidades em LUA, ainda bem básicas.

Se tiveres sugestões de scripts que eu possa trazer para o TFS 1.2 serão bem vindas.

castle 24 hrs

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo