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

[HELP] Pull Lever Remove Locked Door

Anyjia

KillaBeez
Joined
Jun 10, 2007
Messages
220
Reaction score
37
Location
Sweden
hello, as title say if any kind soul can help me out with a script that if you use a lever, it will remove a locked door and switch it back to a wall when using it again. ( KATANA QUEST IN ROOK ) with unique ID on lever, thanks. Iam Using OThire 7.72

Kind Regards
 
Last edited:
Okay i got it working now. But how can i make so the lever resets the wall? Since now i can switch from wall to door, and then the lever gets stuck and say "Sorry not possible."

Kind Regards
 
Code:
function onUse(cid, item, frompos, item2, topos)
local wallpos = {x=722, y=65, z=12, stackpos=1}
local WALLID = 1444
local DOORID = 1355

   if getThingfromPos(wallpos).itemid == WALLID then
     doTransformItem(WALLID.uid,DOORID)
     doTransformItem(item.uid,item.itemid+1)
   elseif getThingfromPos(wallpos).itemid == DOORID then
     doTransformItem(DOORID.uid,WALLID)
     doTransformItem(item.uid,item.itemid-1)
   else
     doPlayerSendCancel(cid,"Sorry, not possible.")
   end
   return true
end
 
Code:
local config = {
     wall_pos = {x = 11111, y = 11111, z = 11, stackpos = 1}, -- these have the same position
     creature_pos = {x = 11111, y = 11111, z = 11, stackpos = 253}, -- but different stack position
     door_id = 1111,
     wall_id = 1111     
}

function onUse(cid, item, frompos, item2, topos)

     local getThing = getThingfromPos(config.wall_pos)
     local getCreature = getThingfromPos(config.creature_pos)
     
     if item.itemid == 1945 then
         doTransformItem(item.uid, item.itemid + 1)
         doTransformItem(getThing.uid, door_id)
     elseif item.itemid == 1946 then
         doTransformItem(item.uid, item.itemid - 1)
         doTransformItem(getThing.uid, wall_id)
         if isCreature(getCreature.uid) == TRUE then
             doMoveCreature(getCreature.uid, SOUTH)
         end
     end
     return true
end
 
Code:
local c = {
    wall_pos = {x = 11111, y = 11111, z = 11, stackpos = 1}, -- these have the same position
    creature_pos = {x = 11111, y = 11111, z = 11, stackpos = 253}, -- but different stack position
    door_id = 1111,
    wall_id = 1111   
}

function onUse(cid, item, frompos, item2, topos)

    local getThing = getThingfromPos(c.wall_pos).uid
    local getCreature = getThingfromPos(c.creature_pos).uid

    if isInArray({1945, 1946}, item.itemid) then
        doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
        doTransformItem(getThing, item.itemid == 1945 and c.door_id or c.wall_id)

        if item.itemid == 1945 then
            if isCreature(getCreature) == TRUE then
                doMoveCreature(getCreature, SOUTH)
            end
        end
    end
    return true
end
 
Back
Top