Code:
local animationDelay = 600
local combat = {}
local area = {
{
{0, 1, 0},
{1, 2, 1},
{0, 1, 0}
},
{
{1, 0, 1},
{0, 2, 0},
{1, 0, 1}
},
{
{0, 1, 1, 1, 0},
{1, 0, 0, 0, 1},
{1, 0, 2, 0, 1},
{1, 0, 0, 0, 1},
{0, 1, 1, 1, 0}
},
{
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{1, 0, 0, 0, 0, 0, 1},
{1, 0, 0, 2, 0, 0, 1},
{1, 0, 0, 0, 0, 0, 1},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
},
{
{0, 0, 0, 0, 1, 1, 1, 1, 0 ,0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 0, 1 ,0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 0 ,1, 0, 0},
{0, 1, 0, 0, 0, 0, 0, 0, 0 ,0, 1, 0},
{1, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 1},
{1, 0, 0, 0, 0, 0, 2, 0, 0 ,0, 0, 1},
{1, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 0, 1},
{0, 1, 0, 0, 0, 0, 0, 0, 0 ,0, 1, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 0 ,1, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 0, 1 ,0, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 1, 0 ,0, 0, 0}
},
}
for i = 1, #area do
combat[i] = Combat()
combat[i]:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
end
for x, _ in ipairs(area) do
combat[x]:setArea(createCombatArea(area[x]))
end
function executeCombat(p, i)
if not p.creature then
return false
end
if not p.creature:isCreature() then
return false
end
p.combat[i]:execute(p.creature, p.var)
end
function onCastSpell(creature, var)
local p = {creature = creature, var = var, combat = combat}
for i = 1, #area do
safeAddEvent(executeCombat, (animationDelay * i) - animationDelay, p, i)
end
return true
end
I have a problem with this monster spells.
when the monster executes it and is killed and the magic is still running the server goes down