[code] Newbie equipping mobile (fwd)

From: Alvoria MUD (mudguy@conan.ids.net)
Date: 12/07/96


Okie... first of all, I don't think you need to check the argument on
this, because all you want them to do is type newbie and receive their eq.
Second, if you are doing a CMD_IS(), the 'victim' will be ch, because ch
is always the mob/player that activates the spec_proc (so in this case, it
will always be a player typing newbie.) Now, if you want the mob to say
something, because ch will be called as the person who activated it, you
will have to use (struct char_data *me) or perhaps add another variable of
type struct char_data * and assign the value of me to it. (look at the
prototype of the SPECIAL() to see what I mean.) Er... one last thing you
forgot to mention... were you using a player of level greater than 3 when
trying to test this proc? It won't work if you do... :P.

Oh... one more thing... this would make a neat loop to get past the first
3 levels... ie get equipped, go to the dump and junk the eq (and thus gain
xp instead of gold), then go back to the mob with the proc, get equipped,
etc... I'm not sure how you would want to deal with this though... but you
do have the log to let you know if someone does this.

Here is a corrected proc...

SPECIAL(newbie)
{
  struct char_data *self;
  struct obj_data *obj;
  int z;

  int give_obj[] = { 3040, 3041, 3042, 3043, 3044, 3045, 3046, -1};

  self=(struct char_data *me);

  /* remove the next line after you have checked that it is working
     correctly */
  act("$n says,'Getting this far, to the CMD_IS function.'", FALSE,
      self, 0, 0, TO_ROOM);

  if (CMD_IS("newbie"))
    {
      if (GET_LEVEL(ch) > 3) {
        act("$n says, 'I think you're a little too experienced"
            " for me to help.'", FALSE, self, 0, ch, TO_VICT);

/* You don't need the wait_state here... if the intention is to make the
   player pause just as for a normal command, the command interpreter will
   do this automatically when control returns to it */
/*        WAIT_STATE(ch, PULSE_VIOLENCE); */

        act("$n says, 'Sorry.'", FALSE, self, 0, 0, TO_ROOM);
        return TRUE;
      }

      /* If they made it this far, they are eligible for the mob's help */
      /* So, we help them!                                              */
     
      for (z = 0; give_obj[z] != -1; z++) {
        obj = read_object(give_obj[z], VIRTUAL);
        if (obj == NULL)
          continue;
        obj_to_char(obj, ch);
      }

      act("$n says, 'Here you go.'", FALSE, self, 0, ch, TO_VICT);
      act("$n gives you several items.", FALSE, self, 0, ch, TO_VICT);
      act("$n gives $N several items.", FALSE, self, 0, ch, TO_NOTVICT);
      act("$n pats $N on the head.", FALSE, self, 0, ch, TO_NOTVICT);
      act("$n pats you on the head.", FALSE, self, 0, ch, TO_VICT);
      act("$n smiles broadly.", FALSE, ch, 0, 0, TO_ROOM);
      sprintf(buf, "%s was newbie equipped.", GET_NAME(ch));
      mudlog(buf, CMP, LVL_IMMORT, TRUE);
      return TRUE;
  }

  if(cmd)
    return FALSE;

  if(AWAKE(ch)) /* since it's not a cmd being processed, ch is now the mob
                   whom the spec is assigned to. */
    {
      switch (number(0, 5))
        {
          case 0:
            act("$n says, 'Anyone new here need help?'", FALSE,
                ch, 0, 0, TO_ROOM);
            break;
          case 1:
            act("$n says, 'I'm a very helpful mobile.'", FALSE,
                ch, 0, 0, TO_ROOM);
            break;
          case 2:
            act("$n says, 'I can help you.  Trust me.'", FALSE,
                ch, 0, 0, TO_ROOM);
            break;
          case 3:
             act("$n says, 'If anyone needs help, just say it.'", FALSE,
                 ch, 0, 0, TO_ROOM);
             break;
          default:
             break;
        }
      return TRUE;
    }
  return FALSE;
}

Alvoria MUD -- "Great... so now we have several types of poison... Ugh..."
  Address   -- telnet://conan.ids.net:4000/
  Homepage  -- http://users.ids.net/~mudguy/
  (under construction, perhaps not even updated for months to come)


+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST