Make it force your class

Posted by Lloyd graham on Sun 24 Oct 2004 03:32 AM — 5 posts, 21,505 views.

Canada #0
OK I was grateful for the help with alignment and now am working on classes ( I thought it would be just as easy lol ) but it wasn’t and now IM stuck I want my players to start with no class but found the code didn’t support that so I made a class called NONE and am trying to make the Nany.c set that automatically

This is what IM writhing in


Nanny_Fun(HANDLE_CON_GET_NEW_CLASS)
{
CharData *ch = CH(d);

ch->Class = NONE;

mud_info.stats.newbies++;
d_println(d, "{cWhat time zone do you live in? {x");
d->connected = CON_GET_TIMEZONE;

}

This is the error message IM getting when I compile

$ make install
20:24:53 : Compiling nanny.c...
nanny.c: In function `void HANDLE_CON_GET_NEW_CLASS(Descriptor*, const char*)':
nanny.c:638: error: `NONE' undeclared (first use this function)
nanny.c:638: error: (Each undeclared identifier is reported only once for each
function it appears in.)
make: *** [o/nanny.o] Error 1

IM guessing that I need to tell it to look in my class file to get NONE but I cant think of a way to do that. I may also have made a mistake or two in how IM setting it up too so any help and advice would be appreciated.
Amended on Sun 24 Oct 2004 03:57 AM by Lloyd graham
USA #1
Might try to post this in the SMAUG prgramming forum. That way more programmers will see it
Australia Forum Administrator #2
You say you "made a class called NONE". Did you put it into mud.h, that is where I would put the definition for it. Also might call it NO_CLASS or something more description.
USA #3
You could remove the choose class at creation, and set a mob at the start who will mset the class on the new player to NONE before running them through a tutorial or something.
Australia #4
This thread is getting old i think, but here is a section from my nanny, this is what i did to go classless.

case CON_GET_NEW_SEX:
      switch ( argument[0] )
        {
        case 'm':
        case 'M':
          ch->sex = SEX_MALE;
          break;
        case 'f':
        case 'F':
          ch->sex = SEX_FEMALE;
          break;
        case 'n':
        case 'N':
          ch->sex = SEX_NEUTRAL;
          break;
        default:
          write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 );
          return;
        }

      write_to_buffer( d, "\n\rYou may choose from the following races, or type help [race] to learn more:\n\r[", 0 );
      buf[0] = '\0';
      for ( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
        {
          if (iRace != RACE_VAMPIRE
              && race_table[iRace]->race_name && race_table[iRace]->race_name[0] != '\0'
              && !IS_SET(race_table[iRace]->class_restriction, 1 << ch->class)
              && str_cmp(race_table[iRace]->race_name,"unused") )
            {
              if ( iRace > 0 )
                {
                  if ( strlen(buf)+strlen(race_table[iRace]->race_name) > 77 )
                    {
                      strcat( buf, "\n\r" );
                      write_to_buffer( d, buf, 0 );
                      buf[0] = '\0';
                    }
                  else
                    strcat( buf, " " );
                }
              strcat( buf, race_table[iRace]->race_name );
            }
        }
      strcat( buf, "]\n\r: " );
      write_to_buffer( d, buf, 0 );
      d->connected = CON_GET_NEW_RACE;
      break;



    case CON_GET_NEW_RACE:
        ch->class =  0;


Delete CON_GET_NEW_CLASS, replace GET_SEX with above and add the ch->class = class number at the start of get_new_race.

The real problem is how you display class in things like score and who, I cheated and made a citizen class, tho im thinking of changing that around a bit.