local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 0, 4.8)
local Areas = {
[1] = createCombatArea(AREA_CROSS1X1),
[2] = createCombatArea(AREA_CROSS5X5)
}
setCombatArea(combat, math.random(#Areas))
function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end
example: explosion.lua:
LUA:local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONAREA) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EXPLOSION) setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 0, 4.8) local Areas = { [1] = createCombatArea(AREA_CROSS1X1), [2] = createCombatArea(AREA_CROSS5X5) } setCombatArea(combat, math.random(#Areas)) function onCastSpell(cid, var) return doCombat(cid, combat, var) end
bms = createCombatArea{
{0, 0, 0, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 1, 0, 0},
{0, 0, 2, 0, 0},
}
bms = createCombatArea{
{0, 0, 0, 0, 0},
{0, 0, math.random(0, 1), 0, 0},
{0, 0, math.random(0, 1), 0, 0},
{0, 0, math.random(0, 1), 0, 0},
{0, 0, math.random(0, 1), 0, 0},
{0, 0, math.random(0, 1), 0, 0},
{0, 0, 2, 0, 0},
}