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

problem with swimming

  • Thread starter Thread starter verdehile95
  • Start date Start date
V

verdehile95

Guest
why when I swim, with each move my character's speed decreases to 5, after some time my character moves super slowly i use tfs 1.4.2asdasd.webp

and when I get out of the water I still see swimming animations
Post automatically merged:

aaaaaaaa.webp
Post automatically merged:

I modified the swiming.lua script and everything works
LUA:
local swimStorage = 3330 -- Storage dla sprawdzania, czy gracz pływa

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

    local isswimming = creature:getStorageValue(swimStorage)

    -- Definicja stroju nurka
    local diverOutfit = {
        lookType = 267, -- Identyfikator stroju pływania
        lookHead = 0,
        lookBody = 0,
        lookLegs = 0,
        lookFeet = 0,
        lookAddons = 0
    }

    if isswimming ~= 1 then
        -- Zapisanie oryginalnego stroju gracza do storage
        creature:setStorageValue(3331, creature:getOutfit().lookType)
        creature:setStorageValue(3332, creature:getOutfit().lookHead)
        creature:setStorageValue(3333, creature:getOutfit().lookBody)
        creature:setStorageValue(3334, creature:getOutfit().lookLegs)
        creature:setStorageValue(3335, creature:getOutfit().lookFeet)
        creature:setStorageValue(3336, creature:getOutfit().lookAddons)

        -- Nakładanie stroju nurka
        creature:setStorageValue(swimStorage, 1)
        creature:setOutfit(diverOutfit)
        position:sendMagicEffect(26)
    end

    return true
end

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

    local isswimming = creature:getStorageValue(swimStorage)

    if isswimming == 1 then
        -- Przywracanie standardowego stroju gracza
        local standardOutfit = {
            lookType = creature:getStorageValue(3331),
            lookHead = creature:getStorageValue(3332),
            lookBody = creature:getStorageValue(3333),
            lookLegs = creature:getStorageValue(3334),
            lookFeet = creature:getStorageValue(3335),
            lookAddons = creature:getStorageValue(3336)
        }

        creature:setStorageValue(swimStorage, -1)
        creature:setOutfit(standardOutfit)
        position:sendMagicEffect(2)
    end

    return true
end
 
Last edited by a moderator:
Back
Top