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

Action The hidden cellar

Evan

A splendid one to behold
Senator
Premium User
Joined
May 6, 2009
Messages
7,019
Solutions
1
Reaction score
1,029
Location
United States

I will be releasing all of my "mini-scripts" over the course of the next two months.
I have approximately 70 of these scripts that would make your server unique.
You may visit my blog in my signature to view all scripts that have been released so far.


The hidden cellar

What does it do?
It allows you to hide a room without making it impossible to find.
If you click on the top part of the rug, it will roll it up and reveal a trapdoor; open the trapdoor and enter the room.
Once you enter the room, the trapdoor will close and the rug will cover it back up.
This is the same as the hidden entrance to the basement in Vengoth Castle on Tibia.

11b2250422a09c3fc27bc6241dcb5404.gif


Installing the script:

Remember to change the actionID if you wish.
Note: this has a moveevent script as well.

Create a new Lua file in data/actions/scripts named rollrug and add the following:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local topPartRug = getThingFromPos({x=toPosition.x,y=toPosition.y,z=toPosition.z,stackpos=1})
local botPartRug = getThingFromPos({x=toPosition.x,y=toPosition.y+1,z=toPosition.z,stackpos=1})

	if item.aid == 23001 then
		if topPartRug.uid > 0 and botPartRug.uid > 0 then
			doRemoveItem(topPartRug.uid, 1)
			doTransformItem(botPartRug.uid, 9623)
		end
	end
	return true
end

In actions.xml, add the following line:
XML:
<action itemid="9629" event="script" value="rollrug.lua"/>

Create a new Lua file in data/movements/scripts named entercellar and add the following:
Lua:
function onStepIn(cid, item, pos)
local trapDoor = getThingFromPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0})
local topPartRug = getThingFromPos({x=pos.x,y=pos.y+1,z=pos.z,stackpos=1})

	if isPlayer(cid) then
		if trapDoor.uid > 0 and topPartRug.uid > 0 then
			doTransformItem(trapDoor.uid, 9624)
			doTransformItem(topPartRug.uid, 9630)
			doSetItemActionId((doCreateItem(9629, 1, {x=pos.x,y=pos.y,z=pos.z,stackpos=1})), 23001)
			doTeleportThing(cid, {x=pos.x,y=pos.y,z=pos.z+1})
		end
	end
	return true
end

In movements.xml, add the following line:
XML:
<movevent type="StepIn" itemid="9625" event="script" value="entercellar.lua"/>

In Remere's map editor:
Place the trapdoor (ID: 9624)
Then place the top part of the rug on top of the trapdoor (ID: 9629)
Then place the bottom part of the rug right below the top part of the rug (ID: 9630)
Set the top part of the rug's actionID to 23001.
 
Nice!

Only problem I see is there is no reset feature in the action script.

As it is currently, if no one walks on the trapdoor after the rug is used, it will be revealed till server save.

There should be a timer that resets the rug after so long in the action script.
 
Back
Top