function onStepIn(cid, item, pos)
if item.itemid == 4415 and item.aid == 40001 then
if getPlayerStorageValue(cid,40002) == -1 then
setPlayerStorageValue(cid,40002,1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You may now open the door.')
end
return 1
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == 40002 then
if getPlayerStorageValue(cid, 40002) == 1 then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have yet not learned the secrets of this door.")
end
end
return true
end
function onStepOut(cid, item, position, fromPosition)
doTransform(item.uid, item.itemid - 1)
return true
end
function onStepIn(cid, item, position, fromPosition)
if item.itemid == 407 and item.actionid == 40001 then
if getPlayerStorageValue(cid,40002) == -1 then
setPlayerStorageValue(cid,40002,1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You may now open the door.')
end
return 1
end
end
Maybe you're able to do it considering you were able to shorten that script quite alot..
When I walk on the tile I dont get any msg and I still can't open the door.
Though, I'm not getting any errors and made sure I got the ids correct.
OK, I got it working but, after I opened the door and went out like 4 times the door transforms into a gate of expertise. I believe there's something wrong with the "doTransformItem(item.uid, item.itemid + 1)" code, maybe there needs to add some kinda wait period? But I dont know how to do that.
Current code I'm using:tiledoor.lua
Lua:function onUse(cid, item, fromPosition, itemEx, toPosition) if item.uid == 40002 then if getPlayerStorageValue(cid, 40002) == 1 then doTransformItem(item.uid, item.itemid + 1) doTeleportThing(cid, toPosition) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have yet not learned the secrets of this door.") end end return true end function onStepOut(cid, item, position, fromPosition) doTransform(item.uid, item.itemid - 1) return true end
tilestep.lua
Lua:function onStepIn(cid, item, position, fromPosition) if item.itemid == 407 and item.actionid == 40001 then if getPlayerStorageValue(cid,40002) == -1 then setPlayerStorageValue(cid,40002,1) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You may now open the door.') end return 1 end end
local door = {x = 100, y = 100, z = 7, stackpos = 3}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, 40002) == 1 then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to step on a tile before opening this door.")
end
return true
end
function onStepOut(cid, item, position, fromPosition)
doTransform(getThingfromPos(door).uid, item.itemid - 1)
return true
end
Look at my post, I've edited the code, now you should use:
Lua:local door = {x = 100, y = 100, z = 7, stackpos = 3} function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerStorageValue(cid, 40002) == 1 then doTransformItem(item.uid, item.itemid + 1) doTeleportThing(cid, toPosition) else doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to step on a tile before opening this door.") end return true end function onStepOut(cid, item, position, fromPosition) doTransform(getThingfromPos(door).uid, item.itemid - 1) return true end