Ir para conteúdo

Featured Replies

Postado
Spoiler

local config = {
	weapons = {
		-- [ID] = LIFE STEAL %,
		[8602] = 10,
	},
	-- Vocations number
	-- 1, 5 = Druid, Elder Druid
	-- 2, 6 = Sorcerer, Master Sorcerer
	-- 3, 7 = Paladin, Royal Paladin
	-- 4, 8 = Knight, Elite Knight
	-- others
	vocations = {4, 8}
}

function onLogin(cid)
	registerCreatureEvent(cid, "LifeSteal")
	return true
end

function onStatsChange(cid, attacker, type, combat, value)
	if not isCreature(attacker) then
		return true
	end

	for slot = 5, 6 do -- right & left
		for id, perc in pairs(config.weapons) do
			if(getPlayerSlotItem(attacker, slot).itemid == id and math.random(100) <= 10) then
				return doCreatureAddHealth(attacker, math.ceil(value / perc))
			end
		end
	end

	return true
end

 

 

  • Respostas 33
  • Visualizações 2.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Isso aqui só funciona em OTX: if (getPlayerSlotItem(attacker, slot).id == id) then   Tenta: if(getPlayerSlotItem(attacker, slot).itemid == id) then  

Postado
7 minutos atrás, Yamborghini disse:

funcionou! porém, ele não para de healar, gostaria que fosse por chances, tipo a cada 10 hits, 1 desses healava a vida

 

Mas o script é o mesmo, se esta healando toda hora com monstro, provavelmente é porque com players também já estava.

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

Postado
  • Autor
4 minutos atrás, MaTTch disse:
  Ocultar conteúdo


local config = {
	weapons = {
		-- [ID] = LIFE STEAL %,
		[8602] = 10,
	},
	-- Vocations number
	-- 1, 5 = Druid, Elder Druid
	-- 2, 6 = Sorcerer, Master Sorcerer
	-- 3, 7 = Paladin, Royal Paladin
	-- 4, 8 = Knight, Elite Knight
	-- others
	vocations = {4, 8}
}

function onLogin(cid)
	registerCreatureEvent(cid, "LifeSteal")
	return true
end

function onStatsChange(cid, attacker, type, combat, value)
	if not isCreature(attacker) then
		return true
	end

	for slot = 5, 6 do -- right & left
		for id, perc in pairs(config.weapons) do
			if(getPlayerSlotItem(attacker, slot).itemid == id and math.random(100) <= 10) then
				return doCreatureAddHealth(attacker, math.ceil(value / perc))
			end
		end
	end

	return true
end

 

 

deu esse erro:

[23:45:23.045] [Error - CreatureScript Interface]
[23:45:23.057] data/creaturescripts/scripts/lifesteal.lua:onStatsChange
[23:45:23.071] Description:
[23:45:23.082] (LuaInterface::luaGetPlayerSlotItem) Player not found

6 minutos atrás, Way20 disse:

 

Ok, eu posso fazer, mas o script é o mesmo, se esta healando toda hora com monstro, provavelmente é porque com players também já estava. Vou fazer e já já posto aqui.

okay!

Postado
Spoiler

local config = {
	weapons = {
		-- [ID] = LIFE STEAL %,
		[8602] = 10,
	},
	-- Vocations number
	-- 1, 5 = Druid, Elder Druid
	-- 2, 6 = Sorcerer, Master Sorcerer
	-- 3, 7 = Paladin, Royal Paladin
	-- 4, 8 = Knight, Elite Knight
	-- others
	vocations = {4, 8}
}

function onLogin(cid)
	registerCreatureEvent(cid, "LifeSteal")
	return true
end

function onStatsChange(cid, attacker, type, combat, value)
	if(isPlayer(attacker)) then
		for slot = 5, 6 do -- right & left
			for id, perc in pairs(config.weapons) do
				if(getPlayerSlotItem(attacker, slot).itemid == id and math.random(100) <= 10) then
					return doCreatureAddHealth(attacker, math.ceil(value / perc))
				end
			end
		end
	end

	return true
end

 

 

Postado
  • Autor
17 minutos atrás, MaTTch disse:
  Ocultar conteúdo


local config = {
	weapons = {
		-- [ID] = LIFE STEAL %,
		[8602] = 10,
	},
	-- Vocations number
	-- 1, 5 = Druid, Elder Druid
	-- 2, 6 = Sorcerer, Master Sorcerer
	-- 3, 7 = Paladin, Royal Paladin
	-- 4, 8 = Knight, Elite Knight
	-- others
	vocations = {4, 8}
}

function onLogin(cid)
	registerCreatureEvent(cid, "LifeSteal")
	return true
end

function onStatsChange(cid, attacker, type, combat, value)
	if(isPlayer(attacker)) then
		for slot = 5, 6 do -- right & left
			for id, perc in pairs(config.weapons) do
				if(getPlayerSlotItem(attacker, slot).itemid == id and math.random(100) <= 10) then
					return doCreatureAddHealth(attacker, math.ceil(value / perc))
				end
			end
		end
	end

	return true
end

 

 

funcionou certinho! agora, um ultimo pedido... ele está healando conforme o ataque, exemplo: hitei 378 e lá tá 5% ele heala 96 (?) eu não entendi mt bem... parece não estar funcionando essa % ... eu botei 50 dps e ele começou a healar 7, 8, 11 e eu estava batendo 400...

queria que eu botasse 50% e ela healava ex: hit de 300 heala 150

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

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo