• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

MoveEvent Able to open a Door once you step on a certain tile.

Lua:
function onStepIn(cid, item, pos) --Credits to HamTheKratos

Credits for the joke goes to <master> you know who you are <3
 
Either the code should be like this, if that doesn't work then it should be unique id 40001 not action id I think. But, I dont know scripting so it's just a guess XD
Lua:
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
 
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
 
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

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

Still not working as it should.
[email protected]
that's my msn, msg me and I could show you ingame.
 
Back
Top