IDK, if area spells show "distance effect" at all. If they do, they probably show it only for 'hit targets', not for every tile in area.
There is probably no function to show that effect using combat area.
Only way would be to set spell callback to
CALLBACK_PARAM_TARGETTILE
, it should execute this function for every tile inside attacked area:
LUA:
function onTargetTile(creature, position)
creature:getPosition():sendDistanceEffect(position, CONST_ANI_SUDDENDEATH)
end
combat:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
but it would cancel
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
(there is only 1 spell callback in C++?)
So probably final solution is to call 2 combats one after another:
LUA:
-- damage combat
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combat:setArea(createCombatArea(AREA_CIRCLE5X5))
-- Formula to calculate the damage
function onGetFormulaValues(player, level, magicLevel)
local min = (level / 5) + (magicLevel * 15) + 50
local max = (level / 5) + (magicLevel * 18) + 75
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
-- animation combat
local combat2 = Combat()
combat2:setArea(createCombatArea(AREA_CIRCLE5X5))
function onTargetTile(creature, position)
creature:getPosition():sendDistanceEffect(position, CONST_ANI_SUDDENDEATH)
end
combat2:setCallback(CALLBACK_PARAM_TARGETTILE, "onTargetTile")
-- Spell cast function
function onCastSpell(creature, variant)
-- if damage combat works, then execute animation combat
return combat:execute(creature, variant) and combat2:execute(creature, variant)
end