Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, Google

Members: 0
Guests: 6
Stats
Files
Topics
Posts
Members
Newest Member
481
3,735
19,370
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Coding » Races/Classes available to pl...
Forum Rules | Mark all | Recent Posts

Races/Classes available to players
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Feb 2, 2009, 1:39 pm
Go to the top of the page
Go to the bottom of the page

Tseris
Fledgling
GroupMembers
Posts13
JoinedJan 11, 2009

Is there a way to leave races/classes on the race and class lists but restrict players from choosing some of them? Im using SmaugFUSS 1.9 (which is overall excellent btw), and Im adding my own classes while not using others, but when I tried to delete stock races and classes from the list I ran into some serious issues. Ive been looking in the nanny functions in comm.c but im not seeing how to accomplish it.
       
Post is unread #2 Feb 2, 2009, 2:51 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

Not having the code in front of me I can only give you a rough idea of what to do, but in nanny, there's a place that already makes vampires unavailable as a race even though it's coded in as one, you might look at how that was done and simply expand it to include the others that you want to have not available too.
       
Post is unread #3 Feb 2, 2009, 3:11 pm   Last edited Feb 2, 2009, 3:34 pm by Tseris
Go to the top of the page
Go to the bottom of the page

Tseris
Fledgling
GroupMembers
Posts13
JoinedJan 11, 2009

if( iRace == MAX_PC_RACE
       || !race_table[iRace]->race_name || race_table[iRace]->race_name[0] == '\0'
       || iRace == RACE_VAMPIRE
       || IS_SET( race_table[iRace]->class_restriction, 1 << ch->Class )
       || !str_cmp( race_table[iRace]->race_name, "unused" ) )
   {
      write_to_buffer( d, "That's not a race.\r\nWhat IS your race? ", 0 );
      return;
   }


Thats the nanny code, and I had definitely considered that, just replacing RACE_VAMPIRE with RACE_ELF or whatever, but I would like to use the vampire race and Im concerned as to why its in there like that to begin with in stock smaug. If I take out the RACE_VAMPIRE I wonder if it would error the crap out of the game. Guess I could just try and see what happens.

The other concern is that even if I dont allow someone to type Elf, for example, as a race, it would still list it as an option. I wouldnt want players to see a bunch of choices only to have it tell them that half of them cant be played. Heres the rest of the get_race code:

void nanny_get_new_race( DESCRIPTOR_DATA * d, const char *argument )
{
   CHAR_DATA *ch;
   char arg[MAX_STRING_LENGTH];
   int iRace;

   ch = d->character;
   argument = one_argument( argument, arg );
   if( !str_cmp( arg, "help" ) )
   {
      for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
      {
         if( toupper( argument[0] ) == toupper( race_table[iRace]->race_name[0] )
             && !str_prefix( argument, race_table[iRace]->race_name ) )
         {
            do_help( ch, argument );
            write_to_buffer( d, "Please choose a race: ", 0 );
            return;
         }
      }
      write_to_buffer( d, "No help on that topic.  Please choose a race: ", 0 );
      return;
   }


   for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
   {
      if( toupper( arg[0] ) == toupper( race_table[iRace]->race_name[0] )
          && !str_prefix( arg, race_table[iRace]->race_name ) )
      {
         ch->race = iRace;
         break;
      }
   }


Any thoughts as to how I could have it not display those races?
       
Post is unread #4 Feb 2, 2009, 5:29 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

The easiest way to handle this will be to add a boolean value to the race called display and set it to true for the ones you want to show, and false for the ones you don't want to display and then change it to be:

void nanny_get_new_race( DESCRIPTOR_DATA * d, const char *argument )
{
   CHAR_DATA *ch;
   char arg[MAX_STRING_LENGTH];
   int iRace;

   ch = d->character;
   argument = one_argument( argument, arg );
   if( !str_cmp( arg, "help" ) )
   {
      for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
      {
         if( toupper( argument[0] ) == toupper( race_table[iRace]->race_name[0] )
             && !str_prefix( argument, race_table[iRace]->race_name ) && race_table[iRace]->display == TRUE )
         {
            do_help( ch, argument );
            write_to_buffer( d, "Please choose a race: ", 0 );
            return;
         }
      }
      write_to_buffer( d, "No help on that topic.  Please choose a race: ", 0 );
      return;
   }


   for( iRace = 0; iRace < MAX_PC_RACE; iRace++ )
   {
      if( toupper( arg[0] ) == toupper( race_table[iRace]->race_name[0] )
          && !str_prefix( arg, race_table[iRace]->race_name ) && race_table[iRace]->display == TRUE )
      {
         ch->race = iRace;
         break;
      }
   }
       
Post is unread #5 Feb 2, 2009, 9:20 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

If you're going to be having several races that exist but shouldn't be presented to players as an option nor accepted from players as a selection, Kayle's right that adding a boolean to represent each race is the best approach, but to answer your other question, you can safely remove the vampire race restriction if you want to and it won't error at all (or shouldn't as long as you still have the vampire race file in your races folder) but you may want to ensure that it's "balanced" the way you want it to be before doing so. As for why it's in there that way stock, I believe the original smaugdevs over at RoD originally were going to add vampires as a race and then decided to do it as a class instead and just never removed the racial option for them.
       
Post is unread #6 Feb 2, 2009, 9:36 pm
Go to the top of the page
Go to the bottom of the page

Rojan QDel
Fledgling
GroupMembers
Posts25
JoinedDec 30, 2006

The way we handled this in our races OLC at LotJ (which is based on the Smaug one), is to create a flags bitvector, and use it to toggle various useful flags like visible and various other special flags that are only used on a few races.
       
Pages:<< prev 1 next >>