• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Level door tfs 1.2 question

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
1,067
Solutions
5
Reaction score
63
Hello,
so as far as i know to make level door you have to set actionid to 1050 which means you can enter door with level 50 only and above, so i found this Itutorial doors on steroids
LUA:
local questDoors = {
    [1000] = {questValues = {5, 6}}
}
local vocationDoors = {
    [1000] = {vocs = {1, 2, 3, 4}}
}
local levelDoors = {
    [1000] = {levelMin = 50, levelMax = nil}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local itemId = item:getId()
    local voc = vocationDoors(item:getActionId())
    local level = levelDoors(item:getActionId())
    local questDoor = questDoors(item:getActionId())
   
    -- VOCATION DOORS --
    if voc and not isInArray(voc.vocs, player:getVocation():getId()) then
        local text = "Only "
            for i = 1, #voc.vocs do
                local VOC = Vocation(voc.vocs[i])
                if VOC then
                    text = text..""..VOC:getName()..", "
                end
            end
            text = text.." can enter here."
        return player:sendTextMessage(MESSAGE_INFO_DESCR, text)
    end
   
    -- LEVEL DOORS --
    if level then
        if level.levelMax ~= nil then
            return player:sendTextMessage(MESSAGE_INFO_DESCR, "Only levels "..level.levelMin.." - "..level.levelMax.." can enter here.")
        else
            return player:sendTextMessage(MESSAGE_INFO_DESCR, "Only levels "..level.levelMin.." and higher can enter here.")
        end
    end
   
    -- QUEST DOORS --
    if isInArray(questDoors, itemId) then
        local quest = questDoors[item:getActionId()]
            if not quest then return player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.") end
           
            if player:getStorageValue(item:getActionId()) ~= nil and isInArray(quest.questValues, player:getStorageValue(item:getActionId())) then
                item:transform(itemId + 1)
                player:teleportTo(toPosition, true)
            else
                return player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
            end
    end
   
    if isInArray(keys, itemId) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.itemid] then
                target:transform(doors[target.itemid])
                return true
            end
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            return true
        end
        return false
    end
   
    if isInArray(horizontalOpenDoors, itemId) or isInArray(verticalOpenDoors, itemId) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature ~= nil then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end
            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, query)
                return true
            end
            doorCreature:teleportTo(toPosition, true)
        end
        if not isInArray(openSpecialDoors, itemId) then
            item:transform(itemId - 1)
        end
        return true
    end
    if doors[itemId] then
        if item.actionid == 0 or voc or level or questDoor then
            item:transform(doors[itemId])
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
        return true
    end
    return false
end
So my question is
local levelDoors = {
[1000] = {levelMin = 50, levelMax = nil}
}
is that 1000 is actionid? Just to make sure
 
Solution
Sorry, made a mistake:

LUA:
local custom_doors = {16715} -- add any doors that do not open here

local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            if...
Yeah it seems like the idea was for 1000 to be action id and you can manipulate the min and max within the array. Although unless there is another function called levelDoors that is not included in this there will most likely have errors. If I'm right in saying this you should try changing lines 12-14 to this:

LUA:
    local voc = vocationDoors[item:getActionId()]
    local level = levelDoors[item:getActionId()]
    local questDoor = questDoors[item:getActionId()]
 
Yeah it seems like the idea was for 1000 to be action id and you can manipulate the min and max within the array. Although unless there is another function called levelDoors that is not included in this there will most likely have errors. If I'm right in saying this you should try changing lines 12-14 to this:

LUA:
    local voc = vocationDoors[item:getActionId()]
    local level = levelDoors[item:getActionId()]
    local questDoor = questDoors[item:getActionId()]
Yea you are right its actionid. It looks like it a bug in this system so
LUA:
local levelDoors = {
    [200] = {levelMin = 200, levelMax = nil}
}
created doors with actionid 200 added 200lvl requirement it says that you need 200lvl so its okay but i created vocation with 400 lvl it still says that i need 200lvl, same with GOD.
 
