Manual:Zone Manual/The Room Section/A more complex set of rooms

From DikuMUD Wiki
Jump to navigation Jump to search

A more complex set of rooms

In the last section you learned to make basic rooms. In this section we will build on what you already know to allow you to make much more fancy rooms. In this section we will give a much better view of the exits and what can be done with them including doors, hidden doors and rooms inside other rooms. We will also show some examples of the room DIL functions being used that were described in the previous section. Finally we will pull it all together in a completed zone for you to compile and play with.

Exits with doors

When we first defined exits we included the 'keyword' and 'open' fields on a door. In this section we will give an example of two rooms linked together with a door. There is no new information you have not already encountered so we will start with an example.

	hallway
	title "Module tunnel"
	descr "The hallway is about 50 meters long and around 100 meters from
	side to side and top to bottom...."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	west to chamber descr
	"The hallway opens up into a chamber.";

	east to office descr
	"You see what looks to be an office."
	keyword {"air lock door","air lock","door"}
	open {EX_OPEN_CLOSE, EX_CLOSED};

	end

	office
	title "The station office"
	descr
	"Large paintings fill the walls of this part of the station...."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	west to hallway descr
	"You see what looks to be a hallway."
	keyword {"air lock door","air lock","door"}
	open {EX_OPEN_CLOSE, EX_CLOSED};
	end
      One important thing you should notice is, whatever you put as a keyword, 
      along with the direction, is what a person must use to open the door. 
      So make sure there is something in the description or extra that the player 
      can use to discern the correct search term. 

To make sure the door closes at reset time you will have to add the doors reset to the '%reset' section. The door resets will be explained in (Link to ch-07). Notice also in this example we have a direction both in the room you are going to and the room you came from. This means you need a 'west' direction for every 'east' direction leading to it. If you do not put both you will end up with a one way direction.

Locked & Hidden Exits

An update to the old method of handling searching for hidden doors & picking doors has been made. What was once done individually between hidden & locked doors is now a 'difficulty' rating. This rating will apply to picking locks as well as searching rooms but they will actually call upon the PC's skills and abilities.


In our zone, we will denote it like so:

        northeast to aroom
	descr "A small room."
	key key@zone
	keyword {"door"}
	open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}
	difficulty 10;


An example of how you apply the same concept to a container would be:
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED} difficulty 10


See this for more information on how the skill and ability levels work:
Manual:Game Mechanics/Skills

Locked exits

Now that you have making a door down, you may find that it is not safe to leave your doors unlocked. Well the VME is ready for you. You have already seen the 'keyword' and 'open' sections and what you can set in them. Now lets use the 'EX_LOCKED field with them and introduce a new macro to allow you to set the difficulty to unlock the lock with out a key.

First lets look at the macro that allows you to set a difficulty on a lock. If you set the lock with out this macro it will default to 0 and thus be easy to pick.

	#define DOOR_LOCK_DEF(north_lock, east_lock, south_lock, west_lock,\
	up_lock, down_lock, northeast_lock, northwest_lock, southeast_lock,\
	southwest_lock)

When using this macro you only set the value of the exit you want to add the difficulty to, you can leave the rest of the exits '0'. Only one of these macros are needed on a room no matter how many exits because each of the exits are included.. If you have an exit to the north that is locked and you want it to have a difficulty of 50% the following would be the line you would add to your room

	DOOR_LOCK_DEF(50, 0, 0, 0, 0, 0, 0, 0, 0, 0)

Now lets add the macro and the locked flag to the exits and create the room.

	hallway
	title "Module tunnel"
	descr "The hallway is about 50 meters long and around 100 meters from
	side to side and top to bottom...."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	west to chamber descr
	"The hallway opens up into a chamber.";

	DOOR_LOCK_DEF(0, 50, 0, 0, 0, 0, 0, 0, 0, 0)
	east to office descr
	"You see what looks to be an office."
	keyword {"air lock door","air lock","door"}
	key nokey
	open {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED};

	end

	office
	title "The station office"
	descr
	"Large paintings fill the walls of this part of the station...."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	DOOR_LOCK_DEF(0, 0, 0, 50, 0, 0, 0, 0, 0, 0)
	west to hallway descr
	"You see what looks to be a hallway."
	keyword {"air lock door","air lock","door"}
	key nokey
	open {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED};
	end

The only thing you may be wondering about in this example is the 'key' field. I have picked 'nokey' as my value of the key. There is no key in this zone so all this does is create a key hole. If you leave the 'key' field out totally the only way you can open the lock is by a magical spell. It is also important that you read about resets of door locks in (Link to ch-07).

Hidden exits

