local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
local area = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}
local area = createCombatArea(area)
setCombatArea(combat, area)
function onTargetTile(cid, pos)
local creature = getTopCreature(pos).uid
if creature == 0 or creature == cid then-- Ignore empty tiles and self
return false
end
if isPlayer(creature) or isSummon(creature) and isPlayer(getCreatureMaster(creature)) then-- Do something with players and their summons
doTargetCombatHealth(cid, creature, COMBAT_FIREDAMAGE, -10, -10, CONST_ME_HITBYFIRE)
return true
end
if not isMonster(creature) then-- Target only monsters
return false
end
doCreatureAddHealth(creature, math.random(100, 200))
return true
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end