Yea you are right its actionid. It looks like it a bug in this system so
LUA:
local levelDoors = {
    [200] = {levelMin = 200, levelMax = nil}
}
created doors with actionid 200 added 200lvl requirement it says that you need 200lvl so its okay but i created vocation with 400 lvl it still says that i need 200lvl, same with GOD.
Try this one out:
LUA:
local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            item:transform(item.itemid + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
    elseif vocation_doors[item.actionid] then
        if isInArray(vocation_doors[item.actionid], player:getVocation():getId()) then
            item:transform(item.itemid + 1)
            player:teleportTo(toPosition, true)
        else
            local string = "Only players with vocation "
            for i = 1, #vocation_doors[item.actionid] do
                if not next(vocation_doors[item.actionid], i) then
                    if i == 1 then
                        string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    else
                        string = string .. "or " .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    end
                else
                    string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower() .. ", "
                end
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, string .. " may enter here.")
        end
    elseif level_doors[item.actionid] then
        local level = player:getLevel()
        local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
        if (not min or level >= min) and (not max or level <= max) then
            item:transform(item.itemid + 1)
            player:teleportTo(toPosition, true)
        else
            local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
            local string = "Only players with level "
            string =  string .. (min or 1) .. (max and (' through ' .. max) or (' and above')) .. " may enter here."
            player:sendTextMessage(MESSAGE_INFO_DESCR, string)
        end
    elseif table.contains(keys, item.itemid) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.item.itemid] then
                target:transform(doors[target.item.itemid])
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            end
        end
    elseif table.contains(horizontalOpenDoors, item.itemid) or table.contains(verticalOpenDoors, item.itemid) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(query))
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, item.itemid) then
            item:transform(item.itemid - 1)
        end
    elseif doors[item.itemid] then
        if item.actionid == 0 then
            item:transform(doors[item.itemid])
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
    end
    return true
end

Also quest doors will still get stopped by quest_doors StepIn movement script and you can fix it by changing it to this, keep in mind you'll have to update the array everything you change it in the original doors.lua:
LUA:
local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

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

    if quest_doors[item.actionid] then
        if not isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            creature:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
            creature:teleportTo(fromPosition, true)
            return false
        end
    end
    return true
end
 
Try this one out:
LUA:
local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            item:transform(item.itemid + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
    elseif vocation_doors[item.actionid] then
        if isInArray(vocation_doors[item.actionid], player:getVocation():getId()) then
            item:transform(item.itemid + 1)
            player:teleportTo(toPosition, true)
        else
            local string = "Only players with vocation "
            for i = 1, #vocation_doors[item.actionid] do
                if not next(vocation_doors[item.actionid], i) then
                    if i == 1 then
                        string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    else
                        string = string .. "or " .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    end
                else
                    string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower() .. ", "
                end
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, string .. " may enter here.")
        end
    elseif level_doors[item.actionid] then
        local level = player:getLevel()
        local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
        if (not min or level >= min) and (not max or level <= max) then
            item:transform(item.itemid + 1)
            player:teleportTo(toPosition, true)
        else
            local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
            local string = "Only players with level "
            string =  string .. (min or 1) .. (max and (' through ' .. max) or (' and above')) .. " may enter here."
            player:sendTextMessage(MESSAGE_INFO_DESCR, string)
        end
    elseif table.contains(keys, item.itemid) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.item.itemid] then
                target:transform(doors[target.item.itemid])
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            end
        end
    elseif table.contains(horizontalOpenDoors, item.itemid) or table.contains(verticalOpenDoors, item.itemid) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(query))
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, item.itemid) then
            item:transform(item.itemid - 1)
        end
    elseif doors[item.itemid] then
        if item.actionid == 0 then
            item:transform(doors[item.itemid])
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
    end
    return true
end

Also quest doors will still get stopped by quest_doors StepIn movement script and you can fix it by changing it to this, keep in mind you'll have to update the array everything you change it in the original doors.lua:
LUA:
local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

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

    if quest_doors[item.actionid] then
        if not isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            creature:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
            creature:teleportTo(fromPosition, true)
            return false
        end
    end
    return true
end
Okay so it works but i have a weird problems and i cant find solution so when you open door it turns whole sprite to east so it looks like this
35731
So i though there is decay stuff like fromid toid but i couldnt find anything that can turn this sprite all i found is only action itemid which have nothing to do with turning sprite
<action itemid="16715" script="other/doors.lua" />
thats the only stuff i found from my whole data files. 16715 is front door. So i dont know it doesnt make sense to me where is the problem, do you have any ideas?
 
If it helps you, here is an easy way to do a defined level range using the unique value of the doors.
minimum level with ActionId
maximum level with UniqueId

Example: only levels 100 to 200 can enter here.
ActionId: 1100
UniqueId: 1200

Code:
elseif isInArray(levelDoors, itemId) then
    local uniqueId = item:getUniqueId()
    if item.actionid > 0 then
        local level = player:getLevel()
        local minlvl = item.actionid -1000
        local maxlvl = uniqueId > 0 and uniqueId -1000 or math.huge
        if level >= minlvl and level <= maxlvl then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            if maxlvl == math.huge then
                player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Only levels %u and higher can enter here.", minlvl))
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Only levels %u to %u can enter here.", minlvl, maxlvl))
            end
        end
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
    end
return true
 
If it helps you, here is an easy way to do a defined level range using the unique value of the doors.
minimum level with ActionId
maximum level with UniqueId

Example: only levels 100 to 200 can enter here.
ActionId: 1100
UniqueId: 1200

Code:
elseif isInArray(levelDoors, itemId) then
    local uniqueId = item:getUniqueId()
    if item.actionid > 0 then
        local level = player:getLevel()
        local minlvl = item.actionid -1000
        local maxlvl = uniqueId > 0 and uniqueId -1000 or math.huge
        if level >= minlvl and level <= maxlvl then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            if maxlvl == math.huge then
                player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Only levels %u and higher can enter here.", minlvl))
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Only levels %u to %u can enter here.", minlvl, maxlvl))
            end
        end
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
    end
return true
I think i would keep Apollos version but if there is performance difference then yea between your version and Apollos then it would be worth changing it. Anyway it looks like it transforms into another sprite because of item:transform(item.itemid + 1) so after i use door it adds one sprite so 16715+1. So i think i need to remove those item:transform(item.itemid + 1) completely from the code but then i dont know how to teleport player 2 steps instead of one step i tried editing those toPosition.x/y/z to +2 but didnt worked
 
I think i would keep Apollos version but if there is performance difference then yea between your version and Apollos then it would be worth changing it. Anyway it looks like it transforms into another sprite because of item:transform(item.itemid + 1) so after i use door it adds one sprite so 16715+1. So i think i need to remove those item:transform(item.itemid + 1) completely from the code but then i dont know how to teleport player 2 steps instead of one step i tried editing those toPosition.x/y/z to +2 but didnt worked
ID 16715 is not a typical door id, usually doors and their open version are only 1 id away from eachother. So you'll have to include it in an array to find it's open version. You can try this:
LUA:
local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            if doors[item.itemid] then
                item:transform(doors[item.itemid])
            else
                item:transform(item.itemid + 1)
            end
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
    elseif vocation_doors[item.actionid] then
        if isInArray(vocation_doors[item.actionid], player:getVocation():getId()) then
            if doors[item.itemid] then
                item:transform(doors[item.itemid])
            else
                item:transform(item.itemid + 1)
            end
            player:teleportTo(toPosition, true)
        else
            local string = "Only players with vocation "
            for i = 1, #vocation_doors[item.actionid] do
                if not next(vocation_doors[item.actionid], i) then
                    if i == 1 then
                        string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    else
                        string = string .. "or " .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    end
                else
                    string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower() .. ", "
                end
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, string .. " may enter here.")
        end
    elseif level_doors[item.actionid] then
        local level = player:getLevel()
        local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
        if (not min or level >= min) and (not max or level <= max) then
            if doors[item.itemid] then
                item:transform(doors[item.itemid])
            else
                item:transform(item.itemid + 1)
            end
            player:teleportTo(toPosition, true)
        else
            local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
            local string = "Only players with level "
            string =  string .. (min or 1) .. (max and (' through ' .. max) or (' and above')) .. " may enter here."
            player:sendTextMessage(MESSAGE_INFO_DESCR, string)
        end
    elseif table.contains(keys, item.itemid) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.item.itemid] then
                if doors[item.itemid] then
                    item:transform(doors[item.itemid])
                else
                    item:transform(item.itemid + 1)
                end
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            end
        end
    elseif table.contains(horizontalOpenDoors, item.itemid) or table.contains(verticalOpenDoors, item.itemid) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(query))
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, item.itemid) then
            item:transform(item.itemid - 1)
        end
    elseif doors[item.itemid] then
        if item.actionid == 0 then
            if doors[item.itemid] then
                item:transform(doors[item.itemid])
            else
                item:transform(item.itemid + 1)
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
    end
    return true
end

If this does not work show me what your doors, verticalOpenDoors, horizontalOpenDoors, openSpecialDoors, questDoors, and levelDoors arrays look like in global.lua. Also let me know what id 16715 is supposed to turn into when opened.
 
ID 16715 is not a typical door id, usually doors and their open version are only 1 id away from eachother. So you'll have to include it in an array to find it's open version. You can try this:
LUA:
local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            if doors[item.itemid] then
                item:transform(doors[item.itemid])
            else
                item:transform(item.itemid + 1)
            end
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
    elseif vocation_doors[item.actionid] then
        if isInArray(vocation_doors[item.actionid], player:getVocation():getId()) then
            if doors[item.itemid] then
                item:transform(doors[item.itemid])
            else
                item:transform(item.itemid + 1)
            end
            player:teleportTo(toPosition, true)
        else
            local string = "Only players with vocation "
            for i = 1, #vocation_doors[item.actionid] do
                if not next(vocation_doors[item.actionid], i) then
                    if i == 1 then
                        string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    else
                        string = string .. "or " .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    end
                else
                    string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower() .. ", "
                end
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, string .. " may enter here.")
        end
    elseif level_doors[item.actionid] then
        local level = player:getLevel()
        local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
        if (not min or level >= min) and (not max or level <= max) then
            if doors[item.itemid] then
                item:transform(doors[item.itemid])
            else
                item:transform(item.itemid + 1)
            end
            player:teleportTo(toPosition, true)
        else
            local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
            local string = "Only players with level "
            string =  string .. (min or 1) .. (max and (' through ' .. max) or (' and above')) .. " may enter here."
            player:sendTextMessage(MESSAGE_INFO_DESCR, string)
        end
    elseif table.contains(keys, item.itemid) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.item.itemid] then
                if doors[item.itemid] then
                    item:transform(doors[item.itemid])
                else
                    item:transform(item.itemid + 1)
                end
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            end
        end
    elseif table.contains(horizontalOpenDoors, item.itemid) or table.contains(verticalOpenDoors, item.itemid) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(query))
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, item.itemid) then
            item:transform(item.itemid - 1)
        end
    elseif doors[item.itemid] then
        if item.actionid == 0 then
            if doors[item.itemid] then
                item:transform(doors[item.itemid])
            else
                item:transform(item.itemid + 1)
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
    end
    return true
end

If this does not work show me what your doors, verticalOpenDoors, horizontalOpenDoors, openSpecialDoors, questDoors, and levelDoors arrays look like in global.lua. Also let me know what id 16715 is supposed to turn into when opened.
Same. It should not turn into any other id specific 16715 since its custome sprite it should work like this
35732
after use it should teleport behind that door and do not turn into different door should be the same door the whole time. Thats why i said maybe i need to remove item:transform(item.itemid + 1) but i don't think removing stuff is a good idea.
 
Same. It should not turn into any other id specific 16715 since its custome sprite it should work like this
View attachment 35732
after use it should teleport behind that door and do not turn into different door should be the same door the whole time. Thats why i said maybe i need to remove item:transform(item.itemid + 1) but i don't think removing stuff is a good idea.
Add this in data/lib/core/position.lua:
LUA:
function Position:getDirectionTo(toPosition)
    local dir = NORTH
    if(self.x > toPosition.x) then
        dir = WEST
        if(self.y > toPosition.y) then
            dir = NORTHWEST
        elseif(self.y < toPosition.y) then
            dir = SOUTHWEST
        end
    elseif(self.x < toPosition.x) then
        dir = EAST
        if(self.y > toPosition.y) then
            dir = NORTHEAST
        elseif(self.y < toPosition.y) then
            dir = SOUTHEAST
        end
    else
        if(self.y > toPosition.y) then
            dir = NORTH
        elseif(self.y < toPosition.y) then
            dir = SOUTH
        end
    end
    return dir
end
Then try this:
LUA:
local custom_doors = {16715} -- add any doors that do not open here

local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            if isInArray(item.itemid, custom_doors) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
    elseif vocation_doors[item.actionid] then
        if isInArray(vocation_doors[item.actionid], player:getVocation():getId()) then
            if isInArray(item.itemid, custom_doors) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            local string = "Only players with vocation "
            for i = 1, #vocation_doors[item.actionid] do
                if not next(vocation_doors[item.actionid], i) then
                    if i == 1 then
                        string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    else
                        string = string .. "or " .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    end
                else
                    string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower() .. ", "
                end
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, string .. " may enter here.")
        end
    elseif level_doors[item.actionid] then
        local level = player:getLevel()
        local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
        if (not min or level >= min) and (not max or level <= max) then
            if isInArray(item.itemid, custom_doors) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
            local string = "Only players with level "
            string =  string .. (min or 1) .. (max and (' through ' .. max) or (' and above')) .. " may enter here."
            player:sendTextMessage(MESSAGE_INFO_DESCR, string)
        end
    elseif table.contains(keys, item.itemid) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.item.itemid] then
                target:transform(doors[target.item.itemid])
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            end
        end
    elseif table.contains(horizontalOpenDoors, item.itemid) or table.contains(verticalOpenDoors, item.itemid) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(query))
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, item.itemid) then
            item:transform(item.itemid - 1)
        end
    elseif doors[item.itemid] then
        if item.actionid == 0 then
            if isInArray(item.itemid, custom_doors) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(doors[item.itemid])
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
    end
    return true
end
 
Add this in data/lib/core/position.lua:
LUA:
function Position:getDirectionTo(toPosition)
    local dir = NORTH
    if(self.x > toPosition.x) then
        dir = WEST
        if(self.y > toPosition.y) then
            dir = NORTHWEST
        elseif(self.y < toPosition.y) then
            dir = SOUTHWEST
        end
    elseif(self.x < toPosition.x) then
        dir = EAST
        if(self.y > toPosition.y) then
            dir = NORTHEAST
        elseif(self.y < toPosition.y) then
            dir = SOUTHEAST
        end
    else
        if(self.y > toPosition.y) then
            dir = NORTH
        elseif(self.y < toPosition.y) then
            dir = SOUTH
        end
    end
    return dir
end
Then try this:
LUA:
local custom_doors = {16715} -- add any doors that do not open here

local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            if isInArray(item.itemid, custom_doors) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
    elseif vocation_doors[item.actionid] then
        if isInArray(vocation_doors[item.actionid], player:getVocation():getId()) then
            if isInArray(item.itemid, custom_doors) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            local string = "Only players with vocation "
            for i = 1, #vocation_doors[item.actionid] do
                if not next(vocation_doors[item.actionid], i) then
                    if i == 1 then
                        string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    else
                        string = string .. "or " .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    end
                else
                    string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower() .. ", "
                end
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, string .. " may enter here.")
        end
    elseif level_doors[item.actionid] then
        local level = player:getLevel()
        local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
        if (not min or level >= min) and (not max or level <= max) then
            if isInArray(item.itemid, custom_doors) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
            local string = "Only players with level "
            string =  string .. (min or 1) .. (max and (' through ' .. max) or (' and above')) .. " may enter here."
            player:sendTextMessage(MESSAGE_INFO_DESCR, string)
        end
    elseif table.contains(keys, item.itemid) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.item.itemid] then
                target:transform(doors[target.item.itemid])
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            end
        end
    elseif table.contains(horizontalOpenDoors, item.itemid) or table.contains(verticalOpenDoors, item.itemid) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(query))
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, item.itemid) then
            item:transform(item.itemid - 1)
        end
    elseif doors[item.itemid] then
        if item.actionid == 0 then
            if isInArray(item.itemid, custom_doors) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(doors[item.itemid])
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
    end
    return true
end
Same
 
Sorry, made a mistake:

LUA:
local custom_doors = {16715} -- add any doors that do not open here

local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            if isInArray(custom_doors, item.itemid) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
    elseif vocation_doors[item.actionid] then
        if isInArray(vocation_doors[item.actionid], player:getVocation():getId()) then
            if isInArray(custom_doors, item.itemid) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            local string = "Only players with vocation "
            for i = 1, #vocation_doors[item.actionid] do
                if not next(vocation_doors[item.actionid], i) then
                    if i == 1 then
                        string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    else
                        string = string .. "or " .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    end
                else
                    string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower() .. ", "
                end
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, string .. " may enter here.")
        end
    elseif level_doors[item.actionid] then
        local level = player:getLevel()
        local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
        if (not min or level >= min) and (not max or level <= max) then
            if isInArray(custom_doors, item.itemid) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
            local string = "Only players with level "
            string =  string .. (min or 1) .. (max and (' through ' .. max) or (' and above')) .. " may enter here."
            player:sendTextMessage(MESSAGE_INFO_DESCR, string)
        end
    elseif table.contains(keys, item.itemid) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.item.itemid] then
                target:transform(doors[target.item.itemid])
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            end
        end
    elseif table.contains(horizontalOpenDoors, item.itemid) or table.contains(verticalOpenDoors, item.itemid) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(query))
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, item.itemid) then
            item:transform(item.itemid - 1)
        end
    elseif doors[item.itemid] then
        if item.actionid == 0 then
            if isInArray(custom_doors, item.itemid) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(doors[item.itemid])
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
    end
    return true
