Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Hi, com esse simple system vc vai pode ter tudas os mana runes pra seus vocs em so um file, easy pra configure

O script foi feito pra servers 1.X

 

peço desculpas, meu pt n e mt bom ?

 

data/lib/manaRuneSys.lua

Spoiler

manaRuneSys = 
{
	refillData = 
	{
		[1] = --sorc/druids
		{
			runeId = 2306,
			health = {min = 0, max = 0},
			mana = {min = 200, max = 310},
			effect = CONST_ME_YELLOWENERGY,
		},

		[2] = --pally
		{
			runeId = 2307,
			health = {min = 100, max = 110},
			mana = {min = 150, max = 200},
			effect = CONST_ME_BUBBLES,
		},

		[3] = --kina
		{
			runeId = 2309,
			health = {min = 200, max = 310},
			mana = {min = 0, max = 0},
			effect = CONST_ME_MAGIC_RED,
		},

	}
}

function manaRuneSys:refill(player, runeId)
	if (player) then
		local vocId = player:getVocation():getId()
		local refillData = self:getTable(vocId)
		if (refillData) then 
			if (refillData.runeId ~= runeId) then 
				player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your vocation can't use this rune.")
				return false
			end 

			local pos = player:getPosition()
			if (refillData.health) then
				local hp = refillData.health 
				local giveHp = math.random(hp.min, hp.max)
				if (giveHp > 0) then 
					player:addHealth(giveHp)
					Game.sendAnimatedText(string.format("+%d", giveHp), pos, TEXTCOLOR_RED)
				end 
			end 

			if (refillData.mana) then
				local mana = refillData.mana 
				local giveMana = math.random(mana.min, mana.max)
				if (giveMana > 0) then 
					player:addMana(giveMana)
					Game.sendAnimatedText(string.format("+%d", giveMana), pos, TEXTCOLOR_BLUE)
				end 
			end 

			if (refillData.effect) then 
				pos:sendMagicEffect(refillData.effect)
			end
		else 
			player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your vocation can't use any mana rune")
		end 
	end 
end 

function manaRuneSys:getTable(vocId)
	local index = 0
	if (isInArray({1, 2, 5, 6}, vocId)) then
		index = 1
	elseif (isInArray({3, 7}, vocId)) then
		index = 2
	elseif (isInArray({4, 8}, vocId)) then
		index = 3	
 	end 

	return self.refillData[index]
end 

 

 

 

data/actions/scripts/manaRune.lua

Spoiler

dofile('data/lib/manaRuneSys.lua')
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	manaRuneSys:refill(player, item:getId())
	return true 
end 

 

 

 

Como configurar?

index pra sorcs/druid e 1

index para paladins = 2

index pra kinas e = 3

 


        [1] = --sorc/druids << tem index 1
        {
            runeId = 2306, --item id do rune
            health = {min = 0, max = 0}, --min/max hp pra fazer o random value
            mana = {min = 200, max = 310}, --min/max mana pra fazer o random value
            effect = CONST_ME_YELLOWENERGY, --effect
        },

 

lembra adicionar os ids que precisar no actions.xml 

	<action itemid="2306" script="manaRune.lua" />
	<action itemid="2307" script="manaRune.lua" />
	<action itemid="2309" script="manaRune.lua" />

 

E tudo, se tiver duvida so precisa escrever ?

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

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.

 

  • 1 month 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.7k

Informação Importante

Confirmação de Termo