Ir para conteúdo

Featured Replies

Postado

Galera fiz um script baseado nese topico aki: http://www.tibiaking.com/forum/topic/8522-um-novo-modo-de-criar-magias/
 
ficou assim:

 

Mostrar conteúdo oculto

local spell = {


{
damage = COMBAT_DEATHDAMAGE, -- O tipo de dano
effect = {CONST_ME_MORTAREA}, -- Os efeitos da magia
formula = {0.2, 3, 0.2, 4.2, 200, 300}, -- A formula de dano da magia
area = createCombatArea({ -- Area da magia
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}})
},
{
damage = COMBAT_ENERGYDAMAGE, -- O tipo de dano
effect = {CONST_ME_YELLOWENERGY}, -- Os efeitos da magia
formula = {0.2, 3, 0.2, 4.2, 200, 300}, -- A formula de dano da magia
area = createCombatArea({ -- Area da magia
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}})
},
{
damage = COMBAT_DEATHDAMAGE, -- O tipo de dano
effect = {CONST_ME_MORTAREA}, -- Os efeitos da magia
formula = {0.2, 3, 0.2, 4.2, 200, 300}, -- A formula de dano da magia
area = createCombatArea({ -- Area da magia
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0}})
}
}

local returnSpell = {}

for var, config in ipairs(spell) do
returnSpell[var] = createCombatObject()
setCombatParam(returnSpell[var], COMBAT_PARAM_TYPE, config.damage)
setCombatParam(returnSpell[var], COMBAT_PARAM_EFFECT, (type(config.effect) == "table" and config.effect[1] or config.effect))
if type(config.effect) == "table" and config.effect[2] ~= nil then setCombatParam(returnSpell[var], COMBAT_PARAM_DISTANCEEFFECT, config.effect[2]) end
if config.area then setCombatArea(returnSpell[var], config.area) end

function getSpellDamage(cid, level, maglevel)
local min = ((level*config.formula[1] + maglevel*config.formula[2]) + config.formula[5])
local max = ((level*config.formula[3] + maglevel*config.formula[4]) + config.formula[6])
return -min, -max
end
setCombatCallback(returnSpell[var], CALLBACK_PARAM_LEVELMAGICVALUE, "getSpellDamage")
end

function onCallCombat(parameters)
return doCombat(unpack(parameters))
end

function onCastSpell(cid, var)
if #returnSpell > 1 then
for i = 1, #returnSpell do
addEvent(onCallCombat, (i*450)+15, {cid, returnSpell, var})
end
else
doCombat(cid, ret[1], var)
end
return true
end

 

 

mas como posso por cd na spell?

Resolvido por xWhiteWolf

Ir para solução
  • Respostas 5
  • Visualizações 501
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • troca essa parte   por local cooldown = 10 function onCastSpell(cid, var) if os.time() - getPlayerStorageValue(cid, 19329) >= cooldown then doPlayerSetStorageValue(cid, 19329, os.time())

Postado
  • Autor

eu queria algo do tipo cd especifico para a spell, pois se eu por no spells.xml eu teria que esperar por exemplo 10seg pra usar qlqr spell ofensiva, eu queria um cd especifico para a spell

Postado
  • Solução

troca essa parte

  Citar

 

 

function onCastSpell(cid, var)
if #returnSpell > 1 then
for i = 1, #returnSpell do
addEvent(onCallCombat, (i*450)+15, {cid, returnSpell, var})
end
else
doCombat(cid, ret[1], var)
end
return true
end

 
por

local cooldown = 10


function onCastSpell(cid, var)
if os.time() - getPlayerStorageValue(cid, 19329) >= cooldown then
doPlayerSetStorageValue(cid, 19329, os.time())


if #returnSpell > 1 then
for i = 1, #returnSpell do
addEvent(onCallCombat, (i*450)+15, {cid, returnSpell[i], var})
end
else
doCombat(cid, ret[1], var)
end
else
doPlayerSendCancel(cid, "Your skill is in cooldown, you must wait "..(cooldown - (os.time() - getPlayerStorageValue(cid, 19329))).." seconds.")
return false
end
return true
end

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