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

Block Stairs

yoiker

Member
Joined
Jan 21, 2012
Messages
194
Solutions
1
Reaction score
9
Thank you in advance for taking the time to read this post. Perhaps most prefer the opposite of what I want in this case.

I would like that when using the ladder if there is a magic wall or wild growth rune up blocking the step where it will fall the function will not be executed.

Important: if one of the magic wall rune or wild growth rune disappears, they can use the ladder.

Code:
local upFloorIds = {1386, 3678, 5543, 22845, 22846}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local tile = item:getTile()
    if tile and tile:hasFlag(TILESTATE_PROTECTIONZONE) and player:isPzLocked() then
        return false
    end

    if isInArray(upFloorIds, item.itemid) then
        fromPosition:moveUpstairs()
    else
        fromPosition.z = fromPosition.z + 1
    end
    player:teleportTo(fromPosition, false)
    return true
end

SOLVED!
 
Last edited:
Thank you in advance for taking the time to read this post. Perhaps most prefer the opposite of what I want in this case.

I would like that when using the ladder if there is a magic wall or wild growth rune up blocking the step where it will fall the function will not be executed.

Important: if one of the magic wall rune or wild growth rune disappears, they can use the ladder.

Code:
local upFloorIds = {1386, 3678, 5543, 22845, 22846}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local tile = item:getTile()
    if tile and tile:hasFlag(TILESTATE_PROTECTIONZONE) and player:isPzLocked() then
        return false
    end

    if isInArray(upFloorIds, item.itemid) then
        fromPosition:moveUpstairs()
    else
        fromPosition.z = fromPosition.z + 1
    end
    player:teleportTo(fromPosition, false)
    return true
end

Try this one, let me know how it goes.
Lua:
local upFloorIds = {1386, 3678, 5543, 22845, 22846}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = item:getTile()
    if tile and tile:hasFlag(TILESTATE_PROTECTIONZONE) and player:isPzLocked() then
        return false
    end

    if isInArray(upFloorIds, item.itemid) then
        fromPosition:moveUpstairs()
    else
        fromPosition.z = fromPosition.z + 1
    end

    if isInArray(upFloorIds, item.itemid) then
        if Tile(fromPosition):hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID) then
            return player:sendCancelMessage('The path is blocked.')
        end
    end
  
    player:teleportTo(fromPosition, false)
    return true
end
 
Try this one, let me know how it goes.
Lua:
local upFloorIds = {1386, 3678, 5543, 22845, 22846}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = item:getTile()
    if tile and tile:hasFlag(TILESTATE_PROTECTIONZONE) and player:isPzLocked() then
        return false
    end

    if isInArray(upFloorIds, item.itemid) then
        fromPosition:moveUpstairs()
    else
        fromPosition.z = fromPosition.z + 1
    end

    if isInArray(upFloorIds, item.itemid) then
        if Tile(fromPosition):hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID) then
            return player:sendCancelMessage('The path is blocked.')
        end
    end
 
    player:teleportTo(fromPosition, false)
    return true
end

They helped me solve it yesterday, but thank you very much :D
 
Back
Top