Re: [CODE]jail/spec_proc

From: Mike Breuer (
Date: 01/21/02

Here's a quick stab based on some other code I have.  You don't say how
the jailman will know whether the player is allowed to pass, so I'll
suggest a method:

  char arg[MAX_INPUT_LENGTH];
  struct char_data *mob = (struct char_data *)me;
  char hor_message[] = "$n tells you, "
                       "'You may enter the Hall of Records now.'";
  char no_hor_vict[] = "$n tells you, "
                       "'You cannot pass through!'";
  char no_hor_room[] = "$n will not allow $N to pass!";
  struct affected_type af;

  if (FIGHTING(mob) || !AWAKE(mob))
    return FALSE;

  if (!ch || IS_NPC(ch))
    return FALSE;

  if (CMD_IS("tell")) {
    argument = one_argument(argument, arg);

    if (!isname(GET_NAME(mob), arg))
       return FALSE;

    if (str_cmp(argument, "hall of records") == 0) {
      act(hor_message, FALSE, mob, 0, ch, TO_VICT);

      memset((char *)&af, 0, sizeof(af));
      af.type = SPELL_ALLOWPASS;
      af.duration = 1;
      af.bitvector = AFF_ALLOWPASS;
      affect_to_char(ch, &af);

    return TRUE;

  if (!IS_MOVE(cmd)) || AFF_FLAGGED(mob, AFF_BLIND))
    return FALSE;

  if (cmd == SCMD_EAST && !AFF_FLAGGED(ch, AFF_ALLOWPASS)) {
    /* assumes hall is east */
    act(no_hor_vict, FALSE, mob, 0, ch, TO_VICT);
    act(no_hor_room, FALSE, mob, 0, ch, TO_NOTVICT);

    return TRUE;

  return FALSE;

As you can see, this function uses a spell "ALLOWPASS" to indicate that
a player can pass by.  It assumes that the hall of records is to the
east, though you can easily change this to another direction.

This is just one way to do need to go into all the
possibilities here.  Adding the spell and affect is left as an exercise
for the reader.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT