Ir para conteúdo

Featured Replies

Postado
17 horas atrás, Adriano SwaTT disse:

Boa tarde,

 

Poderia ser criado em movements o code para tal ação.

 

Não creio ser difícil, caso ainda não tenha conseguido, me avise e posso te ajudar.

 

 

Boa sorte.

Como crio essa função? Tentei procurar por palavras chaves em tópicos aqui no tibiaking mas nao encontrei, e nem em 1 ou 2 foruns fora esse

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

Top Posters In This Topic

Most Popular Posts

  • Colocar vida ou para aumentar a vida do player que o usar? Favor, seja mais específico para que os scripters possam te ajudar, diga algo do tipo:   Gostaria que ao usar/equipar um helmet o player f

  • Vai em data/items/items.xml. 1º Aperta contrl+ F é la vai aparescer um bloco de pesquisa você bota o nome do seu item la é click em Pesquisa Quando aparescer vai ta tipo uns negoços tipo asim! Exemp

  • Abra sua pasta Movements e nela seu arquivo movements.xml e neste adicione a tag abaixo: <movevent type="Equip" itemid="2088" slot="shield" event="script" value="nome_do_item.lua"/>       <

Postado
1 hora atrás, kukas9 disse:

Como crio essa função? Tentei procurar por palavras chaves em tópicos aqui no tibiaking mas nao encontrei, e nem em 1 ou 2 foruns fora esse

Tente assim:

 

Registre em movements.xml como equip e deequip como abaixo (mudando apenas a ID do item):

<movevent type="Equip" itemid="1294" slot="head" event="script" value="buffHelmet.lua"/>
<movevent type="DeEquip" itemid="1294" slot="head" event="script" value="buffHelmet.lua"/>

 

E o script em .LUA como de costume e use esse buffHelmet.lua.

local cfg = {
	lifePercent = 40, -- value in percent
}

function onEquip(cid, item, slot)
	if isPlayer(cid) then
		maxHealth = getCreatureMaxHealth(cid)
		healthValue = (maxHealth + math.ceil((maxHealth / 100) * cfg.lifePercent))
		setCreatureMaxHealth(cid, healthValue)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have equiped your '..getItemNameById(item.itemid)..' and your life points was buffed in '..cfg.lifePercent..'%.')
		return true
	end
end

function onDeEquip(cid, item, slot)
	if isPlayer(cid) then
		maxHealth = getCreatureMaxHealth(cid)
		healthValue = (maxHealth - math.ceil((maxHealth / 100) * cfg.lifePercent))
		setCreatureMaxHealth(cid, healthValue)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your buff of life points was removed.')
		return true
	end
end

 

______________________________________________________________________________________________________________________

 

Ao @Ribeiro Foda

Use o mesmo esquema no movements.xml e use esse script em seu respectivo .LUA.

local cfg = {
	lifeAmount = 150, -- Amount of Life
}

function onEquip(cid, item, slot)
	if isPlayer(cid) then
		maxHealth = getCreatureMaxHealth(cid)
		healthValue = (maxHealth + cfg.lifeAmount)
		setCreatureMaxHealth(cid, healthValue)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have equiped your '..getItemNameById(item.itemid)..' and buffed in '..cfg.lifeAmount..' life points.')
		return true
	end
end

function onDeEquip(cid, item, slot)
	if isPlayer(cid) then
		maxHealth = getCreatureMaxHealth(cid)
		healthValue = (maxHealth - cfg.lifeAmount)
		setCreatureMaxHealth(cid, healthValue)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your buff of life points was removed.')
		return true
	end
end

 

Boa sorte para ambos.

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

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Postado
10 horas atrás, Adriano SwaTT disse:

Tente assim:

 

Registre em movements.xml como equip e deequip como abaixo (mudando apenas a ID do item):


<movevent type="Equip" itemid="1294" slot="head" event="script" value="buffHelmet.lua"/>
<movevent type="DeEquip" itemid="1294" slot="head" event="script" value="buffHelmet.lua"/>

 

E o script em .LUA como de costume e use esse buffHelmet.lua.


local cfg = {
	lifePercent = 40, -- value in percent
}

function onEquip(cid, item, slot)
	if isPlayer(cid) then
		maxHealth = getCreatureMaxHealth(cid)
		healthValue = (maxHealth + math.ceil((maxHealth / 100) * cfg.lifePercent))
		setCreatureMaxHealth(cid, healthValue)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have equiped your '..getItemNameById(item.itemid)..' and your life points was buffed in '..cfg.lifePercent..'%.')
		return true
	end
end

function onDeEquip(cid, item, slot)
	if isPlayer(cid) then
		maxHealth = getCreatureMaxHealth(cid)
		healthValue = (maxHealth - math.ceil((maxHealth / 100) * cfg.lifePercent))
		setCreatureMaxHealth(cid, healthValue)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your buff of life points was removed.')
		return true
	end
end

 

______________________________________________________________________________________________________________________

 

Ao @Ribeiro Foda

Use o mesmo esquema no movements.xml e use esse script em seu respectivo .LUA.


local cfg = {
	lifeAmount = 150, -- Amount of Life
}

function onEquip(cid, item, slot)
	if isPlayer(cid) then
		maxHealth = getCreatureMaxHealth(cid)
		healthValue = (maxHealth + cfg.lifeAmount)
		setCreatureMaxHealth(cid, healthValue)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have equiped your '..getItemNameById(item.itemid)..' and buffed in '..cfg.lifeAmount..' life points.')
		return true
	end
end

function onDeEquip(cid, item, slot)
	if isPlayer(cid) then
		maxHealth = getCreatureMaxHealth(cid)
		healthValue = (maxHealth - cfg.lifeAmount)
		setCreatureMaxHealth(cid, healthValue)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your buff of life points was removed.')
		return true
	end
end

 

Boa sorte para ambos.

 

Obrigado cara, vou testar aqui

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