Terotrificy
Veteran OT User
Hi, i realized that doors should work in this way:
1. If you have a closed locked door and you use the right key, it unlocks and open.
2. If you have a closed unlocked door and you use the right key, it locks the door and remains closed (obviously).
3. If you have a opened door and you use the right key, it close the door and locks the door, all in one action.
So far, the point 3 is not working, when you have a opened door and you try to lock it with the key, it says "you cannot use this object". It is worth noting that you shouldn't be able to lock and close the door with the key if there is a creature, player or item in the door, you can only "lock" the door if there is nothing on it.
It seems that when you use the key, you're not hitting the door, instead you're hitting the ground or items that are in the same sqm than the door.
Here is the code of the key.lua action:
I know Xikini solved it for his distro some time ago, but i've been struggling with this issue for a while in Othire.
1. If you have a closed locked door and you use the right key, it unlocks and open.
2. If you have a closed unlocked door and you use the right key, it locks the door and remains closed (obviously).
3. If you have a opened door and you use the right key, it close the door and locks the door, all in one action.
So far, the point 3 is not working, when you have a opened door and you try to lock it with the key, it says "you cannot use this object". It is worth noting that you shouldn't be able to lock and close the door with the key if there is a creature, player or item in the door, you can only "lock" the door if there is nothing on it.
It seems that when you use the key, you're not hitting the door, instead you're hitting the ground or items that are in the same sqm than the door.
Here is the code of the key.lua action:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if (item.actionid == 0 or
(isInArray(LOCKED_DOORS, itemEx.itemid) == false and
isInArray(LOCKED_DOORS, itemEx.itemid-1) == false and
isInArray(LOCKED_DOORS, itemEx.itemid-2) == false)) then
return false
end
local canOpen = (item.actionid == 10000 or item.actionid == itemEx.actionid)
if not(canOpen) then
doPlayerSendCancel(cid, "The key does not match.")
return true
end
-- Verify if you are opening or closing the door
if isInArray(LOCKED_DOORS, itemEx.itemid) == true then -- Opening
doTransformItem(itemEx.uid, itemEx.itemid+2)
elseif isInArray(LOCKED_DOORS, itemEx.itemid-2) == true then -- Closing and Locking
doTransformItem(itemEx.uid, itemEx.itemid-2)
else
doTransformItem(itemEx.uid, itemEx.itemid-1) -- Locking an already closed door
end
doSetItemActionId(itemEx.uid, itemEx.actionid)
return true
end
I know Xikini solved it for his distro some time ago, but i've been struggling with this issue for a while in Othire.