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

Lua magic spell doesn't do damage

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
923
Location
Chile
Hello guys, i did some spells with spellcreator but i havt two spells that don't attack, i mean the animation happens but they dont do damage, could anyone tell me why? and hw to fix it?

LUA:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 1200ms
local combat12_Brush = createCombatObject()
setCombatParam(combat12_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat12_Brush, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatArea(combat12_Brush,createCombatArea({{1, 0, 1},
{0, 2, 0},
{1, 0, 1}}))
setCombatFormula(combat12_Brush, COMBAT_FORMULA_LEVELMAGIC, 10, 10, 25, 25)

-- Areas/Combat for 800ms
local combat8_Brush = createCombatObject()
setCombatParam(combat8_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat8_Brush, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatArea(combat8_Brush,createCombatArea({{0, 1, 0},
{1, 2, 1},
{0, 1, 0}}))
setCombatFormula(combat8_Brush, COMBAT_FORMULA_LEVELMAGIC, 10, 10, 25, 25)

-- Areas/Combat for 700ms
local combat7_Brush = createCombatObject()
setCombatParam(combat7_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat7_Brush, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatArea(combat7_Brush,createCombatArea({{0, 0, 1, 0, 1, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{1, 0, 0, 0, 0, 0, 1},
{0, 0, 0, 2, 0, 0, 0},
{1, 0, 0, 0, 0, 0, 1},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 1, 0, 1, 0, 0}}))
setCombatFormula(combat7_Brush, COMBAT_FORMULA_LEVELMAGIC, 10, 10, 25, 25)

-- Areas/Combat for 400ms
local combat4_Brush = createCombatObject()
setCombatParam(combat4_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat4_Brush, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatArea(combat4_Brush,createCombatArea({{0, 1, 0, 1, 0},
{1, 1, 0, 1, 1},
{0, 0, 2, 0, 0},
{1, 1, 0, 1, 1},
{0, 1, 0, 1, 0}}))
setCombatFormula(combat4_Brush, COMBAT_FORMULA_LEVELMAGIC, 10, 10, 25, 25)

-- Areas/Combat for 0ms
local combat0_Brush = createCombatObject()
setCombatParam(combat0_Brush, COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
setCombatParam(combat0_Brush, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
setCombatArea(combat0_Brush,createCombatArea({{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{1, 1, 1, 2, 1, 1, 1},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0}}))
setCombatFormula(combat0_Brush, COMBAT_FORMULA_LEVELMAGIC, 10, 10, 25, 25)

-- =============== CORE FUNCTIONS ===============
local function RunPart(c,cid,var,dirList,dirEmitPos) -- Part
    if (isCreature(cid)) then
        doCombat(cid, c, var)
        if (dirList ~= nil) then -- Emit distance effects
            local i = 2;
            while (i < #dirList) do
                doSendDistanceShoot(dirEmitPos,{x=dirEmitPos.x-dirList[i],y=dirEmitPos.y-dirList[i+1],z=dirEmitPos.z},dirList[1])
                i = i + 2
            end       
        end
    end
end

function onCastSpell(cid, var)
    local startPos = getCreaturePosition(cid)
    addEvent(RunPart,1200,combat12_Brush,cid,var)
    addEvent(RunPart,800,combat8_Brush,cid,var)
    addEvent(RunPart,700,combat7_Brush,cid,var)
    addEvent(RunPart,400,combat4_Brush,cid,var)
    RunPart(combat0_Brush,cid,var)
    return true
end
 
Solution
Change
Code:
setCombatFormula(combat0_Brush, COMBAT_FORMULA_LEVELMAGIC, 10, 10, 25, 25)
TO
Code:
setCombatFormula(combat0_Brush, COMBAT_FORMULA_LEVELMAGIC, -10, -10, -25, -25)
Change
Code:
setCombatFormula(combat0_Brush, COMBAT_FORMULA_LEVELMAGIC, 10, 10, 25, 25)
TO
Code:
setCombatFormula(combat0_Brush, COMBAT_FORMULA_LEVELMAGIC, -10, -10, -25, -25)
 
Solution
Back
Top