Re: Adding Race Skills

From: Stephen Wolfe (siv@CYBERENET.NET)
Date: 06/24/98


> many of the attemtps I have tried, though none of them allowed for the
> skill to be used, and many other cause other problems. Has anyone coded it
> so that at certain levels (different from the ones of classes) a race could
> get a skill, say, sneak? Or coded it so that races can get skills at
> different levels and practice them, along with the skills they get from
> their class type? Help, or at least a direction on this would be very
> appreciated.

ok..this post was kind of old (like a week), but i just got the chance to
reply..anyway, this is how i added race skills..

siv

i changed the spell_info struct to be like:
struct spell_info_type {
   byte min_position;   /* Position for caster   */
   int mana_min;        /* Min amount of mana used by a spell (highest lev) */
   int mana_max;        /* Max amount of mana used by a spell (lowest lev) */
   int mana_change;     /* Change in mana used by spell from lev to lev */

-> int class_level[NUM_CLASSES];
-> int race_level[NUM_RACES];
   int routines;
   byte violent;
   int targets;         /* See below for use with TAR_XXX  */
};

then in the assignment part, added another parameter (CLASS_SKILL or
RACE_SKILL) so that you would assign a skill like this:
spell_level(SPELL_HASTE, CLASS_MAGE, 35, CLASS_SKILL);
spell_level(SPELL_HASTE, RACE_IMP, 35, RACE_SKILL);

void spell_level(int spell, int which, int level, int race_or_class)
{
  char buf[256];
  int bad = 0;

  if (spell < 0 || spell > TOP_SPELL_DEFINE) {
    sprintf(buf, "SYSERR: attempting assign to illegal spellnum %d", spell);
    log_info(buf);
    return;
  }
  if (race_or_class == CLASS) {
    if (which < 0 || which >= NUM_CLASSES) {
      sprintf(buf, "SYSERR: assigning '%s' to illegal class %d",
              skill_name(spell), which);
      log_info(buf);
      bad = 1;
    }
  } else if (race_or_class == RACE) {
    if (which < 0 || which >= NUM_RACES) {
      sprintf(buf, "SYSERR: assigning '%s' to illegal race %d",
              skill_name(spell), which);
      log_info(buf);
      bad = 1;
    }
  } else {
    log_info("SYSERR: trying to assign spell to something not race or class.\r\n");
    bad = 1;
  }

  if (level < 1 || level > LVL_IMPL) {
    sprintf(buf, "SYSERR: assigning '%s' to illegal level %d",
            skill_name(spell), level);
    log_info(buf);
    bad = 1;
  }
  if (!bad) {
    if (race_or_class == CLASS)
      skill_info[spell].class_level[which] = level;
    else
      skill_info[spell].race_level[which] = level;
  }
}

then in the guildmaster code..i something like this..that would tell them
to seek a race leader to practice race skills that show up when they type
'prac':

    if ((skill_num < 1) ||
        (GET_LEVEL(ch) < skill_info[skill_num].class_level[(int) GET_CLASS(ch)])) {
      sprintf(buf, "You can not practice that %s here.\r\n", SPLSKL(ch));
      send_to_char(buf, ch);
      if ((skill_num > 0) &&
          (GET_LEVEL(ch) >= skill_info[skill_num].race_level[(int) GET_RACE(ch)]))
        send_to_char("You must seek a race leader to practice that.\r\n", ch);
      return 1;
    }

then i basically made a copy of the guildmaster code for race
leaders..let's see..and i changed list_skills to look like this:

void list_skills(struct char_data *ch)
{
  int i, sortpos;

  if (!GET_PRACTICES(ch))
    strcpy(buf, "You have no practice sessions remaining.\r\n");
  else
    sprintf(buf, "You have %d practice session%s remaining.\r\n",
            GET_PRACTICES(ch), (GET_PRACTICES(ch) == 1 ? "" : "s"));

  sprintf(buf, "%sYou may practice the following %ss:\r\n", buf, SPLSKL(ch));
  sprintf(buf, "%s(type 'skills' to get a list of skills you know)\r\n", buf);
  strcpy(buf2, buf);

  for (sortpos = 1; sortpos < MAX_SKILLS; sortpos++) {
    i = spell_sort_info[sortpos];
    if (strlen(buf2) >= MAX_STRING_LENGTH - 32) {
      strcat(buf2, "**OVERFLOW**\r\n");
      break;
    }
    if (((GET_LEVEL(ch) >= skill_info[i].class_level[(int) GET_CLASS(ch)]) ||
         (GET_LEVEL(ch) >= skill_info[i].race_level[(int) GET_RACE(ch)]))
        && (GET_SKILL(ch, i) < 97)) {
      sprintf(buf, "%-20s %s\r\n", spells[i], how_good(GET_SKILL(ch, i)));
      strcat(buf2, buf);
    }
  }

  page_string(ch->desc, buf2, 1);
}


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



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