|
Level Protection Guards for directions [by Colin Hassall] |
|
|
|
Posted Monday, May 31st @ 08:41:42 PM, by George Greer in the Specials dept.
Colin Hassall writes, "
This snippet is to provide a special procedure
for a guard to block players under a specified
level from passing through a direction."
In the room where you wish to block the players
you will need to add 2 extra descriptions:
"entry_level" the numeric value of the
minimum level to pass through (e.g. 20).
"exit_dir" the textual exit name (currently
this only supports the standard 6 exits with
Circle). (e.g. north).
The exit_dir _IS_ case sensitive, so all lower
case, but I have added the option to use abbrev.
so 'n' can be used instead of 'north'.
You can have only a single blocked exit in a
room, perhaps later versions will allow for
multiple blocks.
Some people _MAY_ argue it's not good to use
the extra descriptions in the room, but I
think it has it's benefits, firstly it can be
edited with OLC (if installed), and therefore
doesn't require a reboot.
If you use this let me know via email. I might
offer some support, but it's far too simple to
really require it.
If you want to give me credit then WOO HOO! I
don't really mind, I know from experience snippets
are rarely credited.
Colin
/*
* To stop players under a specified level from being
* allowed to pass through a specified direction.
*
* Colin Hassall - Starfleet MUD 28/5/99
* telnet mud.starfleetmud.org 4000
*/
SPECIAL(level_guard) {
char *desc, *exit;
int level, exitting = -1, exit_dir = -1;
struct char_data *guard = (struct char_data *) me;
char *buf = "$n humiliates you, and blocks your way.\r\n";
char *buf2 = "$n humiliates $N, and blocks $S way.";
char this_cmd[MAX_STRING_LENGTH];
/* If the player wasn't moving, or we're blind */
if (!IS_MOVE(cmd) || IS_AFFECTED(guard, AFF_BLIND)) {
return FALSE;
}
/* put the direction into a local char */
sprintf(this_cmd, "%s", cmd_info[cmd].command);
/* determine which direction they wanna go in */
if(is_abbrev(this_cmd, "north")) {
exitting = 0;
} else if(is_abbrev(this_cmd, "east")) {
exitting = 1;
} else if(is_abbrev(this_cmd, "south")) {
exitting = 2;
} else if(is_abbrev(this_cmd, "west")) {
exitting = 3;
} else if(is_abbrev(this_cmd, "up")) {
exitting = 4;
} else if(is_abbrev(this_cmd, "down")) {
exitting = 5;
} else {
return FALSE;
}
/* just double check we haven't gone wrong */
if(exitting == -1) {
return FALSE;
}
/* Find both the extra descriptions needed */
if((desc = find_exdesc("entry_level", world[guard->in_room].ex_description)) != NULL) {
if((exit = find_exdesc("exit_dir", world[guard->in_room].ex_description)) != NULL) {
/* Find out what direction the block is in */
if(is_abbrev("north", exit)) {
exit_dir = 0;
} else if(is_abbrev("east", exit)) {
exit_dir = 1;
} else if(is_abbrev("south", exit)) {
exit_dir = 2;
} else if(is_abbrev("west", exit)) {
exit_dir = 3;
} else if(is_abbrev("up", exit)) {
exit_dir = 4;
} else if(is_abbrev("down", exit)) {
exit_dir = 5;
} else {
return FALSE;
}
/* just double check we haven't gone wrong */
if(exit_dir == -1) {
return FALSE;
}
/* they're not going in the blocking dir */
if(exit_dir != exitting) {
return FALSE;
}
/* they're attempting to go in the blocking dir, lets work out if they can */
level = atoi(desc);
if(level) {
if(GET_LEVEL(ch) < level) {
act(buf, FALSE, me, 0, ch, TO_VICT);
act(buf2, FALSE, me, 0, ch, TO_NOTVICT);
return TRUE;
}
}
}
}
return FALSE;
}
<< Improved glance command [by Luke Ehresman] | Reply | Flattened | FTP Uploads 1999/06/03 >> |
|
Related Links |
|
|
|
Features |
|
|
Welcome to the Ceramic Mouse, featuring
Alex's CircleMUD Snippets
in a fully searchable database. If you wish to
submit something,
remember to also to e-mail either
Alex or
myself. Don't
mail the snippet to us, it's much easier to use the submit
procedure. You can also try the
e-mail
submission gateway that does everything automatically.
|
Feel free to poke around and
let me know if
there is anything else I could change. If you think the page
takes too long to render, try the
"light" version, index_L.shtml. It also works for the
main snippets page.
|
If you'd like a link in the "Quick Links" box,
drop me a line
and I'll get you added.
|
|
|
|
|
|
|
Quick Links |
|
|
|