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

[Spell] Random Area?

kyoushirou

I like trains
Joined
Apr 29, 2009
Messages
224
Reaction score
59
Is there any way to make a spell random area? I've tried but only made the area random each time I reload the entire spell system, what I need is something that makes it random every use... Here's what I got right now:

Lua:
local acombat, combat = createCombatObject(), createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_NONE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, -9, 0.3, -5)

local arr1 =
   {{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
    {math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), 3, math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)},
	{math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1), math.random(0,1)}}

setCombatArea(acombat, createCombatArea(arr1))

function onTargetTile(cid, pos) doCombat(cid, combat, positionToVariant(pos)) end
setCombatCallback(acombat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
function onCastSpell(cid, var) return doCombat(cid, acombat, var) end
 
You can create a single tile combat which is only on one tile.
Then you will need another bigger area which has no damage and such and then you do a combat callback and make a random chance to execute the one tile combat.
 
Err, any chance I could get some help with that? This is just a spell I found here at OTLand & changed the area on :p I'm pretty useless at making spells.
 
Code:
local acombat, combat = createCombatObject(), createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_NONE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, -9, 0.3, -5)

local arr1 = {
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
}

setCombatArea(acombat, createCombatArea(arr1))

function onTargetTile(cid, pos)
	return math.random(2) == 1 and doCombat(cid, combat, positionToVariant(pos))
end
setCombatCallback(acombat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(cid, var)
	return doCombat(cid, acombat, var)
end
 
Back
Top