Ir para conteúdo
  • Cadastre-se

Posts Recomendados

  • 2 years later...
  • Respostas 48
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

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 testa

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

Em OTX da esse erro.

Lua Script Error: [Spell Interface]
data/spells/scripts/chainlight.lua:onCastSpell
data/spells/scripts/chainlight.lua:9: attempt to call global 'getCreatureMana' (a nil value)
stack traceback:
        [C]: in function 'getCreatureMana'
        data/spells/scripts/chainlight.lua:9: in function <data/spells/scripts/chainlight.lua:8>

Poderia me ajudar a substituir pelas funções corretas, por favor?

Editado por lusgo (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

@lusgo você tem a source do seu sv? se não tiver tenta getPlayerMana, se tiver vai em luascript.cpp e dá ctrl + f em Mana para ver as funções.

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Link para o post
Compartilhar em outros sites
  • 1 year later...

Ta dando esse erro:

 

[3/9/2020 15:32:52] [Error - Spell Interface] 
[3/9/2020 15:32:52] data/spells/scripts/especial/chainlightning.lua:onCastSpell
[3/9/2020 15:32:52] Description: 
[3/9/2020 15:32:52] data/spells/scripts/especial/chainlightning.lua:22: attempt to call global 'doBlast' (a nil value)
[3/9/2020 15:32:52] stack traceback:
[3/9/2020 15:32:52]     data/spells/scripts/especial/chainlightning.lua:22: in function <data/spells/scripts/especial/chainlightning.lua:8>

Link para o post
Compartilhar em outros sites
2 hours ago, Vorkhon said:

Ta dando esse erro:

 

[3/9/2020 15:32:52] [Error - Spell Interface] 
[3/9/2020 15:32:52] data/spells/scripts/especial/chainlightning.lua:onCastSpell
[3/9/2020 15:32:52] Description: 
[3/9/2020 15:32:52] data/spells/scripts/especial/chainlightning.lua:22: attempt to call global 'doBlast' (a nil value)
[3/9/2020 15:32:52] stack traceback:
[3/9/2020 15:32:52]     data/spells/scripts/especial/chainlightning.lua:22: in function <data/spells/scripts/especial/chainlightning.lua:8>

Adiciona essa função no inicio do script:

 

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

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Link para o post
Compartilhar em outros sites
14 horas atrás, xWhiteWolf disse:

Adiciona essa função no inicio do script:

 


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

Que bom que voce ainda ta pelo forum ainda todas os posts que vejo são antigoes hahaha.

 

Cara botei esse codigo antes da script da spell. Agora carregou mas ela não ta batendo de target em target só das os multiplos hits em 1 target.

 

Eu to com ml 40, e testei de perto de longe com varios e só pega 1 target.

 

O script ficou assim: (Nao estou conseguindo carregar da forma correta. Me perdoem)

--------------------------------------------------------------------------------------------------------

 

 

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

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 Vorkhon (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

algum erro no console?

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Link para o post
Compartilhar em outros sites
Em 06/09/2020 em 11:43, xWhiteWolf disse:

algum erro no console?

Nao aparece nada no console. A spell só bate algumas vezes seguidas no mesmo target. 

EDIT: Cara bizzarramente entrou outro GM para a gente testar as coisas e funcionou. Mas comigo sozinho não estava funcionando.

Editado por Vorkhon (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 6 months later...

Nao deu erro podem nao foi efeito 

 

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 isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end  
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

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