02 May, 2009, boblinski wrote in the 1st comment:
Votes: 0
Okay, the problem here is when I try to add races, everything compiles right, but then it doesn't -save- the race to a created character properly..

I have incremented my merc.h MAX_PC_RACE accordingly..

And here is what I have done in const.c:

under "const struct race_type race_table[] = {" :
{
"quickling", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},

{
"pixie", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},

{
"wingless", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},


and under "const struct pc_race_type pc_race_table[] = {" :
{
"quickling", "Quickl", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

{
"pixie", "Pixie", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

{
"wingless", "Wingle", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

Now I know all these are exactly the same as human.. but it's just for now.. I'll be changing their stats etc at a later stage…

what happens now however, is:

create a character… choose race "wingless"
stat char… char race=wingless.
log char off the mud..
log char back on..
stat char.. char race=pixie
log char off the mud..
log char back on..
stat char.. char race=quickling

As far as I can tell, this keeps happening all the way back up to the top of my race list.. (human)..

I have no idea what I've done wrong.. every tutorial I can find just says to add the two things in const.c and increment max_pc_race.

Hope this makes sense!
02 May, 2009, Sandi wrote in the 2nd comment:
Votes: 0
After saving, what does the pfile say?
02 May, 2009, boblinski wrote in the 3rd comment:
Votes: 0
the pfile changes with it.. ie in the example above, my pfile looked like:



Prom <%hhp %mm %vmv> ~
Race quickling~
Sex 1



Weird huh?
02 May, 2009, ghasatta wrote in the 4th comment:
Votes: 0
{
"wingless", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},


Why is that final comma there? You did add the races to the end, right? There isn't anything more that you didn't show, right?
02 May, 2009, boblinski wrote in the 5th comment:
Votes: 0
ghasatta said:
Why is that final comma there? You did add the races to the end, right? There isn't anything more that you didn't show, right?


Actually there are even more races after that point.. I just chose this segment of the structure to demonstrate what I'm doing..

The end of the code ends with:
{
"unique", FALSE,
0, 0, 0, 0,
0, 0, 0,
0, 0},


{
NULL, 0, 0, 0, 0, 0, 0}
};
02 May, 2009, Skol wrote in the 6th comment:
Votes: 0
http://www.mudbytes.net/index.php?a=file...

Remember, your races have to be in _exactly_ the same order in both tables for PC races, including the NULL one at the front etc.
03 May, 2009, boblinski wrote in the 7th comment:
Votes: 0
This is going to be mighty spammy but here's my race stuff:
const struct race_type race_table[] = {
/*
{
name, pc_race?,
act bits, aff_by bits, aff2_by bits, off bits,
imm, res, vuln,
form, parts
},
*/
{"unique", FALSE, 0, 0, 0, 0, 0, 0, 0, 0},

/**** Human *******/
// "human"
{
"human", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},

/**** Half Human ***/
// "Dwarf"
{
"dwarf", TRUE,
0, AFF_INFRARED, 0, 0,
0, RES_POISON | RES_DISEASE, VULN_DROWNING,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Duergar"
{
"duergar", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Halfling"
{
"halfling", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Half Orc"
{
"half orc", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Half Goblin"
{
"half goblin", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},

/**** Demi Human ***/
// "Orc"
{
"orc", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Goblin"
{
"goblin", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Ogre"
{
"ogre", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Troll"
{
"troll", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},

/**** Elf *******/
// "elf" to be deleted**
{
"elf", TRUE,
0, AFF_INFRARED, 0, 0,
0, RES_CHARM, VULN_IRON,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "High Elf"
{
"high elf", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Dark Elf"
{
"dark elf", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Grey Elf"
{
"grey elf", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Wild Elf"
{
"wild elf", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},

/**** Giant *******/
// "giant" to be deleted**
{
"giant", TRUE,
0, 0, 0, 0,
0, RES_FIRE | RES_COLD, VULN_MENTAL | VULN_LIGHTNING,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Fire Giant"
{
"fire giant", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Frost Giant"
{
"frost giant", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Cloud Giant"
{
"cloud giant", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Earth Giant"
{
"earth giant", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Hill Giant"
{
"hill giant", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Marsh Giant"
{
"marsh giant", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},

/**** Fey *******/
// "Quickling"
{
"quickling", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Pixie"
{
"pixie", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Wingless"
{
"wingless", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Sandling"
{
"sandling", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},

/**** Beast *******/
// "Katta"
{
"katta", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Minotaur"
{
"minotaur", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Centaur"
{
"centaur", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},
// "Reptilian"
{
"reptilian", TRUE,
0, 0, 0,
0, 0, 0,
A | H | M | V, A | B | C | D | E | F | G | H | I | J | K},


//NPC RACES FROM HERE ON–>

/***DELETED NPC RACES TO SAVE SPACE ON FORUM***/

{
NULL, 0, 0, 0, 0, 0, 0}
};

const struct pc_race_type pc_race_table[] = {
{"null race", "", 0, {100, 100, 100, 100},
{""}, {13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, 0},


/**** Human *******/
// "human"
{
"human", "Human", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

/**** Half Human ***/
// "Half Elf"
{
"half elf", "H-Elf", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Dwarf"
{
"dwarf", "Dwarf", 8, {150, 100, 125, 100},
{"berserk"},
{14, 12, 14, 10, 15}, {20, 16, 19, 14, 21}, SIZE_MEDIUM},
// "Duergar"
{
"duergar", "Duerga", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Halfling"
{
"halfling", "Halfli", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Half Orc"
{
"half orc", "H-Orc", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Half Goblin"
{
"half goblin", "H-Gob", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

/**** Demi Human ***/
// "Orc"
{
"orc", "Orc", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Goblin"
{
"goblin", "Goblin", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Ogre"
{
"ogre", "Ogre", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Troll"
{
"troll", "Troll", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

/**** Elf *******/
// "elf" to be deleted**
{
"elf", " Elf ", 5, {100, 125, 100, 120},
{"sneak", "hide"},
{12, 14, 13, 15, 11}, {16, 20, 18, 21, 15}, SIZE_MEDIUM},
// "High Elf"
{
"high elf", "High-E", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Dark Elf"
{
"dark elf", "Dark-E", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Grey Elf"
{
"grey elf", "Grey-E", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Wild Elf"
{
"wild elf", "Wild-E", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

/**** Giant *******/
// "giant" to be deleted**
{
"giant", "Giant", 6, {200, 150, 150, 105},
{"bash", "fast healing"},
{10, 15, 15, 14, 20}, {28, 18, 19, 18, 25}, SIZE_GIANT},
// "Fire Giant"
{
"fire giant", "Fire", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Frost Giant"
{
"frost giant", "Frost", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Cloud Giant"
{
"cloud giant", "Cloud", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Earth Giant"
{
"earth giant", "Earth", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Hill Giant"
{
"hill giant", "Hill", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Marsh Giant"
{
"marsh giant", "Marsh", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

/**** Fey *******/
// "Quickling"
{
"quickling", "Quickl", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Pixie"
{
"pixie", "Pixie", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Wingless"
{
"wingless", "Wingle", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Sandling"
{
"sandling", "Sandli", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

/**** Beast *******/
// "Katta"
{
"katta", "Katta", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Minotaur"
{
"minotaur", "Minota", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Centaur"
{
"centaur", "Centau", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},
// "Reptilian"
{
"reptilian", "Reptil", 0, {100, 100, 100, 100},
{""},
{13, 13, 13, 13, 13}, {18, 18, 18, 18, 18}, SIZE_MEDIUM},

}; /*end*/
03 May, 2009, Sharmair wrote in the 8th comment:
Votes: 0
You might want to put Half-Elf between Human and Dwarf in the race_table array.
03 May, 2009, boblinski wrote in the 9th comment:
Votes: 0
Wow that was very silly.. That along with +1 to MAX_PC_RACE fixed the problem…

I'm now trying to have the races displayed in a list at creation.. rather then a paragraph…

currently:
Quote
The following races are available:
human half elf dwarf duergar halfling half orc half goblin orc goblin ogre troll elf high elf
What is your race (help for more information)?


wanted:
Quote
The following races are available:
human
half elf
dwarf
duergar
halfling
half orc
half goblin
orc
goblin
ogre
troll
elf
high elf
What is your race (help for more information)?



I found the part of code I need to change.. but I'm just not sure how I'm meant to change it…

Here's the code:
send_to_desc ("The following races are available:\n\r  ", d);
for (race = 1; race_table[race].name != NULL; race++)
{
if (!race_table[race].pc_race)
break;
write_to_buffer (d, race_table[race].name, 0);
write_to_buffer (d, " ", 1);
}
write_to_buffer (d, "\n\r", 0);
send_to_desc ("What is your race (help for more information)? ",
d);
d->connected = CON_GET_NEW_RACE;
break;


I thought all I might have to do is change line 7 to:

"write_to_buffer (d, " \r\n", 1);

But that didn't seem to change anything.
03 May, 2009, Sharmair wrote in the 10th comment:
Votes: 0
Try making it:
write_to_buffer(d, "\r\n ", 3);

Note the space after the \r\n (and I commend you for using the correct line ends).
The number here (3) is the number of chars to output, a value of 0 will force it to
do a strlen() to figure it out, but here we know it is 3 (CR-LF-SP) so we can use
the specific number. Zero would work too, but a 1 will tell it to just output 1 char
(in your case the space). If you did use 3 (or 0) in your line, it would work almost
as you want, it would put a space at the END of the race name before the line end,
so the names would not be indented, but would be on their own lines.
03 May, 2009, Skol wrote in the 11th comment:
Votes: 0
You might do column display too Bob.

More like:
The following races are available:
human half orc ogre
half elf half goblin troll
dwarf orc elf
duergar goblin high elf
halfling
What is your race? (help <race> for more information)
03 May, 2009, Skol wrote in the 12th comment:
Votes: 0
Ps. How to do that (untest btw, just wrote it sorry):
int i;
char buf[64];// [64]<- There's probably a better way to do this more accurately.
for (race = 1, i=0; race_table[race].name != NULL; race++)
{
if (!race_table[race].pc_race)
break;
sprintf (buf, " %12.12s", race_table[race].name);
write_to_buffer (d, buf, 0);
if (++i %3 == 0)
write_to_buffer (d, "\r\n", 0);
}
write_to_buffer (d, "\r\n", 0);
send_to_desc ("What is your race (help for more information)? ", d);
d->connected = CON_GET_NEW_RACE;
break;
0.0/12