Ross Arnold writes, "This improved look_in_direction code will allow players to see the entire room in the direction they look in as if they were standing in that room and typed look. " This snippet was made for heavily modified bpl17 but should work with just about any version. This improved look_in_direction code will allow players to see the entire room in the direction they look in as if they were standing in that room and typed look. Extremely useful if you like to have a lot of nifty traps and ambushes, and if you use some nice archery code and/or spells that fire into other rooms. Also it just plain makes sense; if someone looks into another room why wouldn't they be able to see it? I also included a simple scan command that uses the new look_in_direction code. Anyway here's the code: (replace /T with tabs) In act.informative.c, find the look_in_direction function, and replace the entire function with the following code: void look_in_direction(struct char_data * ch, int dir) { int target_room = -1; int ignore_brief = 1; if (EXIT(ch, dir)) { if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword) { sprintf(buf, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword)); send_to_char(buf, ch); return; } else if (EXIT_FLAGGED(EXIT(ch, dir), EX_ISDOOR) && EXIT(ch, dir)->keyword) { sprintf(buf, "You look through the open %s.\r\n", fname(EXIT(ch, dir)->keyword)); send_to_char(buf, ch); } if (CAN_GO(ch, dir)) { target_room = world[ch->in_room].dir_option[dir]->to_room; } if (target_room == -1) { send_to_char("There isn't anything in that direction.\r\n",ch); return; } sprintf(buf, "You look %s.\r\n", dirs[dir]); send_to_char(buf, ch); { if (!ch->desc) return; /* If you use darkvision, either change the function CAN_SEE_IN_DARK in utils.h or add another && for darkvision to the pitch black check (Ideally you'd want to add it to CAN_SEE_IN_DARK) */ if (IS_DARK(target_room) && !CAN_SEE_IN_DARK(ch)) { send_to_char("&DIt is pitch black...&n\r\n", ch); return; } else if (AFF_FLAGGED(ch, AFF_BLIND)) { send_to_char("&DYou see nothing but infinite darkness...&n\r\n", ch); return; } send_to_char(CCCYN(ch, C_NRM), ch); if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_ROOMFLAGS)) { sprintbit(ROOM_FLAGS(target_room), room_bits, buf); sprintf(buf2, "[%5d] %s [ %s]", GET_ROOM_VNUM(target_room), world[target_room].name, buf); send_to_char(buf2, ch); } else send_to_char(world[target_room].name, ch); send_to_char(CCNRM(ch, C_NRM), ch); send_to_char("\r\n", ch); /* You might want to do something with the infravision flag here (if you use it) perhaps making it so that infra characters only see room names or some such, or only see red outlines of mobs, etc */ if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief || ROOM_FLAGGED(target_room, ROOM_DEATH)) send_to_char(world[target_room].description, ch); /* autoexits */ if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOEXIT)) do_auto_exits(ch); /* now list characters & objects */ send_to_char(CCNRM(ch, C_NRM), ch); list_obj_to_char(world[target_room].contents, ch, 0, FALSE); send_to_char(CCNRM(ch, C_NRM), ch); list_char_to_char(world[target_room].people, ch); send_to_char(CCNRM(ch, C_NRM), ch); } } /* If you want your original look_in_direction descriptions to show up too, just take the comments off of the statement below */ /* if (EXIT(ch, dir)->general_description) { send_to_char(EXIT(ch, dir)->general_description, ch); } */ } That's it for look_in_direction, now for the scan command just add ACMD(do_scan); to the top part of interpreter.c, and add { "scan" , POS_RESTING , do_scan , 0, 0 }, down in the s area of the commands. And now for the scan command: in act.informative.c, right above look_in_direction, add: ACMD(do_scan) { int dir = -1; if (AFF_FLAGGED(ch, AFF_BLIND)) { send_to_char("&DYou see nothing but infinite darkness...&n\r\n", ch); return; } else{ for (dir = 0; dir < 6; dir++){ if(CAN_GO(ch, dir)){ look_in_direction(ch, dir); send_to_char("\r\n", ch); } } act("$n scans in all directions.", FALSE, ch, 0, 0, TO_ROOM); } } That should be all. << FTP Uploads 2000/11/12 | Reply | Threaded | Name Change Snippet [by Paolo Greco] >>
|
|