Locking the doors may not be enough. In fact sometimes you may not want to lock the door but you might want to hide it. You can do both or either with the following macro added to your exit.

	#define SECRET_DOOR_DIFFICULTY(DIR, SKILL) \
	extra{SECRET_DOOR} {DIR, SKILL}\
	""

So if you wanted a door or just a passage to the north hidden you would add this before or after your exits.

	SECRET_DOOR_DIFFICULTY(NORTH, 50)

Now lets put it all together and link two rooms together with a hidden door.

	office
	title "The station office"
	descr
	"Large paintings fill the walls of this part of the station..."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	west to hallway descr
	"You see what looks to be a hallway."
	keyword {"air lock door","air lock","door"}
	open {EX_OPEN_CLOSE, EX_CLOSED};

	SECRET_DOOR_DIFFICULTY(SOUTH, 50)
	south to portal_room descr
	"You see what looks to be a portal room."
	keyword {"air lock door","air lock","staff","door"}
	key nokey
	open {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED,EX_HIDDEN};

	end

	portal_room
	title "Green field room"
	descr
	"Like the other rooms on the station this one is large enough for
	dragons to comfortably fit in.  The strange thing about this room though
	is it is totally empty except for a green field right in the center.
	there is a door that leads to another room to the north."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	north  to office descr
	"You see what looks to be an office."
	keyword {"air lock door","air lock","door"}
	key nokey
	open {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED};

	end

Rooms inside of rooms

Now that you have normal exits down its time to take a look at something a bit different. Lets say you wanted to put a barrel in a room that is also a room that has exits to other rooms. Or maybe in my case I want to put a transporter pad in the room that is also a room so you can exit back into the room you came from. In the case of the teleporter I could use an object but as you will find it is much easier to deal with a room for this than an object.

To put a room in a room it is much different than using the normal exit fields. The only thing needed is the 'in' keyword and the room you are linking the current room into. There is no need for a semi-colon. The following is what the line would look like.

	in <room that room is in>

Not too hard. The following are two rooms one in the other.

	portal_room
	title "Green field room"
	descr
	"Like the other rooms on the station this one is large enough for
	dragons to comfortably fit in.  The strange thing about this room though
	is it is totally empty except for a green field right in the center.
	there is a door that leads to another room to the north."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	extra {"green field","field"}
	"The field looks to be a green fog shifting and churning as you watch.
	if you are nuts you could probably enter it."

	north  to office descr
	"You see what looks to be an office."
	keyword {"air lock door","air lock","door"}
	key nokey
	open {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED};

	//A link to the portal is also here
	end

	room_port
	names{"green field", "field"}
	title "Green field"
	descr
	"Green Mist swirls about you."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	in portal_room
	end

After adding a room in a room you should note the room in the description or put an 'outside_descr' on the room inside it. In our example we have chosen to add the description into the room instead

of using the 'outside_descr'. Also doors and locks work the same way as before you can even hide this exit.

A room using force move.

Sometimes you will want to help players along their path. This could be for a river that flows strongly enough to force a players raft down stream or maybe for a room of quick sand that sucks the player into another room. In these situations we need to use the force move DIL, explained in the previous section. Here we have built two rooms linked only by a forced move.

	portal_room
	title "Green field room"
	descr
	"Like the other rooms on the station this one is large enough for
	dragons to comfortably fit in.  The strange thing about this room though
	is it is totally empty except for a green field right in the center.
	there is a door that leads to another room to the north."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	extra {"green field","field"}
	"The field looks to be a green fog shifting and churning as you watch.
	if you are nuts you could probably enter it."

	north  to office descr
	"You see what looks to be an office."
	keyword {"air lock door","air lock","door"}
	key nokey
	open {EX_OPEN_CLOSE, EX_CLOSED,EX_LOCKED};

	//A link to the portal is also here

	end
	ship_port
	names{"green field", "field"}
	title "Green field"
	descr
	"Green Mist swirls about you."

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	in ship

	dilcopy force_move@function(
	//Time to activation
	4,
	//room and act
	"portal_room@dragonst!You feel your body dissolving for lack of a better
	description.&nYou appear on the deck of a ship.",
	//True or False for randomizing or not
	FALSE);

	end

A death room

As a final touch to my little example zone I want to create a room that will kill a player instantly. I will use the DIL function Death room and the room would simply look as follows.

	deathspace
	title"Open space"
	descr
	"You see the ship and the station far off in the distance and you are in Space!"

	movement SECT_INSIDE
	ALWAYS_LIGHT
	flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

	dilcopy death_room@function (
	//how often is damage done 4 would be 1 second
	4,
	//damage
	400,
	//act for the damage.
	"You realize	 to late that was the trash disposal transporter and you feel your lungs explode.");

	end
Previous: DIL functions for rooms
Next: Putting the rooms together