• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Stairs fix

Itutorial

Legendary OT User
Joined
Dec 23, 2014
Messages
2,339
Solutions
68
Reaction score
1,024
I noticed there are a lot of stairs that don't work in TFS. Usually they are facing south, or just a whole stair type in general. So I made this script to make them act like normal stairs.

It is pretty simple to understand, you just put the item id's of the stairs that when you walk on them should put you upstairs. Then, make sure the that item id is put in the correct array for which way the stair is facing.

Here is the code.

Code:
local stairs_north = {18234, 3685} -- add stairs that should move you north and up a floor
local stairs_south = {3683} -- add stairs that should move you south and up a floor
local stairs_east = {3679} -- east & up a floor
local stairs_west = {3681} -- west & up a floor




function onStepIn(creature, item, position, fromPosition)
player = Player(creature)

if not player then
creature:teleportTo(fromPosition)
return true
end

if fromPosition.z < position.z then return true end

    local north = {x = position.x, y = position.y - 1, z = position.z - 1}
    local south = {x = position.x, y = position.y + 1, z = position.z - 1}
    local east = {x = position.x + 1, y = position.y, z = position.z - 1}
    local west = {x = position.x - 1, y = position.y, z = position.z - 1}

    if isInArray(stairs_north, item.itemid) then
        player:teleportTo(north)
    elseif isInArray(stairs_south, item.itemid) then
        player:teleportTo(south)
    elseif isInArray(stairs_east, item.itemid) then
        player:teleportTo(east)
    elseif isInArray(stairs_west, item.itemid) then
        player:teleportTo(west)
    end
    return true
end

If enough people benefit from this I will take the time to put all stair id's that I find that don't work and will add them in for everyone.
 
Code:
local stairs = {
    -- North
    [{18234, 3685}] = function(pos) return Position(pos.x, pos.y-1, pos.z-1) end,
    -- East
    [{3679}] = function(pos) return Position(pos.x+1, pos.y, pos.z-1) end,
    -- South
    [{3683}] = function(pos) return Position(pos.x, pos.y+1, pos.z-1) end,
    -- West
    [{3681}] = function(pos) return Position(pos.x-1, pos.y, pos.z-1) end
}

function onStepIn(creature, item, position, fromPosition)
    if not creature:isPlayer() then
        creature:teleportTo(fromPosition)
        return true
    end
    for k, v in pairs(stairs) do
        if isInArray(k, item.itemid) then
            local newPos = v(position)
            if Tile(newPos) then
                creature:teleportTo(newPos)
                break
            end
        end
    end
    return true
end
use this :)
edit: you dont even actually need this script cause you can use
<attribute key="floorchange" value="north/east/south/west" />
but the script should still work the same :|
 
Last edited:
Back
Top