Ir para conteúdo
  • Cadastre-se

(Resolvido)[ Pedido ] tem que lança magia


Ir para solução Resolvido por marcot,

Posts Recomendados

Vou tentar explicar dando um exemplo.

Quero fazer um item que solte "Exevo Mas San", o script equivalente no meu servidor é o holy light.lua. A princípio temos:

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


local area = createCombatArea(arr)
setCombatArea(combat, area)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

Quando você usa uma skill o que você chamou na verdade é a parte do script:

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

E a parte responsável por soltar uma magia é o "doCombat(cid, combat, var)". Botando os parâmetros "cid" e "var" de lado, quem é "combat"? A parte a seguir não é necessária para compreender totalmente como fazer para o item usar uma skill mas vamos lá:

 

Vamos voltar ao começo do script para entender quem é combat:

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


local area = createCombatArea(arr)
setCombatArea(combat, area)

Na primeira linha criamos a variável "combat" e usamos uma espécie de construtor dessa variável. Depois disso definimos cada parte do script.

Na segunda linha definimos o "COMBAT_PARAM_TYPE", que é o tipo de dano.

Na terceira linha, definimos "COMBAT_PARAM_EFFECT", que é o efeito (49).

Na quarta linha, definimos "COMBAT_FORMULA_LEVELMAGIC" que vai ser a quantidade de dano.

Depois disso definimos a área, criamos a variável arr que é uma matriz definindo a área da skill,  facilitando a vida de pessoas que vão fazer skills.  E depois simplesmente "linkamos" essa matriz ao combat.

 

Enfim, quando usamos uma magia temos a função onCastSpell e quando usamos um action temos a função onUse, logo, não podemos simplesmente dar ctrl+c e ctrl+v para fazê-lo. Então vamos fazer o que está sendo feito dentro do onCastSpell dentro do onUse. O que temos dentro do onCastSpell que queremos no onUse?

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

E o que temos no action?

function onUse(cid, item, frompos, item2, topos)
	<codigo>
end

Note que no doCombat(cid, combat, var)  temos uma variável que não temos no onUse, então vamos colocar numberToVariant(cid) no lugar, ficando assim:

function onUse(cid, item, frompos, item2, topos)
	return doCombat(cid, combat, numberToVariant(cid))
end

No final das contas, o script do exevo mas san por item ficaria assim:

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


local area = createCombatArea(arr)
setCombatArea(combat, area)

function onUse(cid, item, frompos, item2, topos)
	return doCombat(cid, combat, numberToVariant(cid))
end

 

[EDIT]:

31 minutos atrás, apollo333 disse:

 

fiz o que disse só que ainda nao esta gastando mana :/ 

 

Tinha me esquecido desse detalhe. Já edito e mando o exemplo acima gastando mana.

[EDIT2]:

local config = {
	requiredLevel = 100,
	usingMana = 200
}

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


local area = createCombatArea(arr)
setCombatArea(combat, area)
function onUse(cid, item, frompos, item2, topos)
	if getPlayerLevel(cid) > config.requiredLevel then
		if getPlayerMana(cid) > config.usingMana then
			doPlayerAddMana(cid, -config.usingMana)
			return doCombat(cid, combat, numberToVariant(cid))
		else
			doPlayerSendCancel(cid, "Not enough mana.")
		end
	else
		doPlayerSendCancel(cid, "Not enough level.")
	end
	return TRUE
end

 

