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

[The OTServBR based on TFS 1.3] - Swimming Send Effect [Movement]

Sir Richard

New Member
Joined
Jun 10, 2009
Messages
19
Reaction score
3
Location
Brazil
Greetings everyone!

Could anyone help me figure this one out?

The basic concept is the one used in real tibia:
When the player enters a swimming area (tiles from id 4620 to id 4625), an effect should be sent to that position, but only when entering the area, walking around said tiles shouldn't keep sending that one effect.

This is the basic code of swimming, but in this case, the player steps on the tile and if he does not have the condition, it is set and the effect is sent. The problem is: whenever you step out of the previous tile, the condition is removed and then it is set and the effect sent again.

Code:
local condition = Condition(CONDITION_OUTFIT)
condition:setOutfit({lookType = 267})
condition:setTicks(-1)

function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        return false
    end

    if creature:getCondition(CONDITION_OUTFIT) then
        creature:getPosition():sendMagicEffect(CONST_ME_WATERSPLASH)
        creature:addCondition(condition)
    end
    return true
end

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

    creature:removeCondition(CONDITION_OUTFIT)
    return true
end

The solution I need is: finding a simple way to check if the next tile is not the following range: local waterTiles = {4620, 4621, 4622, 4623, 4624, 4625}

Any thoughts on that?

Thanks in advance,

Richard
 
Back
Top