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

Lua Problem with spell

Hafexo

New Member
Joined
Jul 14, 2009
Messages
27
Reaction score
2
Hey i have this monster spell

Code:
local waves = 40
local combat = createCombatObject()
local meteor = createCombatObject()
setCombatParam(meteor, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(meteor, COMBAT_PARAM_EFFECT, CONST_ME_LOSEENERGY)
setCombatFormula(meteor, COMBAT_FORMULA_LEVELMAGIC, 0, -80, 0, -80)

local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 40)
setCombatFormula(combat2, COMBAT_FORMULA_LEVELMAGIC, 0, -400, 0, -1000)

combat_arr = {
{0, 0, 0, 0, 1, 1, 1, 0, 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, 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},
{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, 0, 1, 1, 1, 0, 0, 0, 0}
}
local combat_area = createCombatArea(combat_arr)
setCombatArea(combat, combat_area)
local area2 = createCombatArea(combat_arr)
setCombatArea(combat2, area2)

local function meteorCast(p)
doCombat(p.cid, p.combat, positionToVariant(p.pos))
end

function onTargetTile(cid, pos)

if (math.random(0, 90) == 1) then

local newpos = {x = pos.x - 7, y = pos.y - 6, z = pos.z}
doSendDistanceShoot(newpos, pos, CONST_ANI_SMALLICE)
addEvent(meteorCast, 50, {cid = cid,pos = pos, combat = meteor})
end
end
setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")
function onCastSpell(cid, var)
doCreatureSay(cid, "LET THE GOD OF RAIN COSUME YOU", TALKTYPE_ORANGE_1)
for i = 0, waves do
addEvent(function()
if i == 40 then
doCombat(cid, combat2, var)
else
doCombat(cid, combat, var)
end
end, 100 * i)
end
return true
end

It's supposed to rain for 3 seconds and then do "Rage of the skies" with 400-1000 dmg

But problem is - it works great when i cast it as GM, but if monster cast it, there is no final dmg or its way too low.
 
Back
Top