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

Kind Regards
 
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
				setConditionParam(exhaust, CONDITION_PARAM_TICKS, 500)

local doorpos = {x = 1220, y = 579, z = 11}
 
function onUse(player, item, fromPosition, itemEx, toPosition)
	if(item.actionid == 999) then
		if getCreatureCondition(player, CONDITION_EXHAUST) == TRUE then
			local pos = player:getPosition()
			pos:sendMagicEffect(CONST_ME_POFF)
			player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
			return true
		else
			if(item.itemid == 1946) then
				doRelocate(doorpos, {x = 1221, y = 579, z = 11})
				doTransformItem(getTileItemById(doorpos, 5109).uid, 5108)
				doTransformItem(item.uid, 1945)
			elseif(item.itemid == 1945) then
				doTransformItem(getTileItemById(doorpos, 5108).uid, 5109)
				doTransformItem(item.uid, 1946)
			end
		end
		doAddCondition(player, exhaust)
	end
	return true
end

Can't take credit for this, just pulled from datapack.

Looks like it should work fine.
 
Last edited:
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
                setConditionParam(exhaust, CONDITION_PARAM_TICKS, 500)

local doorpos = {x = 1220, y = 579, z = 11}

function onUse(player, item, fromPosition, itemEx, toPosition)
    if(item.actionid == 999) then
        if getCreatureCondition(player, CONDITION_EXHAUST) == TRUE then
            local pos = player:getPosition()
            pos:sendMagicEffect(CONST_ME_POFF)
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
            return true
        else
            if(item.itemid == 1946) then
                doRelocate(doorpos, {x = 1221, y = 579, z = 11})
                doTransformItem(getTileItemById(doorpos, 5109).uid, 5108)
                doTransformItem(item.uid, 1945)
            elseif(item.itemid == 1945) then
                doTransformItem(getTileItemById(doorpos, 5108).uid, 5109)
                doTransformItem(item.uid, 1946)
            end
        end
        doAddCondition(player, exhaust)
    end
    return true
end

Can't take credit for this, just pulled from datapack.

Looks like it should work fine.

Thanks alot mate worked smooth, just changed item.actionid==999 to item.uid, change doorpos ids =))
 
I found this very useful. Thanks. How do i get it to resett after so the next person to come doesnt find the door open?

My first thought was to add another door with the reversed action. So when i pull the lever to open the first door the second one closes. Then have the same lever on the other side wich closes the door and open the new one. howerver i cant get it to work.

Script: test 1 = fail
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 500)

local doorpos = {x = 1461, y = 998, z = 8}

function onUse(player, item, fromPosition, itemEx, toPosition)
if(item.actionid == 999) then
if getCreatureCondition(player, CONDITION_EXHAUST) == TRUE then
local pos = player:getPosition()
pos:sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
return true
else
if(item.itemid == 1946) then
doRelocate(doorpos, {x = 1461, y = 998, z = 8})
doTransformItem(getTileItemById(doorpos, 1222).uid, 1221)
doTransformItem(item.uid, 1945)

doRelocate(doorpos, {x = 1461, y = 994, z = 8})
doTransformItem(getTileItemById(doorpos, 1221).uid, 1222)
doTransformItem(item.uid, 1945)


elseif(item.itemid == 1945) then
doTransformItem(getTileItemById(doorpos, 1221).uid, 1222)
doTransformItem(item.uid, 1946)

end
end
doAddCondition(player, exhaust)
end
return true
end

Script test 2 = fail
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 500)

local doorpos = {x = 1461, y = 998, z = 8}


function onUse(player, item, fromPosition, itemEx, toPosition)
if(item.actionid == 999) then
if getCreatureCondition(player, CONDITION_EXHAUST) == TRUE then
local pos = player:getPosition()
pos:sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
return true
else
if(item.itemid == 1946) then
doRelocate(doorpos, {x = 1462, y = 998, z = 8})
doTransformItem(getTileItemById(doorpos, 1222).uid, 1221)
doTransformItem(item.uid, 1945)


elseif(item.itemid == 1945) then
doTransformItem(getTileItemById(doorpos, 1221).uid, 1222)
doTransformItem(item.uid, 1946)

end
end
doAddCondition(player, exhaust)
end
return true

end

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 500)

local doorpos = {x = 1461, y = 994, z = 8}


function onUse(player, item, fromPosition, itemEx, toPosition)
if(item.actionid == 999) then
if getCreatureCondition(player, CONDITION_EXHAUST) == TRUE then
local pos = player:getPosition()
pos:sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
return true
else
if(item.itemid == 1946) then
doRelocate(doorpos, {x = 1462, y = 994, z = 8})
doTransformItem(getTileItemById(doorpos, 1221).uid, 1222)
doTransformItem(item.uid, 1945)

elseif(item.itemid == 1945) then
doTransformItem(getTileItemById(doorpos, 1222).uid, 1221)
doTransformItem(item.uid, 1946)
end

end
doAddCondition(player, exhaust)
end
return true
end
 
Back
Top