Difference between revisions of "Manual:Game Mechanics/Rooms"
(checked against the current code (wiki review 2026-11-15)) |
|||
| Line 1: | Line 1: | ||
| − | This | + | 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>. |
| − | == | + | == 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: | ||
| − | + | 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 [[Manual:Game Mechanics/Skills#Searching|Skills]] and [[Help/Search|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. | |
| − | |||
| − | + | <pre> | |
| − | + | 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 | |
| − | descr " | + | 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. | ||
| − | + | == Rooms inside rooms == | |
| − | + | 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. | |
| − | " | + | <pre> |
| − | + | 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> | ||
| − | + | == Moving people along == | |
| − | + | <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: | |
| − | + | <pre> | |
| − | + | 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 | ||
| + | </pre> | ||
| − | + | 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]]. | |
| − | + | == Rooms that hurt == | |
| − | + | <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>. | |
| − | + | <pre> | |
| − | + | 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 | ||
| + | </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. | ||
| − | + | == Holy rooms == | |
| − | + | 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 | ||
| − | + | == Safe rooms == | |
| − | + | <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. | |
| − | + | <pre> | |
| − | + | shrine | |
| − | + | title "A Small Shrine" | |
| − | + | descr | |
| + | "A quiet shrine with a stone altar." | ||
| + | flags {UNIT_FL_SACRED} | ||
| + | dilcopy safe_room@function(); | ||
| + | end | ||
| + | </pre> | ||
| − | + | == Directions no one can flee == | |
| − | + | 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. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | == 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. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | other | ||
| − | |||
| − | |||
| − | |||
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.
Contents
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.