On Wed, 12 Jun 1996, Brian Williams - Nashak wrote:
> I got no bugs now.. fixed martial arts.. but I was wondering, how could
> you restrict classes to certain races.. like so monks can't be trolls,
> etc.. and it wouldn't say it on the menu.. like la la.. pick troll, then
> up comes class menu.. then la la ... only says "warrior" instead of
> cleric sorcerer monk thief warrior
> thanks ahead of time
>
> Brian
> Nashak
> etc etc
>
The following code from our class.c file shows how to do this
[snip]
/* Races */
const char *race_menu =
"\r\n"
" Select a race\r\n"
"Human Halfling\r\n"
"Dwarf Troll\r\n"
"Elf Half-Orc\r\n"
"Half-Elf\r\n";
const char *race_abbrevs[] = {
"U?",
"Hu",
"Dw",
"El",
"Tr",
"He",
"Ho",
"Ha",
"Or", /* These are non-PC races */
"Gi",
"Ot",
"Hn",
"Dr",
"LA",
"WA",
"FA",
"Un",
"Em",
"Sp",
"Pl",
"Go",
"De",
"Ch",
"Re",
"\n"
};
char *race_types[] = {
"Unknown",
"Human",
"Dwarf",
"Elf",
"Troll",
"Half-Elf",
"Half-Orc",
"Halfling",
"Orc",
"Giant",
"Other",
"Humanoid",
"Dragon",
"Land Animal",
"Water Animal",
"Flying Animal",
"Undead",
"Elemental",
"Spirit",
"Plant",
"Goblin",
"Demon",
"Chaos",
"Reptile",
"\n"
};
int parse_race(char *arg, int mode)
{
int race;
if ((race = search_block(arg, race_types, 0)) < 0)
return(RACE_UNKNOWN);
if (mode && (race >= NUM_PC_RACES))
return(RACE_UNKNOWN);
return(race);
}
/* Many races cannot be all classes. */
const char can_be_class[NUM_CLASSES][NUM_PC_RACES] = {
/* ?? Hu Dw El Tr He Ho Ha */
{ 1, 1, 0, 1, 0, 1, 0, 0 }, /* Mage */
{ 1, 1, 0, 0, 0, 1, 1, 1 }, /* Cleric */
{ 1, 1, 0, 1, 0, 1, 1, 1 }, /* Thief */
{ 1, 1, 1, 1, 1, 1, 1, 0 }, /* Warrior */
{ 1, 1, 1, 1, 0, 1, 1, 1 }, /* Bard */
{ 1, 1, 0, 1, 0, 1, 0, 0 }, /* Dawnlord */
{ 1, 1, 0, 0, 0, 1, 0, 0 }, /* Paladin */
{ 1, 1, 0, 0, 0, 0, 1, 0 }, /* Avenger */
{ 1, 1, 1, 1, 1, 1, 1, 1 }, /* Rogue */
{ 1, 1, 0, 1, 0, 1, 1, 1 }, /* Minstrel */
{ 0, 0, 0, 0, 0, 0, 0, 0 } /* Hero - not selectable */
};
/*
* Generate the appropriate class menu
*/
void get_class_menu(int race, char *buf)
{
int i, lpr = 0;
static char *class_prompts[] = {
"[M] Mage",
"[C] Cleric",
"[T] Thief",
"[W] Warrior",
"[B] Bard",
"[D] Dawnlord",
"[P] Paladin",
"[A] Avenger",
"[R] Rogue",
"[I] Minstrel",
"[H] Hero"
};
sprintf(buf, "\r\nThe available classes for %ss are:\r\n",
race_types[race]);
for(i=0;i<NUM_CLASSES;i++) {
if (can_be_class[i][race]) {
sprintf(buf, "%s %-20s", buf, class_prompts[i]);
lpr++;
if (lpr == 2) {
strcat(buf, "\r\n");
lpr = 0;
}
}
}
}
[snip]
-Tim (Aldric@NewDawn plus other things elsewhere)
Tim can be reached via computer technology at:
e-mail: lostsoul@city.ac.uk (df109@city.ac.uk),
lostsoul@soi.city.ac.uk (df109@soi.city.ac.uk),
lostsoul@mono.org or lostsoul@spodbox.linux.org.uk (MIME)
"Blood, sweat and tears, really don't matter.
Just the things that you do, in this garden"
This archive was generated by hypermail 2b30 : 12/18/00 PST