• 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 spell crashes server

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
Hello so i made this little spell , and it crashes server any ideas why ? i don't even get error
how o can fix it or what is wrong ? i use 0.4
thanks in advance
spell
Code:
-- SpellCreator generated.

-- =============== COMBAT VARS ===============
-- Areas/Combat for 0ms
local combat0_holy_san = createCombatObject()
setCombatParam(combat0_holy_san, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat0_holy_san, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatArea(combat0_holy_san,createCombatArea({{1, 1, 1},
{1, 2, 1},
{1, 1, 1}}))
setCombatFormula(combat0_holy_san, COMBAT_FORMULA_SKILL, 125, 225, 225, 345)

local con___combat0_holy_san = createConditionObject(0+CONDITION_LIGHT)
addDamageCondition(con___combat0_holy_san, 6, 1500, -100)
setCombatCondition(combat0_holy_san, con___combat0_holy_san)

local con_light_and_hit__combat0_holy_san = createConditionObject(0)
setCombatCondition(combat0_holy_san, con_light_and_hit__combat0_holy_san)
local dfcombat0_holy_san = {CONST_ANI_SMALLHOLY,1,1,1,0,1,-1,0,-1,-1,-1,-1,0,-1,1,0,1}

-- Areas/Combat for 300ms
local combat3_holy_san = createCombatObject()
setCombatParam(combat3_holy_san, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat3_holy_san, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatArea(combat3_holy_san,createCombatArea({{0, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 2, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 1, 0, 0, 0}}))
setCombatFormula(combat3_holy_san, COMBAT_FORMULA_SKILL, 125, 225, 225, 345)

local con___combat3_holy_san = createConditionObject(0+CONDITION_LIGHT)
addDamageCondition(con___combat3_holy_san, 6, 1500, -100)
setCombatCondition(combat3_holy_san, con___combat3_holy_san)

local con_light_and_hit__combat3_holy_san = createConditionObject(0)
setCombatCondition(combat3_holy_san, con_light_and_hit__combat3_holy_san)
local dfcombat3_holy_san = {CONST_ANI_SMALLHOLY,2,2,2,-2,0,3,0,-3,-2,-2,-3,0,-2,2,3,0}

-- Areas/Combat for 600ms
local combat6_holy_san = createCombatObject()
setCombatParam(combat6_holy_san, COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
setCombatParam(combat6_holy_san, COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
setCombatArea(combat6_holy_san,createCombatArea({{0, 1, 1, 1, 0},
{1, 1, 1, 1, 1},
{1, 1, 2, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0}}))
setCombatFormula(combat6_holy_san, COMBAT_FORMULA_SKILL, 125, 225, 225, 345)

local con___combat6_holy_san = createConditionObject(0+CONDITION_LIGHT)
addDamageCondition(con___combat6_holy_san, 6, 1500, -100)
setCombatCondition(combat6_holy_san, con___combat6_holy_san)

local con_light_and_hit__combat6_holy_san = createConditionObject(0)
setCombatCondition(combat6_holy_san, con_light_and_hit__combat6_holy_san)
local dfcombat6_holy_san = {CONST_ANI_SMALLHOLY,-1,-2,-2,-1,-2,0,-1,1,0,2,1,1,2,0,1,-1,0,-2,1,-2,2,-1,2,1,1,2,-1,2,-2,1,0,-1,-1,0,-1,-1,1,0,0,1}

-- =============== 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)
    RunPart(combat0_holy_san,cid,var,dfcombat0_holy_san,startPos)
    addEvent(RunPart,300,combat3_holy_san,cid,var,dfcombat3_holy_san,startPos)
    addEvent(RunPart,600,combat6_holy_san,cid,var,dfcombat6_holy_san,startPos)
    return true
end
 
Do you get an error when the server crashes? my guess is its using a effect that doesnt exist.
 
it crashes if i try it on any creature no error , meanwhile there are no creatures on screen spell works ,
 
Error:
Code:
[10:2:20.970] [Error - Spell Interface]
[10:2:20.971] data/spells/scripts/swo.lua
[10:2:20.971] Description:
[10:2:20.972] (luaAddDamageCondition) Condition not found
 
Rewriten:
Code:
local areas = {
    [1] = {
        {1, 1, 1},
        {1, 2, 1},
        {1, 1, 1}
    },
    [2] = {
        {0, 0, 0, 1, 0, 0, 0},
        {0, 1, 0, 0, 0, 1, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {1, 0, 0, 2, 0, 0, 1},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 1, 0, 0, 0, 1, 0},
        {0, 0, 0, 1, 0, 0, 0}
    },
    [3] = {
        {0, 1, 1, 1, 0},
        {1, 1, 1, 1, 1},
        {1, 1, 2, 1, 1},
        {1, 1, 1, 1, 1},
        {0, 1, 1, 1, 0}
    }
}

local condition = createConditionObject(CONDITION_DAZZLED)
    addDamageCondition(condition, 6, 1500, -100)

local combat = {}
for j = 1, 3 do
    combat[j] = createCombatObject()
    setCombatParam(combat[j], COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
    setCombatParam(combat[j], COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
    setCombatFormula(combat[j], COMBAT_FORMULA_SKILL, 125, 225, 225, 345)
    setCombatArea(combat[j], createCombatArea(areas[j]))
    setCombatCondition(combat[j], condition)
end

local animation = {
    [1] = {CONST_ANI_SMALLHOLY,1,1,1,0,1,-1,0,-1,-1,-1,-1,0,-1,1,0,1},
    [2] = {CONST_ANI_SMALLHOLY,2,2,2,-2,0,3,0,-3,-2,-2,-3,0,-2,2,3,0},
    [3] = {CONST_ANI_SMALLHOLY,-1,-2,-2,-1,-2,0,-1,1,0,2,1,1,2,0,1,-1,0,-2,1,-2,2,-1,2,1,1,2,-1,2,-2,1,0,-1,-1,0,-1,-1,1,0,0,1}
}

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)
    for i = 1, 3 do
        addEvent(RunPart, (i - 1) * 300, combat[i], cid, var, animation[i], getCreaturePosition(cid))
    end
    return true
end
 
Last edited:
i tryed watching tutorials to make spells , but to make these nice spells im not good at all. that program is best way to make beatifull spell in my eyes.

anyone know how to make bueatifull spells WITH no program ? :P
 
Back
Top