A few people have asked about hidden doors and I have gotten so much from
the listserve and circlemud community that I figured its time to give
a little back.
Enjoy
------------------------------------------------------------------
structs.h
in the exit information section define
#define EX_HIDDEN (1 << 4) /* exit is hidden */
act.informative.c
This is how I have my exit prompt set up...
It will show all doors that are not hidden like this
[Exits: e ^n]
void do_auto_exits(struct char_data * ch)
{
int door;
*buf = '\0';
for (door = 0; door < NUM_OF_DIRS; door++)
if (EXIT(ch, door) && EXIT(ch, door)->to_room != NOWHERE)
if (!IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
sprintf(buf, "%s%c ", buf, LOWER(*dirs[door]));
else
if (!IS_SET(EXIT(ch, door)->exit_info, EX_HIDDEN))
sprintf(buf, "%s^%c ", buf, LOWER(*dirs[door]));
sprintf(buf2, "%s&B[ &gExits: &W%s&B]&n%s\r\n", CCCYN(ch, C_NRM),
*buf ? buf : "None! ", CCNRM(ch, C_NRM));
send_to_char(buf2, ch);
}
Add search command in act.informtive.c or wherever
My search command is a little raw, but functional.
ACMD(do_search)
{
int door, chance = 1;
*buf = '\0';
if (IS_AFFECTED(ch, AFF_BLIND)) {
send_to_char("Your blind, you can't see a damned thing!", ch);
return;
}
send_to_char("\r\nYou begin to search the room...\r\n", ch);
for (door = 0; door < NUM_OF_DIRS; door++) {
if (EXIT(ch, door) && EXIT(ch, door)->to_room != NOWHERE) {
if (IS_SET(EXIT(ch, door)->exit_info, EX_HIDDEN)) {
if (GET_RACE(ch) == RACE_ELF)
chance += 1;
if (GET_INT(ch) >= 17)
chance += 1;
if (number(1,6) <= chance) {
sprintf(buf, "\r\n&WYou have found a secret door %s.&n\r\n", dirs[door]);
send_to_char(buf, ch);
REMOVE_BIT(EXIT(ch, door)->exit_info, EX_HIDDEN);
}
}
}
}
return;
}
act.movement.c
In perform_move add the check for EX_HIDDEN and show it same way as
no exit at all.
else if (!EXIT(ch, dir) || EXIT(ch, dir)->to_room == NOWHERE)
send_to_char("Alas, you cannot go that way...\r\n", ch);
else if (IS_SET(EXIT(ch, dir)->exit_info, EX_HIDDEN) &&
IS_SET(EXIT(ch, dir)->exit_info, EX_CLOSED))
send_to_char("Alas, you cannot go that way...\r\n", ch);
else if (IS_SET(EXIT(ch, dir)->exit_info, EX_CLOSED)) {
if (EXIT(ch, dir)->keyword) {
In do_gen_door add a check if they try to open a hidden door that they can't
if ((obj) || (door >= 0)) {
keynum = DOOR_KEY(ch, obj, door);
if (!(DOOR_IS_OPENABLE(ch, obj, door)))
act("You can't $F that!", FALSE, ch, 0, cmd_door[subcmd], TO_CHAR);
else if (!DOOR_IS_OPEN(ch, obj, door) &&
IS_SET(flags_door[subcmd], NEED_OPEN))
send_to_char("But it's already closed!\r\n", ch);
else if (IS_SET(EXIT(ch, door)->exit_info, EX_HIDDEN))
act("You can't $F that!", FALSE, ch, 0, cmd_door[subcmd], TO_CHAR);
else if (!DOOR_IS_CLOSED(ch, obj, door) &&
IS_SET(flags_door[subcmd], NEED_CLOSED))
send_to_char("But it's currently open!\r\n", ch);
interpreter.c
add the search command
ACMD(do_search);
{ "search", do_search, 0, 0,},
db.c
In db.c set the doors state. In reset_zone() add ex_hidden stuff to this
case command.
case 'D': /* set state of door */
if (ZCMD.arg2 < 0 || ZCMD.arg2 >= NUM_OF_DIRS ||
(world[ZCMD.arg1].dir_option[ZCMD.arg2] == NULL)) {
ZONE_ERROR("door does not exist");
} else
switch (ZCMD.arg3) {
case 0:
REMOVE_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_LOCKED);
REMOVE_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_CLOSED);
REMOVE_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_HIDDEN);
break;
case 1:
SET_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_CLOSED);
REMOVE_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_LOCKED);
REMOVE_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_HIDDEN);
break;
case 2:
SET_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_LOCKED);
SET_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_CLOSED);
REMOVE_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_HIDDEN);
break;
case 3:
SET_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_CLOSED);
SET_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_HIDDEN);
REMOVE_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_LOCKED);
break;
case 4:
SET_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_CLOSED);
SET_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_LOCKED);
SET_BIT(world[ZCMD.arg1].dir_option[ZCMD.arg2]->exit_info,
EX_HIDDEN);
break;
}
last_cmd = 1;
break;
In whatever olc you use, add the ability to set doors in zedit as
hidden/closed or hidden/locked.
I think this is it. If I forgot anything, I will post it later
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST