• 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.X+ [TFS 1.3 Nekiro's 8.6] Issue with sewer bridge only on Linux, not occuring on Windows

nathu

Banned User
Joined
Aug 30, 2015
Messages
3
Reaction score
2
Hey, I recently realized that there is a bug occurring on my Linux server, but it's not occurring while I compile it on Windows.
After I use the lever to remove the bridge, bridge gets removed successfully but when I enter on one of the tiles that have been changed, my character disappears.

bugzor.gif

As you can see, there is this "splash" effect missing (what's causing it anyway?) on Linux build, but this is exact same source, but compiled with CMake for Linux and VS19 for Windows.

Did you guys had any similar issues?

Code that I'm using, its the same that is available on OTBR repo. Not giving any errors in console, nor clients terminal.
Lua:
local config = {
    bridgePositions = {
        {position = Position(32099, 32205, 8), groundId = 9022, itemId = 4645},
        {position = Position(32100, 32205, 8), groundId = 4616},
        {position = Position(32101, 32205, 8), groundId = 9022, itemId = 4647}
    },
    leverPositions = {
        Position(32098, 32204, 8),
        Position(32104, 32204, 8)
    },
    relocatePosition = Position(32102, 32205, 8),
    relocateMonsterPosition = Position(32103, 32205, 8),
    bridgeId = 5770
}

function moveToPosition(self, toPosition, pushMove, monsterPosition)
    if self:getPosition() == toPosition then
        return false
    end

    if not Tile(toPosition) then
        return false
    end

    for i = self:getThingCount() - 1, 0, -1 do
        local thing = self:getThing(i)
        if thing then
            if thing:isItem() then
                if thing:getId() ~= config.bridgeId then
                    thing:moveTo(toPosition)
                end
            elseif thing:isCreature() then
                if monsterPosition and thing:isMonster() then
                    thing:teleportTo(monsterPosition, pushMove)
                else
                    thing:teleportTo(toPosition, pushMove)
                end
            end
        end
    end
    return true
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local leverLeft, lever = item.itemid == 1945
    for i = 1, #config.leverPositions do
        lever = Tile(config.leverPositions[i]):getItemById(leverLeft and 1945 or 1946)
        if lever then
            lever:transform(leverLeft and 1946 or 1945)
        end
    end

    local tile, tmpItem, bridge
    if leverLeft then
        for i = 1, #config.bridgePositions do
            bridge = config.bridgePositions[i]
            tile = Tile(bridge.position)

            tmpItem = tile:getGround()
            if tmpItem then
                tmpItem:transform(config.bridgeId)
            end

            if bridge.itemId then
                tmpItem = tile:getItemById(bridge.itemId)
                if tmpItem then
                    tmpItem:remove()
                end
            end
        end
    else
        for i = 1, #config.bridgePositions do
            bridge = config.bridgePositions[i]
            tile = Tile(bridge.position)

            moveToPosition(tile, config.relocatePosition, true, config.relocateMonsterPosition)
            tile:getGround():transform(bridge.groundId)
            Game.createItem(bridge.itemId, 1, bridge.position)
        end

    end
    return true
end

I was messing around with different id's, tried to refactor the moveToPosition or use Tile.relocateTo, but to no avail.
 
Last edited:
Solution
Hey, I recently realized that there is a bug occurring on my Linux server, but it's not occurring while I compile it on Windows.
After I use the lever to remove the bridge, bridge gets removed successfully but when I enter on one of the tiles that have been changed, my character disappears.

View attachment 46925

As you can see, there is this "splash" effect missing (what's causing it anyway?) on Linux build, but this is exact same source, but compiled with CMake for Linux and VS19 for Windows.

Did you guys had any similar issues?

Code that I'm using, its the same that is available on OTBR repo. Not giving any errors in console, nor clients terminal.
Lua:
local config = {
    bridgePositions = {
        {position = Position(32099, 32205, 8)...
Hey, I recently realized that there is a bug occurring on my Linux server, but it's not occurring while I compile it on Windows.
After I use the lever to remove the bridge, bridge gets removed successfully but when I enter on one of the tiles that have been changed, my character disappears.

View attachment 46925

As you can see, there is this "splash" effect missing (what's causing it anyway?) on Linux build, but this is exact same source, but compiled with CMake for Linux and VS19 for Windows.

Did you guys had any similar issues?

Code that I'm using, its the same that is available on OTBR repo. Not giving any errors in console, nor clients terminal.
Lua:
local config = {
    bridgePositions = {
        {position = Position(32099, 32205, 8), groundId = 9022, itemId = 4645},
        {position = Position(32100, 32205, 8), groundId = 4616},
        {position = Position(32101, 32205, 8), groundId = 9022, itemId = 4647}
    },
    leverPositions = {
        Position(32098, 32204, 8),
        Position(32104, 32204, 8)
    },
    relocatePosition = Position(32102, 32205, 8),
    relocateMonsterPosition = Position(32103, 32205, 8),
    bridgeId = 5770
}

function moveToPosition(self, toPosition, pushMove, monsterPosition)
    if self:getPosition() == toPosition then
        return false
    end

    if not Tile(toPosition) then
        return false
    end

    for i = self:getThingCount() - 1, 0, -1 do
        local thing = self:getThing(i)
        if thing then
            if thing:isItem() then
                if thing:getId() ~= config.bridgeId then
                    thing:moveTo(toPosition)
                end
            elseif thing:isCreature() then
                if monsterPosition and thing:isMonster() then
                    thing:teleportTo(monsterPosition, pushMove)
                else
                    thing:teleportTo(toPosition, pushMove)
                end
            end
        end
    end
    return true
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local leverLeft, lever = item.itemid == 1945
    for i = 1, #config.leverPositions do
        lever = Tile(config.leverPositions[i]):getItemById(leverLeft and 1945 or 1946)
        if lever then
            lever:transform(leverLeft and 1946 or 1945)
        end
    end

    local tile, tmpItem, bridge
    if leverLeft then
        for i = 1, #config.bridgePositions do
            bridge = config.bridgePositions[i]
            tile = Tile(bridge.position)

            tmpItem = tile:getGround()
            if tmpItem then
                tmpItem:transform(config.bridgeId)
            end

            if bridge.itemId then
                tmpItem = tile:getItemById(bridge.itemId)
                if tmpItem then
                    tmpItem:remove()
                end
            end
        end
    else
        for i = 1, #config.bridgePositions do
            bridge = config.bridgePositions[i]
            tile = Tile(bridge.position)

            moveToPosition(tile, config.relocatePosition, true, config.relocateMonsterPosition)
            tile:getGround():transform(bridge.groundId)
            Game.createItem(bridge.itemId, 1, bridge.position)
        end

    end
    return true
end

I was messing around with different id's, tried to refactor the moveToPosition or use Tile.relocateTo, but to no avail.
Okay, so I remember messing around with scripts like this in the past, and that 'water bloop effect' is happening, because something is being spawned on top of the water, and the water is 'eating' it.

So, what I assume is happening on Linux, is that it's attempting to add 'nil' onto the water.. and something somewhere isn't allowing the water to eat it, and is instead allowing the 'nil' object to remain.

To fix this, we should be able to just stop the script from creating nil on that tile.

So in the table, we will use itemId = 0 as a 'no item' check.
and on line 78 we will add the check.

Hopefully that fixes your issue.

Lua:
local config = {
    bridgePositions = {
        {position = Position(32099, 32205, 8), groundId = 9022, itemId = 4645},
        {position = Position(32100, 32205, 8), groundId = 4616, itemId = 0},
        {position = Position(32101, 32205, 8), groundId = 9022, itemId = 4647}
    },
    leverPositions = {
        Position(32098, 32204, 8),
        Position(32104, 32204, 8)
    },
    relocatePosition = Position(32102, 32205, 8),
    relocateMonsterPosition = Position(32103, 32205, 8),
    bridgeId = 5770
}

function moveToPosition(self, toPosition, pushMove, monsterPosition)
    if self:getPosition() == toPosition then
        return false
    end
    
    if not Tile(toPosition) then
        return false
    end
    
    for i = self:getThingCount() - 1, 0, -1 do
        local thing = self:getThing(i)
        if thing then
            if thing:isItem() then
                if thing:getId() ~= config.bridgeId then
                    thing:moveTo(toPosition)
                end
            elseif thing:isCreature() then
                if monsterPosition and thing:isMonster() then
                    thing:teleportTo(monsterPosition, pushMove)
                else
                    thing:teleportTo(toPosition, pushMove)
                end
            end
        end
    end
    return true
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local leverLeft, lever = item.itemid == 1945
    for i = 1, #config.leverPositions do
        lever = Tile(config.leverPositions[i]):getItemById(leverLeft and 1945 or 1946)
        if lever then
            lever:transform(leverLeft and 1946 or 1945)
        end
    end
    
    local tile, tmpItem, bridge
    if leverLeft then
        for i = 1, #config.bridgePositions do
            bridge = config.bridgePositions[i]
            tile = Tile(bridge.position)
    
            tmpItem = tile:getGround()
            if tmpItem then
                tmpItem:transform(config.bridgeId)
            end
    
            if bridge.itemId then
                tmpItem = tile:getItemById(bridge.itemId)
                if tmpItem then
                    tmpItem:remove()
                end
            end
        end
    else
        for i = 1, #config.bridgePositions do
            bridge = config.bridgePositions[i]
            tile = Tile(bridge.position)
    
            moveToPosition(tile, config.relocatePosition, true, config.relocateMonsterPosition)
            tile:getGround():transform(bridge.groundId)
            if bridge.itemId > 0 then
                Game.createItem(bridge.itemId, 1, bridge.position)
            end
        end
    
    end
    return true
end
 
Solution
Back
Top