• 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 Drowning condition not dissapearing after stepOut

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, i have the latest tfs, and drowning condition doesn't dissapear after players get out of water, check this is what i have:
oh and btw i have check other thread with the same problem but none of them helped me


xml:


Code:
    <!-- Swimming -->
    <movevent event="StepIn" fromid="4620" toid="4625" script="swimming.lua" />
    <movevent event="StepOut" fromid="4620" toid="4625" script="swimming.lua" />
    <movevent event="StepIn" fromid="4820" toid="4825" script="swimming.lua" />
    <movevent event="StepOut" fromid="4820" toid="4825" script="swimming.lua" />
    <movevent event="StepIn" itemid="5405" script="drowning.lua" />
    <movevent event="StepOut" itemid="5405" script="drowning.lua" />





Code:
local condition = Condition(CONDITION_DROWN)
condition:setParameter(CONDITION_PARAM_PERIODICDAMAGE, -20)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
condition:setParameter(CONDITION_PARAM_TICKINTERVAL, 2000)

function onStepIn(creature, item, position, fromPosition)
    if creature:isPlayer() then
        if math.random(1, 10) == 1 then
            position:sendMagicEffect(CONST_ME_BUBBLES)
        end
        creature:addCondition(condition)
    end
    return true
end

function onStepOut(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        creature:removeCondition(CONDITION_DROWN)
    end
    return true
end

does anyone know why this happens?
 
sorry but this error might be related, im having this in console :/
Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/swimming.lua:onStepIn
data/movements/scripts/swimming.lua:9: attempt to call global 'doSetCreatureOutfit' (a nil value)
stack traceback:
        [C]: in function 'doSetCreatureOutfit'
        data/movements/scripts/swimming.lua:9: in function <data/movements/scripts/swimming.lua:3>
 
Looks like you don't have the function 'doSetCreatureOutfit' or it's set to local

tip: There are some great editors such as WebStorm or Atom(free) to search the whole project for words
 
Looks like you don't have the function 'doSetCreatureOutfit' or it's set to local

tip: There are some great editors such as WebStorm or Atom(free) to search the whole project for words
do you know where should i have this function? where should be located?
 
@Thorn I don't think you have it, atleast I don't using tfs 1.2.

I can guess that function does similar to this
Code:
local outfit = player:getOutfit()
outfit.lookType = 900
player:setOutfit(outfit)

Like I said you can search your project with editors like Atom(CTRL+SHIFT+F) and enter search phrase "doSetCreatureOutfit", if no results then you don't have the function.
 

Similar threads

Back
Top