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

HamTheKratos

Member
Joined
Jan 14, 2009
Messages
243
Reaction score
8
Location
I Dunno
Hello.. ^^ Wish It Helps You

CREDITS:Thrown

movements.xml:
Lua:
<movement type="StepIn" actionid="40001" event="script" value="tilestep.lua"/>

tilestep.lua:
Lua:
function onStepIn(cid, item, pos)
    if item.itemid == 4415 and item.uid == 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

actions.xml:
Lua:
<action uniqueid="40002" script="tiledoor.lua" />

tiledoor.lua:
Lua:
function onUse(cid, item, frompos, item2, topos)
    if item.itemid == 9175 and item.uid == 40002 then
        if getPlayerStorageValue(cid,40002) == 1 then
       pos = getPlayerPosition(cid)
            doTransformItem(item.uid,item.itemid+1)
				playerpos = getPlayerPosition(cid)
				doorpos = {x = frompos.x, y = frompos.y, z = frompos.z, stackpos = 253}
				if playerpos.y == doorpos.y + 1 and playerpos.x == doorpos.x then
					doMoveCreature(cid, 0)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y then
					doMoveCreature(cid, 1)
				elseif playerpos.y == doorpos.y - 1 and playerpos.x == doorpos.x then
					doMoveCreature(cid, 2)
				elseif playerpos.y == doorpos.y and playerpos.x == doorpos.x + 1 then
					doMoveCreature(cid, 3)
				elseif playerpos.x == doorpos.x + 1 and playerpos.y == doorpos.y - 1 then
					doMoveCreature(cid, 4)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y - 1 then
					doMoveCreature(cid, 5)
				elseif playerpos.x == doorpos.x + 1 and playerpos.y == doorpos.y + 1 then
					doMoveCreature(cid, 6)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y + 1 then
					doMoveCreature(cid, 7)
				end
            else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,'You need to step on a tile before opening this door.')
            end
        return 1
end
end

How It Works?
when a player step on a tile he gets access to open certin door.

Where To Use It?
you can make that tile in a far place from the door as alone quest or just need the door.

how to edit the place of the door and the tile?
make the door unique id 40002.
make the tile action id 40001.

please comment and rep :)
 
Last edited:
You should give credit to the one who did this script, for this is not yours.
 

Lua:
function onUse(cid, item, frompos, item2, topos)
    if item.itemid == 9175 and item.uid == 40002 then
        if getPlayerStorageValue(cid,40002) == 1 then
       pos = getPlayerPosition(cid)
            doTransformItem(item.uid,item.itemid+1)
				playerpos = getPlayerPosition(cid)
				doorpos = {x = frompos.x, y = frompos.y, z = frompos.z, stackpos = 253}
				if playerpos.y == doorpos.y + 1 and playerpos.x == doorpos.x then
					doMoveCreature(cid, 0)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y then
					doMoveCreature(cid, 1)
				elseif playerpos.y == doorpos.y - 1 and playerpos.x == doorpos.x then
					doMoveCreature(cid, 2)
				elseif playerpos.y == doorpos.y and playerpos.x == doorpos.x + 1 then
					doMoveCreature(cid, 3)
				elseif playerpos.x == doorpos.x + 1 and playerpos.y == doorpos.y - 1 then
					doMoveCreature(cid, 4)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y - 1 then
					doMoveCreature(cid, 5)
				elseif playerpos.x == doorpos.x + 1 and playerpos.y == doorpos.y + 1 then
					doMoveCreature(cid, 6)
				elseif playerpos.x == doorpos.x - 1 and playerpos.y == doorpos.y + 1 then
					doMoveCreature(cid, 7)
				end
            else
                    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,'You need to step on a tile before opening this door.')
            end
        return 1
end
end


You can use this instead of checking all positions

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

Not tested

@edited
I added local door, so now should work
 
Last edited:
doTeleportThing(cid,frompos) ?

You can use this instead of checking all positions

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 need to step on a tile before opening this door.")
		end
	end
	return true
end

function onStepOut(cid, item, position, fromPosition)
	doTransform(item.uid, item.itemid - 1) 
	return true
end

Not tested


Oh Rly?
 

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

How can it be made shorter?
 
Back
Top