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

TFS 1.X+ [T10.98][TFS1.2] Lua Script Error: [Test Interface] attempt to call method 'setCondition' (a nil value) Error loading the engine for monster spells

Haskys

Member
Joined
Jul 19, 2019
Messages
97
Reaction score
8
Location
Poland
Hello,


When starting the engine I have many errors like below. All relate to data/spells /scripts/monsters.
They all apply to the method setCondition
Examples:

Code:
Lua Script Error: [Test Interface]
data/spells/scripts/monster/lizard magistratus curse.lua
data/spells/scripts/monster/lizard magistratus curse.lua:19: attempt to call method 'setCondition' (a nil value)
stack traceback:
        [C]: in function 'setCondition'
        data/spells/scripts/monster/lizard magistratus curse.lua:19: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/monster/lizard magistratus curse.lua

Code:
Lua Script Error: [Test Interface]
data/spells/scripts/monster/lancer beetle curse.lua
data/spells/scripts/monster/lancer beetle curse.lua:19: attempt to call method 'setCondition' (a nil value)
stack traceback:
        [C]: in function 'setCondition'
        data/spells/scripts/monster/lancer beetle curse.lua:19: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/monster/lancer beetle curse.lua


data/spells/scripts/monster/lancer beetle curse.lua:

Lua:
local combat = {}

for i = 5, 11 do
    combat[i] = Combat()
    combat[i]:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
    combat[i]:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_SMALLCLOUDS)
    combat[i]:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_DEATH)

    local condition = Condition(CONDITION_CURSED)
    condition:setParameter(CONDITION_PARAM_DELAYED, true)

    local damage = i
    condition:addDamage(1, 4000, -damage)
    for j = 1, 7 do
        damage = damage * 1.2
        condition:addDamage(1, 4000, -damage)
    end

    combat[i]:setCondition(condition)
end

function onCastSpell(creature, variant)
    return combat[math.random(5, 11)]:execute(creature, variant)
end
 

I'm assuming these changes are already implemented in your sources, but not in these specific files.

change all 'setCondition' to 'addCondition'

So in this scripts case, you'd change..

this
Lua:
combat[i]:setCondition(condition)
to this
Lua:
combat[i]:addCondition(condition)
 
You are merging datapacks, if you dont know what you are doing, dont do it. Get datapack that is given with the engine.
 
Solution
Back
Top