Ir para conteúdo
  • Cadastre-se

Posts Recomendados

.Qual servidor ou website você utiliza como base? 

tfs 0.3.6

Qual o motivo deste tópico? 

não sei como finalizar essa spell.

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

[19/05/2024 15:34:35] [Error - LuaScriptInterface::loadFile] data/spells/scripts/maito gai/yagai.lua:99: 'end' expected (to close 'function' at line 67) near '<eof>'
[19/05/2024 15:34:35] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/maito gai/yagai.lua)
[19/05/2024 15:34:35] data/spells/scripts/maito gai/yagai.lua:99: 'end' expected (to close 'function' at line 67) near '<eof>'
 

 

Você tem o código disponível? Se tiver publique-o aqui: 

 local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_ORANGE)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -135.8, 0, -140.9, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, COLOR_RED)
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -170.8, 0, -175.9, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -150.8, 0, -155.9, 0)


local function onCastSpell1(parameters)
doCombat(parameters.cid, parameters.combat1, parameters.var)
end

local function onCastSpell2(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end

local function onCastSpell3(parameters)
doCombat(parameters.cid, parameters.combat3, parameters.var)
end

function yagai1(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 399)
	end
end
function yagai2(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 411)
	end
end

function yagai3(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 398)
	end
end
function yagai4(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 396)
	end
end

function yagai5(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 438)
	end
end
function yagai6(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 439)
	end
end

function onCastSpell(cid, var)
local waittime = 3.0 -- Tempo de exhaustion
local storage = 143512 -- não mecha
local storage2 = 55512
if exhaustion.check(cid, storage) then
doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end 
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3}
if getPlayerStorageValue(cid, storage2) == 5 then
addEvent(onCastSpell2, 650, parameters)
addEvent(yagai3, 50, cid)
addEvent(yagai4, 650, cid)
else
if getPlayerStorageValue(cid, storage2) == 4 then
addEvent(onCastSpell2, 650, parameters)
addEvent(yagai3, 50, cid)
addEvent(yagai4, 650, cid)
else
if getPlayerStorageValue(cid, storage2) == 3 then
addEvent(onCastSpell3, 650, parameters)
addEvent(yagai5, 50, cid)
addEvent(yagai6, 650, cid)
else
addEvent(onCastSpell1, 650, parameters)
addEvent(yagai1, 50, cid)
addEvent(yagai2, 650, cid)
end
end
exhaustion.set(cid, storage, waittime)
return true
end

 

Estou tentando adicionar essa parte na script da spell e não estou tento exito.

 

if getPlayerStorageValue(cid, storage2) == 3 then
addEvent(onCastSpell3, 650, parameters)
addEvent(yagai5, 50, cid)
addEvent(yagai6, 650, cid)
else

 

quando adiciono essa parte na script da esse erro na distro:

 

[19/05/2024 15:34:35] [Error - LuaScriptInterface::loadFile] data/spells/scripts/maito gai/yagai.lua:99: 'end' expected (to close 'function' at line 67) near '<eof>'
[19/05/2024 15:34:35] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/maito gai/yagai.lua)
[19/05/2024 15:34:35] data/spells/scripts/maito gai/yagai.lua:99: 'end' expected (to close 'function' at line 67) near '<eof>'

 

a spell ta pra mudar a cor dos efeitos e o dano quando o player esta transformado, com storage 3, 4 e 5, quando deixo so para a 4 e 5 funciona, quando tento adicionar a 3, não tenho exito, pois creio q não sei como fechar as linhas do else.

Link para o post
Compartilhar em outros sites

todo IF sempre termina com END

 

ex:

if getPlayerStorageValue(cid, storage2) == 3 then
addEvent(onCastSpell3, 650, parameters)
addEvent(yagai5, 50, cid)
addEvent(yagai6, 650, cid)
else
--Function
end

 

Não sei muito inglês, mas até o próprio console informa.

'end' expected (to close 'function' at line 67) near '<eof>'

Link para o post
Compartilhar em outros sites
42 minutos atrás, Fabi Marzan disse:

todo IF sempre termina com END

 

ex:


if getPlayerStorageValue(cid, storage2) == 3 then
addEvent(onCastSpell3, 650, parameters)
addEvent(yagai5, 50, cid)
addEvent(yagai6, 650, cid)
else
--Function
end

 

Não sei muito inglês, mas até o próprio console informa.

'end' expected (to close 'function' at line 67) near '<eof>'

essa function no caso seria oq?

return false?

Link para o post
Compartilhar em outros sites
  • Solução
20 minutos atrás, Gabrielx17 disse:

essa function no caso seria oq?

return false?

Comecei a olhar seu código e você tinha um END demais.

 

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_ORANGE)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -135.8, 0, -140.9, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, COLOR_RED)
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -170.8, 0, -175.9, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -150.8, 0, -155.9, 0)

local function onCastSpell1(parameters)
    doCombat(parameters.cid, parameters.combat1, parameters.var)
end

local function onCastSpell2(parameters)
    doCombat(parameters.cid, parameters.combat2, parameters.var)
end

local function onCastSpell3(parameters)
    doCombat(parameters.cid, parameters.combat3, parameters.var)
end

function yagai1(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 1,
            y = getThingPosition(getCreatureTarget(cid)).y,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 399)
    end
end

function yagai2(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 2,
            y = getThingPosition(getCreatureTarget(cid)).y + 2,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 411)
    end
end

function yagai3(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 1,
            y = getThingPosition(getCreatureTarget(cid)).y,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 398)
    end
end

function yagai4(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 2,
            y = getThingPosition(getCreatureTarget(cid)).y + 2,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 396)
    end
end

function yagai5(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 1,
            y = getThingPosition(getCreatureTarget(cid)).y,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 438)
    end
end

function yagai6(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 2,
            y = getThingPosition(getCreatureTarget(cid)).y + 2,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 439)
    end
end

function onCastSpell(cid, var)
    local waittime = 3.0 -- Tempo de exhaustion
    local storage = 143512 -- não mecha
    local storage2 = 55512

    if exhaustion.check(cid, storage) then
        doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
        return false
    end

    local parameters = {cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3}

    if getPlayerStorageValue(cid, storage2) == 5 then
        addEvent(onCastSpell2, 650, parameters)
        addEvent(yagai3, 50, cid)
        addEvent(yagai4, 650, cid)
    elseif getPlayerStorageValue(cid, storage2) == 4 then
        addEvent(onCastSpell2, 650, parameters)
        addEvent(yagai3, 50, cid)
        addEvent(yagai4, 650, cid)
    elseif getPlayerStorageValue(cid, storage2) == 3 then
        addEvent(onCastSpell3, 650, parameters)
        addEvent(yagai5, 50, cid)
        addEvent(yagai6, 650, cid)
    else
        addEvent(onCastSpell1, 650, parameters)
        addEvent(yagai1, 50, cid)
        addEvent(yagai2, 650, cid)
    end
    exhaustion.set(cid, storage, waittime)
    return true
end

 

Link para o post
Compartilhar em outros sites
  • Sub-Admin
Postado (editado)
7 horas atrás, Gabrielx17 disse:

.Qual servidor ou website você utiliza como base? 

tfs 0.3.6

Qual o motivo deste tópico? 

não sei como finalizar essa spell.

Está surgindo algum erro? Se sim coloque-o aqui. 

 

Você tem o código disponível? Se tiver publique-o aqui: 



 local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_ORANGE)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -135.8, 0, -140.9, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, COLOR_RED)
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -170.8, 0, -175.9, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -150.8, 0, -155.9, 0)


local function onCastSpell1(parameters)
doCombat(parameters.cid, parameters.combat1, parameters.var)
end

local function onCastSpell2(parameters)
doCombat(parameters.cid, parameters.combat2, parameters.var)
end

local function onCastSpell3(parameters)
doCombat(parameters.cid, parameters.combat3, parameters.var)
end

function yagai1(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 399)
	end
end
function yagai2(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 411)
	end
end

function yagai3(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 398)
	end
end
function yagai4(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 396)
	end
end

function yagai5(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 438)
	end
end
function yagai6(cid)
	if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
		local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
		doSendMagicEffect(position, 439)
	end
end

function onCastSpell(cid, var)
local waittime = 3.0 -- Tempo de exhaustion
local storage = 143512 -- não mecha
local storage2 = 55512
if exhaustion.check(cid, storage) then
doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
return false
end 
local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3}
if getPlayerStorageValue(cid, storage2) == 5 then
addEvent(onCastSpell2, 650, parameters)
addEvent(yagai3, 50, cid)
addEvent(yagai4, 650, cid)
else
if getPlayerStorageValue(cid, storage2) == 4 then
addEvent(onCastSpell2, 650, parameters)
addEvent(yagai3, 50, cid)
addEvent(yagai4, 650, cid)
else
if getPlayerStorageValue(cid, storage2) == 3 then
addEvent(onCastSpell3, 650, parameters)
addEvent(yagai5, 50, cid)
addEvent(yagai6, 650, cid)
else
addEvent(onCastSpell1, 650, parameters)
addEvent(yagai1, 50, cid)
addEvent(yagai2, 650, cid)
end
end
exhaustion.set(cid, storage, waittime)
return true
end

 

Estou tentando adicionar essa parte na script da spell e não estou tento exito.

 

if getPlayerStorageValue(cid, storage2) == 3 then
addEvent(onCastSpell3, 650, parameters)
addEvent(yagai5, 50, cid)
addEvent(yagai6, 650, cid)
else

 

quando adiciono essa parte na script da esse erro na distro:

 

[19/05/2024 15:34:35] [Error - LuaScriptInterface::loadFile] data/spells/scripts/maito gai/yagai.lua:99: 'end' expected (to close 'function' at line 67) near '<eof>'
[19/05/2024 15:34:35] [Warning - Event::loadScript] Cannot load script (data/spells/scripts/maito gai/yagai.lua)
[19/05/2024 15:34:35] data/spells/scripts/maito gai/yagai.lua:99: 'end' expected (to close 'function' at line 67) near '<eof>'

 

a spell ta pra mudar a cor dos efeitos e o dano quando o player esta transformado, com storage 3, 4 e 5, quando deixo so para a 4 e 5 funciona, quando tento adicionar a 3, não tenho exito, pois creio q não sei como fechar as linhas do else.

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_ORANGE)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -135.8, 0, -140.9, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, COLOR_RED)
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -170.8, 0, -175.9, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -150.8, 0, -155.9, 0)

local function onCastSpell1(parameters)
    doCombat(parameters.cid, parameters.combat1, parameters.var)
end

local function onCastSpell2(parameters)
    doCombat(parameters.cid, parameters.combat2, parameters.var)
end

local function onCastSpell3(parameters)
    doCombat(parameters.cid, parameters.combat3, parameters.var)
end

function yagai1(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 399)
    end
end

function yagai2(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 411)
    end
end

function yagai3(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 398)
    end
end

function yagai4(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 396)
    end
end

function yagai5(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 438)
    end
end

function yagai6(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 439)
    end
end

function onCastSpell(cid, var)
    local waittime = 3.0 -- Tempo de exhaustion
    local storage = 143512 -- não mecha
    local storage2 = 55512
    if exhaustion.check(cid, storage) then
        doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
        return false
    end 
    local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3}
    if getPlayerStorageValue(cid, storage2) == 5 then
        addEvent(onCastSpell2, 650, parameters)
        addEvent(yagai3, 50, cid)
        addEvent(yagai4, 650, cid)
    elseif getPlayerStorageValue(cid, storage2) == 4 then
        addEvent(onCastSpell2, 650, parameters)
        addEvent(yagai3, 50, cid)
        addEvent(yagai4, 650, cid)
    elseif getPlayerStorageValue(cid, storage2) == 3 then
        addEvent(onCastSpell3, 650, parameters)
        addEvent(yagai5, 50, cid)
        addEvent(yagai6, 650, cid)
    else
        addEvent(onCastSpell1, 650, parameters)
        addEvent(yagai1, 50, cid)
        addEvent(yagai2, 650, cid)
    end
    exhaustion.set(cid, storage, waittime)
    return true
end

erro: 

function onCastSpell(cid, var) 

não tava fechada

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

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
2 horas atrás, Fabi Marzan disse:

Comecei a olhar seu código e você tinha um END demais.

 


local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_ORANGE)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -135.8, 0, -140.9, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, COLOR_RED)
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -170.8, 0, -175.9, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -150.8, 0, -155.9, 0)

local function onCastSpell1(parameters)
    doCombat(parameters.cid, parameters.combat1, parameters.var)
end

local function onCastSpell2(parameters)
    doCombat(parameters.cid, parameters.combat2, parameters.var)
end

local function onCastSpell3(parameters)
    doCombat(parameters.cid, parameters.combat3, parameters.var)
end

function yagai1(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 1,
            y = getThingPosition(getCreatureTarget(cid)).y,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 399)
    end
end

function yagai2(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 2,
            y = getThingPosition(getCreatureTarget(cid)).y + 2,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 411)
    end
end

function yagai3(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 1,
            y = getThingPosition(getCreatureTarget(cid)).y,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 398)
    end
end

function yagai4(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 2,
            y = getThingPosition(getCreatureTarget(cid)).y + 2,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 396)
    end
end

function yagai5(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 1,
            y = getThingPosition(getCreatureTarget(cid)).y,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 438)
    end
end

function yagai6(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {
            x = getThingPosition(getCreatureTarget(cid)).x + 2,
            y = getThingPosition(getCreatureTarget(cid)).y + 2,
            z = getThingPosition(getCreatureTarget(cid)).z
        }
        doSendMagicEffect(position, 439)
    end
end

function onCastSpell(cid, var)
    local waittime = 3.0 -- Tempo de exhaustion
    local storage = 143512 -- não mecha
    local storage2 = 55512

    if exhaustion.check(cid, storage) then
        doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
        return false
    end

    local parameters = {cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3}

    if getPlayerStorageValue(cid, storage2) == 5 then
        addEvent(onCastSpell2, 650, parameters)
        addEvent(yagai3, 50, cid)
        addEvent(yagai4, 650, cid)
    elseif getPlayerStorageValue(cid, storage2) == 4 then
        addEvent(onCastSpell2, 650, parameters)
        addEvent(yagai3, 50, cid)
        addEvent(yagai4, 650, cid)
    elseif getPlayerStorageValue(cid, storage2) == 3 then
        addEvent(onCastSpell3, 650, parameters)
        addEvent(yagai5, 50, cid)
        addEvent(yagai6, 650, cid)
    else
        addEvent(onCastSpell1, 650, parameters)
        addEvent(yagai1, 50, cid)
        addEvent(yagai2, 650, cid)
    end
    exhaustion.set(cid, storage, waittime)
    return true
end

 

obrigado funcionou perfeitamente, consegui enteder tambem mais ou menos por cima de como usar o else pois não sabia que existia elseif!

57 minutos atrás, L3K0T disse:

local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_HITCOLOR, COLOR_ORANGE)
setCombatParam(combat1, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat1, COMBAT_FORMULA_LEVELMAGIC, -135.8, 0, -140.9, 0)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_HITCOLOR, COLOR_RED)
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, -170.8, 0, -175.9, 0)

local combat3 = createCombatObject()
setCombatParam(combat3, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatFormula(combat3, COMBAT_FORMULA_LEVELMAGIC, -150.8, 0, -155.9, 0)

local function onCastSpell1(parameters)
    doCombat(parameters.cid, parameters.combat1, parameters.var)
end

local function onCastSpell2(parameters)
    doCombat(parameters.cid, parameters.combat2, parameters.var)
end

local function onCastSpell3(parameters)
    doCombat(parameters.cid, parameters.combat3, parameters.var)
end

function yagai1(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 399)
    end
end

function yagai2(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 411)
    end
end

function yagai3(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 398)
    end
end

function yagai4(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 396)
    end
end

function yagai5(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+1, y=getThingPosition(getCreatureTarget(cid)).y, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 438)
    end
end

function yagai6(cid)
    if isCreature(cid) and isCreature(getCreatureTarget(cid)) then
        local position = {x=getThingPosition(getCreatureTarget(cid)).x+2, y=getThingPosition(getCreatureTarget(cid)).y+2, z=getThingPosition(getCreatureTarget(cid)).z}
        doSendMagicEffect(position, 439)
    end
end

function onCastSpell(cid, var)
    local waittime = 3.0 -- Tempo de exhaustion
    local storage = 143512 -- não mecha
    local storage2 = 55512
    if exhaustion.check(cid, storage) then
        doPlayerSendCancel(cid, "Aguarde " .. exhaustion.get(cid, storage) .. " segundos para usar a spell novamente.")
        return false
    end 
    local parameters = { cid = cid, var = var, combat1 = combat1, combat2 = combat2, combat3 = combat3}
    if getPlayerStorageValue(cid, storage2) == 5 then
        addEvent(onCastSpell2, 650, parameters)
        addEvent(yagai3, 50, cid)
        addEvent(yagai4, 650, cid)
    elseif getPlayerStorageValue(cid, storage2) == 4 then
        addEvent(onCastSpell2, 650, parameters)
        addEvent(yagai3, 50, cid)
        addEvent(yagai4, 650, cid)
    elseif getPlayerStorageValue(cid, storage2) == 3 then
        addEvent(onCastSpell3, 650, parameters)
        addEvent(yagai5, 50, cid)
        addEvent(yagai6, 650, cid)
    else
        addEvent(onCastSpell1, 650, parameters)
        addEvent(yagai1, 50, cid)
        addEvent(yagai2, 650, cid)
    end
    exhaustion.set(cid, storage, waittime)
    return true
end

erro: 


function onCastSpell(cid, var) 

não tava fechada

obrigado funcionou perfeitamente! e obrigado por me falar onde estava o erro consegui compreender mais ou menos pois não sabia que existia o elseif!

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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo