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

Doors

Jfrye

Mapper, trying to learn scripting
Joined
Jan 8, 2009
Messages
365
Solutions
5
Reaction score
86
Location
Mexico Missouri
I am using TFS1.1 client 10.77. I have the quest that gives x key. x key opens the door, but once the door is open, you can not use the key to shut the door. The message pops up that the key does not match.

But you can close the door normally without the key but it will automatically lock.

To recap, I have a quest that gives the key and opens the door, so that is not an issue. I just cant figure out how to shut the door with they key, due to the message.
 
I am using TFS1.1 client 10.77. I have the quest that gives x key. x key opens the door, but once the door is open, you can not use the key to shut the door. The message pops up that the key does not match.

But you can close the door normally without the key but it will automatically lock.

To recap, I have a quest that gives the key and opens the door, so that is not an issue. I just cant figure out how to shut the door with they key, due to the message.
same problem over here
This is not a complex issue, doors that use keys normally have an action id associated with it, the way it works when we use keys on a door the door is transformed into a new object or sprite rather that allows us to walk through, if you would like to use that key again to transform or close the door then you will have to assign that particular open door the same action id and reverse the process..
 
suggesting I should open it in RME and assign the open door the same action id?
No I am suggesting that you edit the script for doors in actions and check for what item.uid it is for that door, you could use the map editor to help you identify the sprite, then when it transforms the door to its open counterpart that you assign the open door an action id, the same action id required to use the key on the close door.
 
The doors.lua im using
Lua:
function onUse(player, item, fromPosition, target, toPosition)
    local itemId = item:getId()
    if isInArray(questDoors, itemId) then
        if player:getStorageValue(item.actionid) ~= -1 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
        end
        return true
    elseif isInArray(levelDoors, itemId) then
        if item.actionid > 0 and player:getLevel() >= item.actionid - 1000 then
            item:transform(itemId + 1)
            player:teleportTo(toPosition, true)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "Only the worthy may pass.")
        end
        return true
    elseif 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 then
            item:transform(doors[itemId])
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is locked.")
        end
        return true
    end
    return false
end
thanks.. im very tired atm its 4.20am over here
 
Back
Top