Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Character creation order

Character creation order

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #15 on Tue 26 Jan 2010 08:47 PM (UTC)
Message
Impossible to help without seeing any of your changes, and what the error message is.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by SirRoughknight   (19 posts)  Bio
Date Reply #16 on Thu 28 Jan 2010 05:27 AM (UTC)

Amended on Thu 28 Jan 2010 06:11 AM (UTC) by SirRoughknight

Message
You can always add in a race_restriction to the classes.

grep class_restriction in .c and .h files, see how it works?

define race_restriction in mud.h

and then from observing class_restriction, add in race_restriction to the classes... I believe the files you'll need to edit are act_wiz.c, and tables.c

Then just switch the class_restriction to race_restriction in comm.c

If (IS_SET( class_table[iClass]->race_restriction, 1 << ch->race ) )
{
write_to_buffer( d, "That class is not available to you", 0 );
return;
}


I hope this makes sense, it seemed like the logical fix to me, since you're wanting to switch the order... you need to make races restricted instead of classes?

It works for me in SmaugFUSS1.9 anyway.

That way you can have races before classes, and it wont show the classes that restrict the race as available in the list.
Top

Posted by SirRoughknight   (19 posts)  Bio
Date Reply #17 on Thu 28 Jan 2010 05:54 AM (UTC)

Amended on Thu 28 Jan 2010 06:00 AM (UTC) by SirRoughknight

Message
I just realized how poorly I explained that... here:

in mud.h

struct class_type
{
   const char *who_name;   /* Name for 'who'    */
   EXT_BV affected;
   short attr_prime; /* Prime attribute      */
   short attr_second;   /* Second attribute     */
   short attr_deficient;   /* Deficient attribute     */
add--> int race_restriction;  /* Flags for illegal races  */
   int resist;
   int suscept;
   int weapon; /* First weapon         */
   int guild;  /* Vnum of guild room      */
   short skill_adept;   /* Maximum skill level     */
   short thac0_00;   /* Thac0 for level  0      */
   short thac0_32;   /* Thac0 for level 32      */
   short hp_min;  /* Min hp gained on leveling  */
   short hp_max;  /* Max hp gained on leveling  */
   bool fMana; /* Class gains mana on level  */
   short exp_base;   /* Class base exp    */
};


and in act_wiz.c

void do_showclass( CHAR_DATA* ch, const char* argument)
{
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   struct class_type *Class;
   int cl, low, hi, i, ct;

   set_pager_color( AT_PLAIN, ch );

   argument = one_argument( argument, arg1 );
   argument = one_argument( argument, arg2 );
   if( arg1[0] == '\0' )
   {
      send_to_char( "Syntax: showclass <class> [level range]\r\n", ch );
      return;
   }
   if( is_number( arg1 ) && ( cl = atoi( arg1 ) ) >= 0 && cl < MAX_CLASS )
      Class = class_table[cl];
   else
   {
      Class = NULL;
      for( cl = 0; cl < MAX_CLASS && class_table[cl]; cl++ )
         if( !str_cmp( class_table[cl]->who_name, arg1 ) )
         {
            Class = class_table[cl];
            break;
         }
   }
   if( !Class )
   {
      send_to_char( "No such class.\r\n", ch );
      return;
   }
   pager_printf_color( ch, "&wCLASS: &W%s\r\n&wPrime Attribute: &W%-14s  &wWeapon: &W%-5d      &wGuild: &W%-5d\r\n",
                       Class->who_name, affect_loc_name( Class->attr_prime ), Class->weapon, Class->guild );
   pager_printf_color( ch, "&wSecond Attribute:  &W%-14s  &wDeficient Attribute:  &W%-14s\r\n",
                       affect_loc_name( Class->attr_second ), affect_loc_name( Class->attr_deficient ) );
   pager_printf_color( ch, "&wMax Skill Adept: &W%-3d             &wThac0 : &W%-5d     &wThac32: &W%d\r\n",
                       Class->skill_adept, Class->thac0_00, Class->thac0_32 );
   pager_printf_color( ch, "&wHp Min/Hp Max  : &W%-2d/%-2d           &wMana  : &W%-3s      &wExpBase: &W%d\r\n",
                       Class->hp_min, Class->hp_max, Class->fMana ? "yes" : "no ", Class->exp_base );
   pager_printf_color( ch, "&wAffected by:  &W%s\r\n", affect_bit_name( &Class->affected ) );
   pager_printf_color( ch, "&wResistant to: &W%s\r\n", flag_string( Class->resist, ris_flags ) );
   pager_printf_color( ch, "&wSusceptible to: &W%s\r\n", flag_string( Class->suscept, ris_flags ) );
   
   send_to_char( "Disallowed races: ", ch );
   for( i = 0; i < MAX_RACE; i++ )
   {
      if( IS_SET( Class->race_restriction, 1 << i ) )
      {
         ct++;
         ch_printf( ch, "%s ", race_table[.i]->race_name );
         if( ct % 6 == 0 )
            send_to_char( "\r\n", ch );
      }
   }
   if( ( ct % 6 != 0 ) || ( ct == 0 ) )
      send_to_char( "\r\n", ch );

   ct = 0;
   send_to_char( "Allowed races: ", ch );
   for( i = 0; i < MAX_RACE; i++ )
   {
      if( !IS_SET( Class->race_restriction, 1 << i ) )
      {
         ct++;
         ch_printf( ch, "%s ", race_table[.i]->race_name );
         if( ct % 6 == 0 )
            send_to_char( "\r\n", ch );
      }
   }

That was how mine looks. to prevent the forum from making it italic in I added a [.i] period in there, remove it in the code. Though it does display "unused" when you type showclass # Someone else might be able to clean that up, it eludes me.

in tables.c

search for KEY ( "Resist"

         case 'R':
add-->      KEY( "Races", Class->race_restriction, fread_number( fp ) );
            KEY( "Resist", Class->resist, fread_number( fp ) );
            break;


and...

search for fprintf( fpout, "Class       %d\n", cl );

below it add

fprintf( fpout, "Races     %d\n", Class->race_restriction );


then finally in comm.c

 write_to_buffer( d, "\r\nSelect a class, or type help [class] to learn more about that class.\r\n[", 0 );
   buf[0] = '\0';

   for( iClass = 0; iClass < MAX_PC_CLASS; iClass++ )
   {
      if( class_table[iClass]->who_name && class_table[iClass]->who_name[0] != '\0' 
		  && !IS_SET( class_table[iClass]->race_restriction, 1 << ch->race ) )

and...

 if( iClass == MAX_PC_CLASS
       || !class_table[iClass]->who_name
	   || IS_SET( class_table[iClass]->race_restriction, 1 << ch->race )
       || class_table[iClass]->who_name[0] == '\0' || !str_cmp( class_table[iClass]->who_name, "unused" ) )
   {
      write_to_buffer( d, "That's not a class.\r\nWhat IS your class? ", 0 );
      return;
   }
Top

Posted by SirRoughknight   (19 posts)  Bio
Date Reply #18 on Thu 28 Jan 2010 09:14 AM (UTC)

Amended on Thu 28 Jan 2010 09:16 AM (UTC) by SirRoughknight

Message
On a side note the problem of races not showing up in the list sounds more like a RACE file being incorrectly numbered or the race.lst not set up properly.

Make sure all the races are numbered appropriately 0 - ##, and make sure they appear in descending order in the .lst file

Having two races with the same number or the race.lst out of order will really bugger things up.

race0.race
race1.race
race2.race
$

Otherwise with Nick's instructions switching the race/class functions around in nanny, and adding in race_restrictions like I did seems to work like a charm.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


73,708 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.