Ir para conteúdo

Featured Replies

Postado
  • Este é um post popular.

Hoje vim trazer à pedidos uma spell do League of Legends que é a chain Lightning do personagem Ryze:

Aqui tem um vídeo explicativo: 



Teoricamente está idêntico porém não tive a chance de testar então vou postar aqui e esperar que vocês me falem sobre os erros que podem dar (apesar de eu achar que não vai dar nenhum)

Crie um arquivo em data\spells\scripts chamado chainlight.lua e coloque isso dentro dele:

local config = {
	effectx = 35, --- efeito de distancia
	effectz = 11, --- efeito ao acertar o player
	percent = 70, --- porcentagem de ir pra outro target apos hitar
	delay = 150 --- velocidade com que se move (milisegundos)
}

function doBlast(uid, target, delay, effectx, effectz, percent, min, max, type, hits, fromPos, n)
	if fromPos ~= nil and (fromPos.x ~= getCreaturePosition(target).x or fromPos.y ~= getCreaturePosition(target).y) then
		doSendDistanceShoot(fromPos, getCreaturePosition(target), effectx)
		fromPos = (fromPos.x ~= getCreaturePosition(target).x or fromPos.y ~= getCreaturePosition(target).y) and getCreaturePosition(target) or nil
	else
		fromPos = getCreaturePosition(target)
	end	
doTargetCombatHealth(uid, target, type, -min, -max, effectz)
n = n or 1
if math.random(1, 10) <= (percent/10) then
	possible = {}
	for j = -3, 3 do
	for k = -3, 3 do
		middlePos = {x = getCreaturePosition(target).x + j, y = getCreaturePosition(target).y + k, z = getCreaturePosition(target).z, stackpos = 253}
		if isWalkable(middlePos, false, true, true) then
			creature = getTopCreature(middlePos).uid		
			if creature > 0 then
				table.insert(possible, creature)
			end
		end
	end
	end		
	target = #possible > 0 and possible[math.random(#possible)] or target
end		
if n < hits then
	addEvent(function()
	if isCreature(uid) and isCreature(target) then
		doBlast(uid, target, delay, effectx, effectz, percent, min, max, type, hits, fromPos, (n + 1))
	end
	end, delay)
end
return true
end

function onCastSpell(cid, var)
local maglevel, level, mana = getPlayerMagLevel(cid), getPlayerLevel(cid), getCreatureMana(cid)
local axe, sword, club, distance = getPlayerSkillLevel(cid, 3), getPlayerSkillLevel(cid, 2), getPlayerSkillLevel(cid, 1), getPlayerSkillLevel(cid, 4)
local shield, health = getPlayerSkillLevel(cid, 5), getCreatureHealth(cid)

	local formula = {
	min = ((level + maglevel)/5 + axe + sword + club + shield + (mana/1000))/3, --- formula de dano minimo
	max = ((level + maglevel)/5 + axe + sword + club + shield + ((mana + health)/1000))/3 --- formula de dano maximo
	}
	
local pos = getCreaturePosition(cid)
doCreatureSay(cid, "Chain Lightning", 20, false, 0, pos)
hits = math.ceil(getPlayerMagLevel(cid)/10) - (math.random(0, (math.floor(getPlayerMagLevel(cid)/10))) - 1) 
target = getCreatureTarget(cid)
doBlast(cid, target, config.delay, config.effectx, config.effectz, config.percent, formula.min, formula.max, 2, hits, getCreaturePosition(cid), nil)
return true
end
 

E agora no spells.xml:

<instant name="TK" words="chainlight" lvl="8" manapercent="8" maglv="15" prem="0" exhaustion="1500" range="4" needtarget="1" needlearn="0" event="script" value="especiais/chainlight.lua">
</instant>

Qualquer duvida postem aí, e se gostou da spell é só clicar em "gostei". Vou dormir agora que faz umas 20 horas to acordado scriptando pro tk auheuha flw pra vcs

EDIT: Troquei o arquivo, a outra versão estava bugada então refiz do 0 e agora está funcionando.

EDIT2: Se você usa a New Lib ela já possui uma função pra essa spell então apenas use esse arquivo aqui:


local config = {
	effectx = 35, --- efeito de distancia
	effectz = 11, --- efeito ao acertar o player
	percent = 100, --- porcentagem de ir pra outro target apos hitar
	delay = 300 --- velocidade com que se move (milisegundos)
}

function onCastSpell(cid, var)
local maglevel, level, mana = getPlayerMagLevel(cid), getPlayerLevel(cid), getCreatureMana(cid)
local axe, sword, club, distance = getPlayerSkillLevel(cid, 3), getPlayerSkillLevel(cid, 2), getPlayerSkillLevel(cid, 1), getPlayerSkillLevel(cid, 4)
local shield, health = getPlayerSkillLevel(cid, 5), getCreatureHealth(cid)

	local formula = {
	min = ((level + maglevel)/5 + axe + sword + club + shield + (mana/1000))/3, --- formula de dano minimo
	max = ((level + maglevel)/5 + axe + sword + club + shield + ((mana + health)/1000))/3 --- formula de dano maximo
	}
	
local pos = getCreaturePosition(cid)
doCreatureSay(cid, "Chain Lightning", 20, false, 0, pos)
hits = math.ceil(getPlayerMagLevel(cid)/10) - (math.random(0, (math.floor(getPlayerMagLevel(cid)/10))) - 1) 
target = getCreatureTarget(cid)
doBlast(cid, target, config.delay, config.effectx, config.effectz, config.percent, formula.min, formula.max, 2, hits, getCreaturePosition(cid), nil)
return true
end

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

  • Respostas 48
  • Visualizações 7.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • level + ml dividido por 5, soma todas as skills e soma mana/1000. Dai dps disso divide tudo por 3. Você pode mudar a hr que quiser

  • troca a linha 21 por isso daqui:   hits = math.ceil(getPlayerMagLevel(cid)/10) - (math.random(0, (math.ceil(getPlayerMagLevel(cid)/10))) - 1) e a linha 29 por isso:   if math.random(1, 10) &lt

  • eu coloquei 3 porque eu fiz testes e achei a melhor configuração, mas vc pode editar pela lib procurando a função doBlast e alterando na parte em que está: for j = -3, 3 do     for k = -3, 3 do colo

Postado
  • Autor

Explica a fórmula?

 
local formula = {
    min = ((level + maglevel)/5 + axe + sword + club + shield + (mana/1000))/3, --- formula de dano minimo
    max
= ((level + maglevel)/5 + axe + sword + club + shield + ((mana + health)/1000))/3 --- formula de dano maximo
    
} 

 

level + ml dividido por 5, soma todas as skills e soma mana/1000. Dai dps disso divide tudo por 3. Você pode mudar a hr que quiser

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