Re: Hello!

From: Patrick Dughi (dughi@imaxx.net)
Date: 04/07/00


>  Hello!!! My name is Alan, I'm Brazilian (then, sorry by the errors...
> my Englosh isn't too good) and I'm TRYING (hehehe) to do a mud... I
> wanna put a healer in my mud.... how can I put it? The code at the
> circle's ftp was a trouble...... Can somebody healp me??

        I think you're refering to the priest/healer spec_proc which alot
of muds put on a character at the mortal entrance room.  Guessing about
that, I'd heard that there were bugs with the posted code on the site.
Since I'm in the mood though, I'll give you some (untested mailer) code.

char *healer_spells[] = {
  "cure light",
  "remove poison",
  "cure blind",
  "heal",
  "healall",
  "\n"
};

int healer_costs[] = {
  10,
  20,
  30,
  40,
  50
};

SPECIAL(healer) {
  struct char_data *healer = (struct char_data *) me;
  char lbuf[2048];
  int i,j;

  extern int healer_costs[];
  extern char *healer_spells[];

  if(IS_NPC(ch) || !CMD_IS("buy")) {
    return 0;
  }

  skip_spaces(&argument);

  sprintf(buf,"Spell\t\t\tPrice\n"
              "-------\t\t\t-------\n");

  if(!*argument || (i=search_block(argument,healer_spells,FALSE))==-1) {
    for(i=0;*healer_spells[i] != '\n';i++) {
      sprintf(buf+strlen(buf),"%s\t\t\t%d\n",healer_spells[i],
        healer_costs[i]);
    }
    send_to_char("My services and costs are listed below.\r\n",ch);
    send_to_char(buf,ch);
    return 1;
  }

  if(GET_GOLD(ch) < healer_costs[i]) {
    send_to_char("You do not have enough money for that service.\r\n",ch);
    return 1;
  } else {
    GET_GOLD(ch) -= healer_costs[i];
  }

  switch (i) {
    case 0:
    case 1:
    case 2:
    case 3:
      j=find_skill_num(healer_spells[i]);
      call_magic(healer, ch, 0, j, 100, CAST_SPELL);
      break;
    case 4:
      GET_MANA(ch) = GET_MAX_MANA(ch);
      GET_MOVE(ch) = GET_MAX_MOVE(ch);
      GET_HIT(ch) = GET_MAX_HIT(ch);
      call_magic(healer,ch,0,SPELL_CURE_BLIND,100,CAST_SPELL);
      call_magic(healer,ch,0,SPELL_REMOVE_POISON,100,CAST_SPELL);
      break;
  }
  return 1;
}

        There, aside from some spelling errors, that should work okay.  Of
course, use at your own risk.  I'm assuming you can figure out how to
attach a spec_proc to a mob, and make it load in a room so I'll leave the
mechanics of that up to you.

                                                PjD


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT