• 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.2] remove condition - drown

guiismiti

Well-Known Member
Joined
May 19, 2014
Messages
315
Solutions
3
Reaction score
68
Hello

It looks like removeCondition(CONDITION_DROWN) is not working

This is the movement code for the ocean floor tiles
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)
    local player = creature:getPlayer()
    if not player then
        return true
    end

    if math.random(10) == 1 then
        position:sendMagicEffect(CONST_ME_BUBBLES)
    end
    player:addCondition(condition)
end

function onStepOut(creature, item, position, fromPosition)
    local player = creature:getPlayer()
    if not player then
        return false
    end
   
    player:removeCondition(CONDITION_DROWN)
end

I've also tried to use
Code:
    player:removeCondition(Condition(CONDITION_DROWN))
and
Code:
    player:removeCondition(condition)

Does anybody know what's wrong?

Thanks in advance.
 
@guiismiti

How you solved it?, because i try to fix, but not possible.


I have this file identical:

https://www.diffchecker.com/Gfns8UHo

I think that problem is also in movements.xml, on this lines:

http://pastebin.com/wRsnPJb4

Please you can check again? I try to fix adding more type items of floor, but not possible.
I fix the issue with one bad thing ... then, you want to remove the condition when the player stepIn a teleport and get teleported right?
then you can use "if" statement to check if have the teleport or not
something like this:
Code:
if Tile(item:getPosition()):getItemById(1387) then
        player:removeCondition(CONDITION_DROWN)
        return true
    end
I used another script, I just check the position, but we can be more smart and check the teleports
 
I fix the issue with one bad thing ... then, you want to remove the condition when the player stepIn a teleport and get teleported right?
then you can use "if" statement to check if have the teleport or not
something like this:
Code:
if Tile(item:getPosition()):getItemById(1387) then
        player:removeCondition(CONDITION_DROWN)
        return true
    end
I used another script, I just check the position, but we can be more smart and check the teleports
why item:getPosition() instead of toPosition lol
 
yeah but no point in doing something again if its already done for you
like doing Player(player:getId()) if you already have player in function argument lol
sorry about it, I used to use so, another 12319283 scripts that I work I had to use in this way, then I get it as my routine
 
Back
Top