• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Random area

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
 
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

That should be his request.
 
I have an area like this:

Code:
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},
}

and i wish all tiles with 1 had 50% chance of being caught

thanks.
 
function onTargetTile(cid, pos)
if(math.random(1, 100) > 50) then
castSpellOnTile(cid, pos)
end
end
setCombatCallback(test, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
 
This is my intention:

Code:
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},
}

but the area is not reloaded all times. =[
 
Back
Top