Postado Agosto 31, 2014 10 anos 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?
Postado Agosto 31, 2014 10 anos o cooldown fica na tag que vc adiciona no spells.xml.. é no exhaust "1000" onde 1000 é o tempo em milisegundos (1000 milisegundos = 1 segundo)
Postado Setembro 1, 2014 10 anos 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 Setembro 6, 2014 10 anos Solução troca essa parte Citar function onCastSpell(cid, var)if #returnSpell > 1 thenfor i = 1, #returnSpell doaddEvent(onCallCombat, (i*450)+15, {cid, returnSpell, var})endelsedoCombat(cid, ret[1], var)endreturn trueend 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.