Re: Races, an often asked question...

From: Pooge (pooge@pcix.com)
Date: 12/26/95


Edward Long wrote:
> 
>         Well, yes here we go again, Im looking for docs on creating races
> or code or whatever I can get my hands on.  Ive grep'd through the two
> most recent archives, the other two older ones seem to deal mostly with
> 2.20.  Ive seen mention of a 'races doc' but think it was for 2.20.  Id
> take it if I could get it, but didnt find a copy in the files.  If anyone
> has even just the number of the letter in the archive that would help me
> Id be grateful!  Any info would be appriciated, and flamming will not be ;)
> 
> Ironwolf, he who never had a 20 line 'mail chaser'

Here's a 2.20 races.doc that was posted to this list a while ago ... there are
few changes to be made in order to get it to work with 3.0 beta 8 ... Enjoy!

	Many, many thanks to Lupo for sharing the code with me - it saved 
me much time, and gave me a good, stable base. Without further ado, here 
it is:

Here comes what I've done for races. It's just basic stuff, I'll perhaps
improve it later, but It's a good starting point:

1- in structs.h, I've added:

#define RACE_HUMAN      0
#define RACE_DWARF      1
#define RACE_ELF        2
#define RACE_HOBBIT     3
#define RACE_TROLL      4

In the char_specials2_data, instead of
   ubyte spare0;
I've put
   ubyte race;

2- in utils.h,

#define GET_RACE(ch)    ((ch)->specials2.race)

3- in constants.c,

I've added:

const char      *pc_race_type[] = {
        "Humans",
        "Dwarves",
        "Elves",
        "Hobbits",
        "Trolls",
        "\n"
};

and

const int       race_apply[5][5] = {
        {0,0,0,0,0},
        {0,0,0,-1,+1},
        {0,0,0,+1,-1},
        {-1,0,0,+1,0},
        {+2,-1,-1,0,0}
};

This one is for affecting stats (str int wis dex con)

and

const int       race_phy_apply[5][2] = {
        {0,0},
        {-70,-50},
        {-20,-40},
        {-100,-100},
        {30,50}
};

affects races height and weight ...

3- in interpreter.c,

Add question about choosing race (see how it's done for classes, and just
do the same ).

You'll surely need to add #define CON_QRACE 18 in structs.h

4- in act.wizard.c,

in roll_abilities, here is what I've done:

   case CLASS_WARRIOR:
      ch->abilities.str = table[0];
      ch->abilities.dex = table[1];
      ch->abilities.con = table[2];
      ch->abilities.wis = table[3];
      ch->abilities.intel = table[4];
      break;
}

/* Races Modifications (Ludo)   */

   ch->abilities.str = ch->abilities.str + race_apply[GET_RACE(ch)][0];
   ch->abilities.intel = ch->abilities.intel + race_apply[GET_RACE(ch)][1];
   ch->abilities.wis = ch->abilities.wis + race_apply[GET_RACE(ch)][2];
   ch->abilities.dex = ch->abilities.dex + race_apply[GET_RACE(ch)][3];
   ch->abilities.con = ch->abilities.con + race_apply[GET_RACE(ch)][4];

   if (ch->abilities.str>18) {ch->abilities.str=18;ch->abilities.str_add = number(0, 100);};
   if (ch->abilities.intel>18) ch->abilities.intel=18;
   if (ch->abilities.wis>18) ch->abilities.wis=18;
   if (ch->abilities.dex>18) ch->abilities.dex=18;
   if (ch->abilities.con>18) ch->abilities.con=18;

   ch->tmpabilities = ch->abilities;
}

5- in dc.c,

in init_char,

   if (ch->player.sex == SEX_MALE) {
      ch->player.weight = number(120, 180);
      ch->player.height = number(160, 200);
   } else {
      ch->player.weight = number(100, 160);
      ch->player.height = number(150, 180);
   }

   /* modifications according to the race */
   ch->player.weight=ch->player.weight + race_phy_apply[GET_RACE(ch)][1];
   ch->player.height=ch->player.height + race_phy_apply[GET_RACE(ch)][0];

Thanks to Ludo for sharing.

Through the darkness comes the howl, the echo of the fellbeasts of
the Warp.  Alone I stand, knowing full well that death awaits me. 
My sole comfort shall be in knowing that I will not fall alone, and
without sacrifice of something I truly believe in. 
		Warlord Dain Ironson, during the fall of Elras Tror
	
I am Varagol@Netcom.Com		    "Just call me Crank"



This archive was generated by hypermail 2b30 : 12/07/00 PST