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