Editado por marcot (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Respostas 19
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Você pode fazer assim no caso da exura, cria o arquivo item_skill.lua em data/actions/scripts: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE) function onGetFormulaValues(cid, level, maglevel) min = (level

Você vai fazer o seguinte: copia tudo que está na magia e cola no action, depois procura essa parte:   function onCastSpell(cid, var) return doCombat(cid, combat, var) end e substitua por: function onUse(cid, item, frompos, item2, topos) return doCombat(cid, combat, numberToVariant(cid)) end  

Vou tentar explicar dando um exemplo. Quero fazer um item que solte "Exevo Mas San", o script equivalente no meu servidor é o holy light.lua. A princípio temos: local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, 49) setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0) local arr = { {0, 0, 1, 1, 1, 0, 0}, {0, 1, 1, 1, 1, 1, 0}, {1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 3, 1, 1, 1}, {1

23 minutos atrás, marcot disse:

Vou tentar explicar dando um exemplo.

Quero fazer um item que solte "Exevo Mas San", o script equivalente no meu servidor é o holy light.lua. A princípio temos:


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


local area = createCombatArea(arr)
setCombatArea(combat, area)

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

Quando você usa uma skill o que você chamou na verdade é a parte do script:


function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

E a parte responsável por soltar uma magia é o "doCombat(cid, combat, var)". Botando os parâmetros "cid" e "var" de lado, quem é "combat"? A parte a seguir não é necessária para compreender totalmente como fazer para o item usar uma skill mas vamos lá:

 

Vamos voltar ao começo do script para entender quem é combat:


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


local area = createCombatArea(arr)
setCombatArea(combat, area)

Na primeira linha criamos a variável "combat" e usamos uma espécie de construtor dessa variável. Depois disso definimos cada parte do script.

Na segunda linha definimos o "COMBAT_PARAM_TYPE", que é o tipo de dano.

Na terceira linha, definimos "COMBAT_PARAM_EFFECT", que é o efeito (49).

Na quarta linha, definimos "COMBAT_FORMULA_LEVELMAGIC" que vai ser a quantidade de dano.

Depois disso definimos a área, criamos a variável arr que é uma matriz definindo a área da skill,  facilitando a vida de pessoas que vão fazer skills.  E depois simplesmente "linkamos" essa matriz ao combat.

 

Enfim, quando usamos uma magia temos a função onCastSpell e quando usamos um action temos a função onUse, logo, não podemos simplesmente dar ctrl+c e ctrl+v para fazê-lo. Então vamos fazer o que está sendo feito dentro do onCastSpell dentro do onUse. O que temos dentro do onCastSpell que queremos no onUse?


function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

E o que temos no action?


function onUse(cid, item, frompos, item2, topos)
	<codigo>
end

Note que no doCombat(cid, combat, var)  temos uma variável que não temos no onUse, então vamos colocar numberToVariant(cid) no lugar, ficando assim:


function onUse(cid, item, frompos, item2, topos)
	return doCombat(cid, combat, numberToVariant(cid))
end

No final das contas, o script do exevo mas san por item ficaria assim:


local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


local area = createCombatArea(arr)
setCombatArea(combat, area)

function onUse(cid, item, frompos, item2, topos)
	return doCombat(cid, combat, numberToVariant(cid))
end

 

[EDIT]:

Tinha me esquecido desse detalhe. Já edito e mando o exemplo acima gastando mana.

[EDIT2]:


local config = {
	requiredLevel = 100,
	usingMana = 200
}

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 49)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -0.5, -30, -1.1, 0)

local arr = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}


local area = createCombatArea(arr)
setCombatArea(combat, area)
function onUse(cid, item, frompos, item2, topos)
	if getPlayerLevel(cid) > config.requiredLevel then
		if getPlayerMana(cid) > config.usingMana then
			doPlayerAddMana(cid, -config.usingMana)
			return doCombat(cid, combat, numberToVariant(cid))
		else
			doPlayerSendCancel(cid, "Not enough mana.")
		end
	else
		doPlayerSendCancel(cid, "Not enough level.")
	end
	return TRUE
end

 

 

meio complexo mais vou estudar aqui, mas para simplificar para criar cada item com tal magia eu devo apenas adcionar no x-item.lua a chamada do script deste dal spell?

Link para o post
Compartilhar em outros sites

Um action não vai funcionar se tiver o function onCastSpell (cid, var). Então você troca para function onUse(cid, item, frompos, item2, topos) e para o action chamar a skill você deve ter o doCombat(cid, combat, var), mas você não tem var numa action, então você troca para doCombat(cid, combat, numberToVariant(cid))

 

Se você preferir faz assim:

Pega o spell que você quer que seja o item e copie numa nova action.

Adicione ao começo 

local config = {
	requiredLevel = 100,
	usingMana = 200
}

E substitua o

function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

Por

function onUse(cid, item, frompos, item2, topos)
	if getPlayerLevel(cid) > config.requiredLevel then
		if getPlayerMana(cid) > config.usingMana then
			doPlayerAddMana(cid, -config.usingMana)
			return doCombat(cid, combat, numberToVariant(cid))
		else
			doPlayerSendCancel(cid, "Not enough mana.")
		end
	else
		doPlayerSendCancel(cid, "Not enough level.")
	end
	return TRUE
end

 

Link para o post
Compartilhar em outros sites
21 horas atrás, marcot disse:

Um action não vai funcionar se tiver o function onCastSpell (cid, var). Então você troca para function onUse(cid, item, frompos, item2, topos) e para o action chamar a skill você deve ter o doCombat(cid, combat, var), mas você não tem var numa action, então você troca para doCombat(cid, combat, numberToVariant(cid))

 

Se você preferir faz assim:

Pega o spell que você quer que seja o item e copie numa nova action.

Adicione ao começo 


local config = {
	requiredLevel = 100,
	usingMana = 200
}

E substitua o


function onCastSpell(cid, var)
	return doCombat(cid, combat, var)
end

Por


