Honestamente, nao sou especialista em lua ou em fazer spells, mas fiz algo rapido para voce aqui:
local combatOne = createCombatObject()
setCombatParam(combatOne, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combatOne, COMBAT_PARAM_HITCOLOR, COLOR_MAYABLUE)
setCombatFormula(combatOne, COMBAT_FORMULA_LEVELMAGIC, -1.0, -500, -1.0, -650)
setCombatArea(combatOne,createCombatArea(
{{1, 1, 1},
{1, 3, 1}, -- Area 3X3
{1, 1, 1}}
))
local function meteor_1(cid, target)
if isCreature(target) then
local pos = getCreaturePosition(target)
local post = getThingPosition(getCreatureTarget(cid))
local fromposition = {x = pos.x - math.random(2, 5), y = pos.y - 4, z = pos.z}
local toposition = {x = post.x - math.random(1, 2), y = post.y, z = post.z}
doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE)
doSendMagicEffect(pos, CONST_ME_FIREAREA)
end
end
local function meteor_2(cid, target)
if isCreature(target) then
local pos = getCreaturePosition(target)
local post = getThingPosition(getCreatureTarget(cid))
local fromposition = {x = pos.x + math.random(2, 5), y = pos.y - 4, z = pos.z}
local toposition = {x = post.x + math.random(1, 2), y = post.y, z = post.z}
doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE)
doSendMagicEffect(pos, CONST_ME_FIREAREA)
end
end
local function meteor_3(cid, target)
if isCreature(target) then
local pos = getCreaturePosition(target)
local post = getThingPosition(getCreatureTarget(cid))
local fromposition = {x = pos.x, y = pos.y - 4, z = pos.z}
local toposition = {x = post.x, y = post.y, z = post.z}
doSendDistanceShoot(fromposition, toposition, CONST_ANI_FIRE)
doSendMagicEffect(pos, CONST_ME_FIREAREA)
end
end
local config = {
hit = 1,
time = 1200, -- meteor_1
time_2 = 1300, -- meteor_2
time_3 = 1500, -- meteor_3
numberOfAttacks = 3,
attackInterval = 200
}
function onCastSpell(cid, var)
addEvent(function() doCombat(cid, combatOne, var) end, 1200)
local pos = getCreaturePosition(cid)
for i = 1, config.numberOfAttacks do
addEvent(function()
doSendDistanceShoot(pos, {x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, CONST_ANI_FIRE)
end, config.attackInterval * i)
end
for fbn = 1, config.hit do
addEvent(meteor_1, config.time * fbn, cid, getCreatureTarget(cid))
addEvent(meteor_2, config.time_2 * fbn, cid, getCreatureTarget(cid))
addEvent(meteor_3, config.time_3 * fbn, cid, getCreatureTarget(cid))
end
return true
end