Difference between revisions of "Manual:Game Mechanics/Rooms"

From DikuMUD Wiki
Jump to navigation Jump to search
(checked against the current code (wiki review 2026-11-15))
 
Line 1: Line 1:
−
This might belong better in a builder's tutorial
+
This page collects what rooms can do beyond walls and exits: hidden exits and how hard they are to find, rooms inside rooms, rooms that move people or hurt them, holy and safe rooms, and some advice on laying out dangerous areas. How to write rooms is in the [[Manual:Zone Manual/The Room Section|Zone Manual]]. The DIL functions named here are in the public zones: <code>vme/zone/function.zon</code> and <code>basemove.zon</code>.
  
−
== Room Creation ==
+
== Secret doors ==
 +
An exit with <code>EX_HIDDEN</code> doesn't show among the exits, and <code>look</code> won't reveal it; a player has to <code>search</code> for it, by direction (<code>search west</code>) or by one of the exit's keywords (<code>search boulder</code>). The exit's <code>difficulty</code> (0 to 250) is how hard it is to find:
  
−
This belongs better in a builder's tutorial.
+
result = open-ended 1d100 + (2 &times; search skill + brain) / 3 - difficulty - 50
  
−
Document Name:    room.doc
+
Above 0 finds it, so a searcher whose skill equals the difficulty finds it half the time. Each search costs 10 endurance. The exit then stays found for that player, and only for them; gods always find it. See [[Manual:Game Mechanics/Skills#Searching|Skills]] and [[Help/Search|help search]].
−
Version:          1.10
 
−
Author:            Michael Seifert (seifert@diku.dk)
 
−
Questions to:     seifert@diku.dk
 
−
Document intended for:  World Creators
 
  
−
Short Description:
+
The same difficulty is used to pick the exit's lock and to climb or swim through it, since an exit has only one. Choose it for the players you have in mind: a skill of about 40 is an ordinary person, 100 the best there is.
−
This document describes special interesting tricks and macros  for use with rooms.
 
  
−
1. Secret Doors
+
<pre>
−
To  make  a  secret door, you must set the EX_HIDDEN flag  on  the
+
library
−
exits open flags, for example:
+
title "The Library"
 +
descr
 +
"Shelves of old books cover the walls. One shelf stands a little
 +
out from the wall."
 +
extra {"shelf", "shelves"}
 +
"One of the shelves isn't quite flush with the wall."
 +
west to study difficulty 35 open {EX_OPEN_CLOSE, EX_CLOSED, EX_HIDDEN}
 +
  keyword {"bookshelf", "shelf"} descr "A bookshelf.";
 +
end
  
−
east  to  treasure_room keywords {"secret door",  "door", "wall", "crack"} open {EX_OPEN_CLOSE, EX_HIDDEN}
+
study
−
descr "You notice a small crack in the wall!"
+
title "A Hidden Study"
 +
descr
 +
"A small dusty room behind the library."
 +
east to library open {EX_OPEN_CLOSE, EX_CLOSED}
 +
  keyword {"bookshelf", "shelf"} descr "The back of a bookshelf.";
 +
end
 +
</pre>
 +
Give the hidden exit the keywords a player would think of searching for, and hint at it in the room's description and extras: without a hint, nobody will ever look. The old macro <code>SECRET_DOOR_DIFFICULTY</code> no longer exists; <code>difficulty</code> replaces it.
  
−
Notice  that  it  is important to specify  the possible  "search
+
== Rooms inside rooms ==
−
keywords" as well as the "door keywords". If you for example  omit
+
A room can be placed inside another with <code>in</code>: a closet, a tent, a cage. Players go in with <code>enter</code> and the room's <code>names</code>, and come out with <code>exit</code>. <code>outside_descr</code> is what the outer room shows of it.
−
"wall" or  "crack" then a command of "search wall" will  always
+
<pre>
−
fail!
+
closet
 +
names {"closet"}
 +
title "Inside a Closet"
 +
descr
 +
"It is cramped and dark in here."
 +
outside_descr "A closet stands in the corner."
 +
in library
 +
end
 +
</pre>
  
−
You  must  specify how difficult it is to find the door  with the
+
== Moving people along ==
−
search  skill. The difficulty is specified in % and when it equals
+
<code>force_move@function(tick, "room@zone!message", random)</code> moves everyone and everything inside the unit to another room every ''tick'' quarter seconds (at least 12). Give the room with its zone; the message after the <code>!</code> is shown to those moved. With ''random'' TRUE the interval varies. A unit with an extra <code>$no force move</code> stays. It replaces the old special <code>SFUN_FORCE_MOVE</code>, and suits a teleporting closet or a slide:
−
the players skill level, he has a 50% chance of spotting the door.
+
<pre>
−
Roughly the difficulty percentage should equal the intended player
+
slide
−
level.   Combined with the above example, lets say  you  intend  a
+
title "On a Slide"
−
level 35 to be the average searcher, you would type:
+
descr
 +
"You are sliding down a long smooth chute."
 +
movement SECT_INSIDE
 +
dilcopy force_move@function(20, "library@manor!You land with a thump.", FALSE);
 +
end
 +
</pre>
  
−
SECRET_DOOR_DIFFICULTY(EAST, 35)
+
For water, <code>watercurrent@basemove</code> carries swimmers along a river through one of its exits, with a swimming check on the way; see [[Manual:Game Mechanics/Skills#Swimming|Skills]].
  
−
I  can  recommend that you make room descriptions hinting  to  the
+
== Rooms that hurt ==
−
presence of the door since it will otherwise be near impossible to
+
<code>death_room@function(tick, damage, "message")</code> takes ''damage'' hit points from every player in the room every ''tick'' quarter seconds (at least 12) and shows them the message. Gods are spared. With an extra <code>$death room for mobs</code> on the room it hurts monsters too, except those with an extra <code>$no death room</code>. It replaces the old special <code>SFUN_DEATH_ROOM</code>.
−
find  it.  And  as  above  it is a good  idea  to  make  direction
+
<pre>
−
descriptions  and also apply extra descriptions for keywords  like
+
pit
−
"wall", "crack", etc.
+
title "At the Bottom of a Pit"
 +
descr
 +
"Sharp stakes stick up from the floor of the pit."
 +
dilcopy death_room@function(20, 10, "The stakes cut you!");
 +
end
 +
</pre>
 +
Use such rooms sparingly, and let players see them coming and get out. Nothing stops players exploring a zone faster than a room that kills them without warning.
  
−
2. Rooms in rooms
+
== Holy rooms ==
−
A  room  can  be placed inside another room with the "in"  keyword
+
In a room with <code>flags {UNIT_FL_SACRED}</code>, hit points, mana and endurance come back twice as fast (see [[Manual:Game Mechanics/Levels#Regeneration|Levels]]). The flag works on anything the character is inside, a room or an object. A holy room in a beginners' area helps new players a lot.
−
(see VMC.txt document).
 
  
−
3. Force move
+
== Safe rooms ==
−
The  special function SFUN_FORCE_MOVE can be used to make  persons
+
<code>dilcopy safe_room@function();</code> refuses attacks in the room: <code>kill</code>, <code>hit</code>, <code>backstab</code>, <code>kick</code>, <code>bash</code>, <code>trip</code>, <code>disarm</code>, <code>rescue</code>, <code>drag</code>, <code>steal</code>, <code>filch</code>, <code>pickpocket</code>, <code>cast</code>, <code>use</code> and <code>recite</code> are blocked with "Spells and attacks are not allowed in safe rooms." It only checks commands whose last word names someone or something in the room, so a spell cast with no target (an area spell, for example) is not stopped. NPCs without a master are not stopped either, you may always act on the one you follow, and members of the police academy quest may attack outlaws.
−
automatically move to another room at specified time intervals. It
+
<pre>
−
is  perfect for situations like a teleporting closet (a room in  a
+
shrine
−
room  with a force move), a river that makes you drift along  with
+
title "A Small Shrine"
−
the stream (and perhaps down a waterfall), etc.
+
descr
 +
"A quiet shrine with a stone altar."
 +
flags {UNIT_FL_SACRED}
 +
dilcopy safe_room@function();
 +
end
 +
</pre>
  
−
4. Death rooms
+
== Directions no one can flee ==
−
We  do  discourage the use of rooms with certain-death. There  may
+
A player who flees runs through a random exit. <code>NO_FLEE_LEAVE("down")</code> (in <code>wmacros.h</code>) on a room keeps them from fleeing down; they can still walk that way.
−
however be situations in which it is reasonable to give an  amount
 
−
of  damage  to  characters. For this purpose  we  have  made  the
 
−
SFUN_DEATH_ROOM  ["<damage number>"] function. The  function  will
 
−
damage  players at every specified interval with the damage amount
 
−
specified, for example:
 
  
−
    special SFUN_DEATH_ROOM "100" time PULSE_SEC*10 [OBSOLETE]
+
== Buffer rooms ==
−
 
+
Fleeing is random, so a player who flees from one dangerous monster can run into the next. When two strong monsters are near each other, put a quiet room between them, so that a player who flees from one doesn't land beside the other.
−
will  give 10.0 damage points to players inside the room.  If  the
 
−
character  has no means of escaping he is almost certainly  doomed
 
−
(unless  he  possesses  means of teleporting).  Make  damage  rooms
 
−
reasonable,   escapable  and  avoidable.  Nothing  discourages
 
−
exploration of a zone more than a certain death damage room.
 
−
 
 
−
5. Sacred rooms
 
−
Remember that it can often be a good idea to insert a sacred  room
 
−
in  your  zone,  especially in beginner areas. A  sacred  room  is
 
−
specified by the:
 
−
 
 
−
  flags {UNIT_FL_SACRED}
 
−
 
 
−
6. "Buffer rooms"
 
−
In  the  case that you have two dangerous monsters in two adjacent
 
−
rooms, it is often a good idea to insert a buffer room  to  avoid
 
−
players  fleeing from one monster into the certain  death  of  the
 
−
other monster. This of course depends completely on the situation.
 
−
A  good  example  of such a design is the tiamat zone  where  when
 
−
players  fight  one dragon the have 50% risk of fleeing  into  the
 
−
arms of another dragon.
 

Latest revision as of 06:27, 15 November 2026

This page collects what rooms can do beyond walls and exits: hidden exits and how hard they are to find, rooms inside rooms, rooms that move people or hurt them, holy and safe rooms, and some advice on laying out dangerous areas. How to write rooms is in the Zone Manual. The DIL functions named here are in the public zones: vme/zone/function.zon and basemove.zon.

Secret doors

An exit with EX_HIDDEN doesn't show among the exits, and look won't reveal it; a player has to search for it, by direction (search west) or by one of the exit's keywords (search boulder). The exit's difficulty (0 to 250) is how hard it is to find:

result = open-ended 1d100 + (2 × search skill + brain) / 3 - difficulty - 50

Above 0 finds it, so a searcher whose skill equals the difficulty finds it half the time. Each search costs 10 endurance. The exit then stays found for that player, and only for them; gods always find it. See Skills and help search.

The same difficulty is used to pick the exit's lock and to climb or swim through it, since an exit has only one. Choose it for the players you have in mind: a skill of about 40 is an ordinary person, 100 the best there is.

library
title "The Library"
descr
"Shelves of old books cover the walls. One shelf stands a little
out from the wall."
extra {"shelf", "shelves"}
"One of the shelves isn't quite flush with the wall."
west to study difficulty 35 open {EX_OPEN_CLOSE, EX_CLOSED, EX_HIDDEN}
   keyword {"bookshelf", "shelf"} descr "A bookshelf.";
end

study
title "A Hidden Study"
descr
"A small dusty room behind the library."
east to library open {EX_OPEN_CLOSE, EX_CLOSED}
   keyword {"bookshelf", "shelf"} descr "The back of a bookshelf.";
end

Give the hidden exit the keywords a player would think of searching for, and hint at it in the room's description and extras: without a hint, nobody will ever look. The old macro SECRET_DOOR_DIFFICULTY no longer exists; difficulty replaces it.

Rooms inside rooms

A room can be placed inside another with in: a closet, a tent, a cage. Players go in with enter and the room's names, and come out with exit. outside_descr is what the outer room shows of it.

closet
names {"closet"}
title "Inside a Closet"
descr
"It is cramped and dark in here."
outside_descr "A closet stands in the corner."
in library
end

Moving people along

force_move@function(tick, "room@zone!message", random) moves everyone and everything inside the unit to another room every tick quarter seconds (at least 12). Give the room with its zone; the message after the ! is shown to those moved. With random TRUE the interval varies. A unit with an extra $no force move stays. It replaces the old special SFUN_FORCE_MOVE, and suits a teleporting closet or a slide:

slide
title "On a Slide"
descr
"You are sliding down a long smooth chute."
movement SECT_INSIDE
dilcopy force_move@function(20, "library@manor!You land with a thump.", FALSE);
end

For water, watercurrent@basemove carries swimmers along a river through one of its exits, with a swimming check on the way; see Skills.

Rooms that hurt

death_room@function(tick, damage, "message") takes damage hit points from every player in the room every tick quarter seconds (at least 12) and shows them the message. Gods are spared. With an extra $death room for mobs on the room it hurts monsters too, except those with an extra $no death room. It replaces the old special SFUN_DEATH_ROOM.

pit
title "At the Bottom of a Pit"
descr
"Sharp stakes stick up from the floor of the pit."
dilcopy death_room@function(20, 10, "The stakes cut you!");
end

Use such rooms sparingly, and let players see them coming and get out. Nothing stops players exploring a zone faster than a room that kills them without warning.

Holy rooms

In a room with flags {UNIT_FL_SACRED}, hit points, mana and endurance come back twice as fast (see Levels). The flag works on anything the character is inside, a room or an object. A holy room in a beginners' area helps new players a lot.

Safe rooms

dilcopy safe_room@function(); refuses attacks in the room: kill, hit, backstab, kick, bash, trip, disarm, rescue, drag, steal, filch, pickpocket, cast, use and recite are blocked with "Spells and attacks are not allowed in safe rooms." It only checks commands whose last word names someone or something in the room, so a spell cast with no target (an area spell, for example) is not stopped. NPCs without a master are not stopped either, you may always act on the one you follow, and members of the police academy quest may attack outlaws.

shrine
title "A Small Shrine"
descr
"A quiet shrine with a stone altar."
flags {UNIT_FL_SACRED}
dilcopy safe_room@function();
end

Directions no one can flee

A player who flees runs through a random exit. NO_FLEE_LEAVE("down") (in wmacros.h) on a room keeps them from fleeing down; they can still walk that way.

Buffer rooms

Fleeing is random, so a player who flees from one dangerous monster can run into the next. When two strong monsters are near each other, put a quiet room between them, so that a player who flees from one doesn't land beside the other.