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

where I can find a swimming script?

carre

Advanced OT User
Joined
Apr 23, 2013
Messages
881
Solutions
1
Reaction score
157
Location
Sweden
Hi otland
It's me again ;P
where I can find a swimming script for my rookgaard?
cuz I don't have it on my server.
the char walking on water.

Screenshot_4.png
 
It should be on every TFS by default, data\movements\scripts\swimming.lua check and maybe add this water to the ids.
 
It should be on every TFS by default, data\movements\scripts\swimming.lua check and maybe add this water to the ids.
Code:
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(hasCondition(cid, CONDITION_OUTFIT, 0, CONDITIONID_COMBAT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
        doRemoveCondition(cid, CONDITION_OUTFIT)
        if(not isPlayerGhost(cid)) then
            doSendMagicEffect(position, CONST_ME_POFF)
        end
    end

    return true
end

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end

    local tmp = getTileInfo(toPosition)
    if(tmp.trashHolder) then
        if(doTileQueryAdd(cid, toPosition, 4) ~= RETURNVALUE_NOERROR) then
            return false
        end

        if(not isPlayerGhost(cid)) then
            doSendMagicEffect(fromPosition, CONST_ME_POFF)
            doSendMagicEffect(toPosition, CONST_ME_WATERSPLASH)
        end

        doRemoveConditions(cid, true)
        doSetCreatureOutfit(cid, outfit, -1)
    end

    return true
end


Where I put the water id?
 
data\movements\movements.xml
XML:
<movevent type="StepIn" itemid="7943-7954" event="script" value="swimming.lua"/>
 
data\movements\movements.xml
XML:
<movevent type="StepIn" itemid="7943-7954" event="script" value="swimming.lua"/>
I already have that script

!-- Swimming -->
<movevent type="StepIn" itemid="8863" event="script" value="swimming.lua"/>
<movevent type="StepIn" itemid="7943-7954" event="script" value="swimming.lua"/>
 
Add those ids to the swimming script and then try in-game if it didn't work then you'll have to change the water to normal swimming water ids which are 8863/7943/7954
XML:
    <movevent type="StepIn" fromid="4620" toid="4624" event="script" value="swimming.lua"/>
 
Add those ids to the swimming script and then try in-game if it didn't work then you'll have to change the water to normal swimming water ids which are 8863/7943/7954
XML:
    <movevent type="StepIn" fromid="4620" toid="4624" event="script" value="swimming.lua"/>
I've added them and still don't work.

<!-- Swimming -->
<movevent type="StepIn" itemid="4624" event="script" value="swimming.lua"/>
<movevent type="StepIn" itemid="4623-4624-4621-4622" event="script" value="swimming.lua"/>
 
You have to add the borders at the beginning of the water and walk on them don't use /a or GM teleport.
border ids for desert 7943-7954
 
You have to add the borders at the beginning of the water and walk on them don't use /a or GM teleport.
border ids for desert 7943-7954
I just add the bords at the beginning and still no effect.
Post automatically merged:

broo, this scrpits for 8.6 not for other client its easy to doing its
My server is 8.6 and tfs 0.3.7
 
I just added and tested it and it worked perfect, You must be doing something wrong.
Try adding this instead of your swimming.lua
Lua:
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

local BORDERS = {
    [7943] = {x = 0, y = -2, back = SOUTH},
    [7944] = {x = -2, y = 0, back = EAST},
    [7945] = {x = 0, y = 2, back = NORTH},
    [7946] = {x = 2, y = 0, back = WEST},
    [7947] = {x = 2, y = 1, back = WEST},
    [7948] = {x = -2, y = 1, back = NORTH},
    [7949] = {x = 2, y = -1, back = WEST},
    [7950] = {x = -2, y = -1, back = EAST},
    [7951] = {x = 2, y = 2, back = WEST},
    [7952] = {x = -2, y = 2, back = NORTH},
    [7953] = {x = 2, y = -2, back = WEST},
    [7954] = {x = -2, y = -2, back = SOUTH}
}

BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end

    local border = BORDERS[item.itemid]
    if(not border) then
        return false
    end

    local pos, newPos = getCreaturePosition(cid), {}
    newPos = pos
    newPos.x = pos.x + border.x
    newPos.y = pos.y + border.y

    if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
        doMoveCreature(cid, border.back)
        doRemoveCondition(cid, CONDITION_OUTFIT)
    else
        if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
            return false
        end

        local tmp = getCreaturePosition(cid)
        doTeleportThing(cid, newPos)

        if(not isPlayerGhost(cid)) then
            doSendMagicEffect(tmp, CONST_ME_POFF)
            doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
        end

        doRemoveConditions(cid, true)
        doSetCreatureOutfit(cid, outfit, -1)
    end

    return true
end
You should walk on the borders like this south 1.
borders.PNG
 
I just added and tested it and it worked perfect, You must be doing something wrong.
Try adding this instead of your swimming.lua
Lua:
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

local BORDERS = {
    [7943] = {x = 0, y = -2, back = SOUTH},
    [7944] = {x = -2, y = 0, back = EAST},
    [7945] = {x = 0, y = 2, back = NORTH},
    [7946] = {x = 2, y = 0, back = WEST},
    [7947] = {x = 2, y = 1, back = WEST},
    [7948] = {x = -2, y = 1, back = NORTH},
    [7949] = {x = 2, y = -1, back = WEST},
    [7950] = {x = -2, y = -1, back = EAST},
    [7951] = {x = 2, y = 2, back = WEST},
    [7952] = {x = -2, y = 2, back = NORTH},
    [7953] = {x = 2, y = -2, back = WEST},
    [7954] = {x = -2, y = -2, back = SOUTH}
}

BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end

    local border = BORDERS[item.itemid]
    if(not border) then
        return false
    end

    local pos, newPos = getCreaturePosition(cid), {}
    newPos = pos
    newPos.x = pos.x + border.x
    newPos.y = pos.y + border.y

    if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
        doMoveCreature(cid, border.back)
        doRemoveCondition(cid, CONDITION_OUTFIT)
    else
        if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
            return false
        end

        local tmp = getCreaturePosition(cid)
        doTeleportThing(cid, newPos)

        if(not isPlayerGhost(cid)) then
            doSendMagicEffect(tmp, CONST_ME_POFF)
            doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
        end

        doRemoveConditions(cid, true)
        doSetCreatureOutfit(cid, outfit, -1)
    end

    return true
end
You should walk on the borders like this south 1.
View attachment 42263
when I relog on water I get this
Screenshot_4.png
and can't leave the water spot
 
I solved!
just took script from other datapack.
Code:
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

local BORDERS = {
    [7943] = {x = 0, y = -2, back = SOUTH},
    [7944] = {x = -2, y = 0, back = EAST},
    [7945] = {x = 0, y = 2, back = NORTH},
    [7946] = {x = 2, y = 0, back = WEST},
    [7947] = {x = 2, y = 1, back = WEST},
    [7948] = {x = -2, y = 1, back = NORTH},
    [7949] = {x = 2, y = -1, back = WEST},
    [7950] = {x = -2, y = -1, back = EAST},
    [7951] = {x = 2, y = 2, back = WEST},
    [7952] = {x = -2, y = 2, back = NORTH},
    [7953] = {x = 2, y = -2, back = WEST},
    [7954] = {x = -2, y = -2, back = SOUTH}
}

BORDERS[4828] = BORDERS[7943]
BORDERS[8863] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
    if(not isPlayer(cid)) then
        return true
    end

    local border = BORDERS[item.itemid]
    if(not border) then
        return false
    end

    local pos, newPos = getCreaturePosition(cid), {}
    newPos = pos
    newPos.x = pos.x + border.x
    newPos.y = pos.y + border.y

    if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
        doMoveCreature(cid, border.back)
        doRemoveCondition(cid, CONDITION_OUTFIT)
    else
        if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
            return false
        end

        local tmp = getCreaturePosition(cid)
        doTeleportThing(cid, newPos)

        if(not isPlayerGhost(cid)) then
            doSendMagicEffect(tmp, CONST_ME_POFF)
            doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
        end

        doRemoveConditions(cid, true)
        doSetCreatureOutfit(cid, outfit, -1)
    end

    return true
end


<!-- Swimming -->
<movevent type="StepIn" itemid="8863" event="script" value="swimming.lua"/>
<movevent type="StepIn" itemid="7943-7954" event="script" value="swimming.lua"/>
 
Back
Top