end

If there's other door id's you want to have players teleport straight through then just add the id to custom_doors array.
 
Solution
Sorry, made a mistake:

LUA:
local custom_doors = {16715} -- add any doors that do not open here

local quest_doors = {
    [1000] = {key = 9000, values = {5, 6}}, -- key = key for quest storage, values = values of storage that can open door
}

local vocation_doors = {
    [1001] = {4, 8}, -- voc id's required to use door, must include promoted vocs
}

local level_doors = {
    [1002] = {min = 8, max = 20}, -- may leave min nil if no min required, may leave max if no max required
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if quest_doors[item.actionid] then
        if isInArray(quest_doors[item.actionid].values, player:getStorageValue(quest_doors[item.actionid].key)) then
            if isInArray(custom_doors, item.itemid) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
    elseif vocation_doors[item.actionid] then
        if isInArray(vocation_doors[item.actionid], player:getVocation():getId()) then
            if isInArray(custom_doors, item.itemid) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            local string = "Only players with vocation "
            for i = 1, #vocation_doors[item.actionid] do
                if not next(vocation_doors[item.actionid], i) then
                    if i == 1 then
                        string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    else
                        string = string .. "or " .. Vocation(vocation_doors[item.actionid][i]):getName():lower()
                    end
                else
                    string = string .. Vocation(vocation_doors[item.actionid][i]):getName():lower() .. ", "
                end
            end
            player:sendTextMessage(MESSAGE_INFO_DESCR, string .. " may enter here.")
        end
    elseif level_doors[item.actionid] then
        local level = player:getLevel()
        local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
        if (not min or level >= min) and (not max or level <= max) then
            if isInArray(custom_doors, item.itemid) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(item.itemid + 1)
                player:teleportTo(toPosition, true)
            end
        else
            local min, max = level_doors[item.actionid].min, level_doors[item.actionid].max
            local string = "Only players with level "
            string =  string .. (min or 1) .. (max and (' through ' .. max) or (' and above')) .. " may enter here."
            player:sendTextMessage(MESSAGE_INFO_DESCR, string)
        end
    elseif table.contains(keys, item.itemid) then
        if target.actionid > 0 then
            if item.actionid == target.actionid and doors[target.item.itemid] then
                target:transform(doors[target.item.itemid])
            else
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.")
            end
        end
    elseif table.contains(horizontalOpenDoors, item.itemid) or table.contains(verticalOpenDoors, item.itemid) then
        local doorCreature = Tile(toPosition):getTopCreature()
        if doorCreature then
            toPosition.x = toPosition.x + 1
            local query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            if query ~= RETURNVALUE_NOERROR then
                toPosition.x = toPosition.x - 1
                toPosition.y = toPosition.y + 1
                query = Tile(toPosition):queryAdd(doorCreature, bit.bor(FLAG_IGNOREBLOCKCREATURE, FLAG_PATHFINDING))
            end

            if query ~= RETURNVALUE_NOERROR then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(query))
            end

            doorCreature:teleportTo(toPosition, true)
        end

        if not table.contains(openSpecialDoors, item.itemid) then
            item:transform(item.itemid - 1)
        end
    elseif doors[item.itemid] then
        if item.actionid == 0 then
            if isInArray(custom_doors, item.itemid) then
                local position = player:getPosition()
                position:getNextPosition(position:getDirectionTo(toPosition), 2)
                player:teleportTo(position, false)
                position:sendMagicEffect(CONST_ME_TELEPORT)
            else
                item:transform(doors[item.itemid])
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
    end
    return true
end

If there's other door id's you want to have players teleport straight through then just add the id to custom_doors array.
Yep works perfectly but there is one mistake that might cause problems in future which is if you are on the middle of door it teleports you two steps which is perfect now if you are on side of door like < it teleports you two steps to the other side so sample of image what might happen
35734

You can go out of the map if that way is narrow
 
Yep works perfectly but there is one mistake that might cause problems in future which is if you are on the middle of door it teleports you two steps which is perfect now if you are on side of door like < it teleports you two steps to the other side so sample of image what might happen
View attachment 35734

You can go out of the map if that way is narrow
You'd have to do two separate arrays for vertical and horizontal doors and make new function that determines teleport position based off that. This question is starting to get far away from what the original request was and I'm sorry I just don't really want to write another version. I think what you should do is make a sprite version of the opened door or map the area in a way that they cannot be diagonal from the door when they click it.

Good luck.
 
Back
Top