• 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 Bear trap causes paralyze in creatures.< TFS 0.3.6 >

Misterion

New Member
Joined
Jan 24, 2014
Messages
52
Reaction score
4
I was trying to add the effect of paralysis on the creature that step on item (id 2579), here is the script I am using and the error:

Script:

Lua:
function onStepIn(cid, item, pos)
    if(item.itemid == 2579) then
        if(not isPlayer(cid)) then
       
            local condition = createConditionObject(CONDITION_PARALYZE)
            setConditionParam(condition, CONDITION_PARAM_TICKS, 1000)
            setConditionFormula(condition, -0.5, 0, -0.5, 0)
            doAddCondition(cid, condition)
            doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -15, -30, CONST_ME_NONE)
            doTransformItem(item.uid, item.itemid - 1)
           
           
        end
    else
        if(isPlayer(cid)) then
            doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -50, -100, CONST_ME_NONE)
            doTransformItem(item.uid, item.itemid + 1)
        end
    end
    return true
end

function onStepOut(cid, item, pos)
    doTransformItem(item.uid, item.itemid - 1)
    return true
end

function onRemoveItem(item, tile, pos)
    local thingPos = getThingPos(item.uid)
    if(getDistanceBetween(thingPos, pos) > 0) then
        doTransformItem(item.uid, item.itemid - 1)
        doSendMagicEffect(thingPos, CONST_ME_POFF)
    end
    return true
end

Error when the creature steps:

Code:
[06/05/2018 15:58:23] [Error - MoveEvents Interface]
[06/05/2018 15:58:23] data/movements/scripts/trap.lua:onStepIn
[06/05/2018 15:58:23] Description:
[06/05/2018 15:58:23] (luaCreateConditionObject) This function can only be used while loading the script.

[06/05/2018 15:58:23] [Error - MoveEvents Interface]
[06/05/2018 15:58:23] data/movements/scripts/trap.lua:onStepIn
[06/05/2018 15:58:23] Description:
[06/05/2018 15:58:23] (luaSetConditionParam) This function can only be used while loading the script.

[06/05/2018 15:58:23] [Error - MoveEvents Interface]
[06/05/2018 15:58:23] data/movements/scripts/trap.lua:onStepIn
[06/05/2018 15:58:23] Description:
[06/05/2018 15:58:23] (luaSetConditionFormula) This function can only be used while loading the script.

[06/05/2018 15:58:23] [Error - MoveEvents Interface]
[06/05/2018 15:58:23] data/movements/scripts/trap.lua:onStepIn
[06/05/2018 15:58:23] Description:
[06/05/2018 15:58:23] (luaDoAddCondition) Condition not found
 
Solution
Take out lines 5-7 and put them outside or above onStepIn. Conditions can only be defined outside of an interface because an interface is a dynamic entity.
Take out lines 5-7 and put them outside or above onStepIn. Conditions can only be defined outside of an interface because an interface is a dynamic entity.
 
Solution
Back
Top