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

Solved Spell error when monster dies

dhrsantan

A.K.A Lbakiller
Joined
Nov 27, 2014
Messages
94
Reaction score
10
Location
The netherlands
so i get the following error, when the monster dies and the spell is still doing the animation/dmg.

[05/01/2015 18:50:31] [Error - Spell Interface]
[05/01/2015 18:50:31] In a timer event called from:
[05/01/2015 18:50:31] (Unknown script file)
[05/01/2015 18:50:31] Description:
[05/01/2015 18:50:32] (luaDoCombatAreaHealth) Creature not found

Code:
local combat = createCombatObject()

arr = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 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, 3, 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, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function spellCallback(param)
    if param.count > 0 or math.random(0, 1) == 1 then
        doSendMagicEffect(param.pos, CONST_ME_HITBYFIRE)
        doAreaCombatCondition(param.cid, COMBAT_FIREDAMAGE, param.pos, 0, -1000, -1000, CONST_ME_EXPLOSIONHIT)
    end

    if(param.count < 5) then
        param.count = param.count + 1
        addEvent(spellCallback, math.random(1000, 4000), param)
    end
end

function onTargetTile(cid, pos)
    local param = {}
    param.cid = cid
    param.pos = pos
    param.count = 0
    spellCallback(param)
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

I'm running TFS 0.3.6 Cryingdamson


///Solved

Solved:

Code:
local combat = createCombatObject()

arr = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 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, 3, 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, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function spellCallback(param)
    if param.count > 0 or math.random(0, 1) == 1 then
        if isCreature(param.cid) then
            doSendMagicEffect(param.pos, CONST_ME_HITBYFIRE)
            doAreaCombatHealth(param.cid, COMBAT_FIREDAMAGE, param.pos, 0, -1000, -1000, CONST_ME_EXPLOSIONHIT)
        end
    end

    if(param.count < 5) then
        param.count = param.count + 1
        addEvent(spellCallback, math.random(1000, 4000), param)
    end
end

function onTargetTile(cid, pos)
    local param = {}
    param.cid = cid
    param.pos = pos
    param.count = 0
    spellCallback(param)
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end
 
Last edited:
I don't see this function in the script, but you can check if cid is a creature.
Code:
if isCreature(param.cid) then
     -- the function here
end

If the creature is no longer there (died or log out), it's not seen as creature anymore and it won't do that function since the if statement won't be true then.
 
Last edited:
Solved:

Code:
local combat = createCombatObject()

arr = {
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 1, 1, 1, 1, 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, 3, 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, 1, 1, 1, 1, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
}

local area = createCombatArea(arr)
setCombatArea(combat, area)

function spellCallback(param)
    if param.count > 0 or math.random(0, 1) == 1 then
        if isCreature(param.cid) then
            doSendMagicEffect(param.pos, CONST_ME_HITBYFIRE)
            doAreaCombatHealth(param.cid, COMBAT_FIREDAMAGE, param.pos, 0, -1000, -1000, CONST_ME_EXPLOSIONHIT)
        end
    end

    if(param.count < 5) then
        param.count = param.count + 1
        addEvent(spellCallback, math.random(1000, 4000), param)
    end
end

function onTargetTile(cid, pos)
    local param = {}
    param.cid = cid
    param.pos = pos
    param.count = 0
    spellCallback(param)
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETTILE, "onTargetTile")

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