function onUse(cid, item, frompos, item2, topos)
	if getPlayerLevel(cid) > config.requiredLevel then
		if getPlayerMana(cid) > config.usingMana then
			doPlayerAddMana(cid, -config.usingMana)
			return doCombat(cid, combat, numberToVariant(cid))
		else
			doPlayerSendCancel(cid, "Not enough mana.")
		end
	else
		doPlayerSendCancel(cid, "Not enough level.")
	end
	return TRUE
end

 

 neste caso aqui onde criei a spell no spellcreator 

 

Spoiler

-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
    return (10)*-1,(20)*-1 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_THROWINGSTAR}local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_HITBYFIRE)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
    return (10)*-1,(20)*-1 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_ENERGY}local combat0_Brush_2 = createCombatObject()
setCombatParam(combat0_Brush_2, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat0_Brush_2, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatArea(combat0_Brush_2,createCombatArea({{2}}))
function getDmg_Brush_2(cid, level, maglevel)
    return (100)*-1,(100)*-1 
end
setCombatCallback(combat0_Brush_2, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush_2")
local dfcombat0_Brush_2 = {CONST_ANI_SPEAR}local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_YELLOW)
setCombatParam(combat0_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
    return (10)*-1,(20)*-1 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat0_Brush = {CONST_ANI_ARROW}local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatArea(combat0_Brush,createCombatArea({{3}}))
function getDmg_Brush(cid, level, maglevel)
    return (10),(10) 
end
setCombatCallback(combat0_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

-- Areas/Combat for 100ms
local combat1_Brush = createCombatObject()
setCombatParam(combat1_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_YELLOW)
setCombatParam(combat1_Brush, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatParam(combat1_Brush, COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
setCombatArea(combat1_Brush,createCombatArea({{2}}))
function getDmg_Brush(cid, level, maglevel)
    return (10)*-1,(20)*-1 
end
setCombatCallback(combat1_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")
local dfcombat1_Brush = {CONST_ANI_ARROW}local combat1_Brush = createCombatObject()
setCombatParam(combat1_Brush, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat1_Brush, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatArea(combat1_Brush,createCombatArea({{3}}))
function getDmg_Brush(cid, level, maglevel)
    return (10),(10) 
end
setCombatCallback(combat1_Brush, CALLBACK_PARAM_LEVELMAGICVALUE, "getDmg_Brush")

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList,y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
                i = i + 2
            end        
        end
    end
end

function onCastSpell(cid, var)
    local startPos = getCreaturePosition(cid)
    RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
    RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
    RunPart(combat0_Brush_2,cid,var,dfcombat0_Brush_2,startPos)
    RunPart(combat0_Brush,cid,var,dfcombat0_Brush,startPos)
    RunPart(combat0_Brush,cid,var)
    addEvent(RunPart,100,combat1_Brush,cid,var,dfcombat1_Brush,startPos)
    addEvent(RunPart,100,combat1_Brush,cid,var)
    return true
end

 

eu faria a mesma coisa no final dela para que possa ser usada em um item?

Link para o post
Compartilhar em outros sites

gostei, eu estou buscando algo assim tbm, mas me deixa entender isso @marcot

 

um exemplo eu crio um "item_skill.lua" ou seja no meu caso item-magico.lua com a magia exana pox

depois vou em actionn.xml e crio a tag <action itemid="2512" script="item_skill.lua" />  com o ID do item que vai lançar a Spell

 

ai no inicio do item-magico.lua

eu coloco 

 

Spoiler

local config = {
	requiredLevel = 100,
	usingMana = 200
}

 para poder usar mana quando for usado!

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

depois no final substitui o ultimo texto que no meu caso é

Spoiler

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

 

por este texto que você postou!

Spoiler

function onUse(cid, item, frompos, item2, topos)
	if getPlayerLevel(cid) > config.requiredLevel then
		if getPlayerMana(cid) > config.usingMana then
			doPlayerAddMana(cid, -config.usingMana)
			return doCombat(cid, combat, numberToVariant(cid))
		else
			doPlayerSendCancel(cid, "Not enough mana.")
		end
	else
		doPlayerSendCancel(cid, "Not enough level.")
	end
	return TRUE
en

 

 meu action antes da mudança!

Spoiler

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_POISON)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 

 

depois da mudança

Spoiler

local config = {
    requiredLevel = 100,
    usingMana = 200
}

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_POISON)

function onUse(cid, item, frompos, item2, topos)
    if getPlayerLevel(cid) > config.requiredLevel then
        if getPlayerMana(cid) > config.usingMana then
            doPlayerAddMana(cid, -config.usingMana)
            return doCombat(cid, combat, numberToVariant(cid))
        else
            doPlayerSendCancel(cid, "Not enough mana.")
        end
    else
        doPlayerSendCancel(cid, "Not enough level.")
    end
    return TRUE
end

 

 

 fiz correto? :D

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.

  • Estatísticas dos Fóruns

    96847
    Tópicos
    519607
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo