Welcome to the Builder Academy

Question Need help with a race issue - Still need help on this subject.

More
05 Apr 2013 06:37 - 06 Apr 2013 23:22 #1790 by JTP
Hey

Im trying to make races do more with this, does it look ok ?
first part down to else { is males heights, after else { is females:

void set_height_by_race(struct char_data *ch)
{
if (GET_SEX(ch) == SEX_MALE)
{
if (IS_HALF_GIANT(ch))
GET_HEIGHT(ch) = 180 + dice(1, 10);
else if (IS_DWARF(ch))
GET_HEIGHT(ch) = 43 + dice(1, 10);
else if (IS_GNOME(ch))
GET_HEIGHT(ch) = 38 + dice(1, 6);
else if (IS_ELF(ch))
GET_HEIGHT(ch) = 55 + dice(1, 10);
else /* if (IS_HUMAN(ch)) */
GET_HEIGHT(ch) = 60 + dice(2, 10);
}
else { /* if (IS_FEMALE(ch)) */
if (IS_HALF_GIANT(ch))
GET_HEIGHT(ch) = 170 + dice(1, 10);
else if (IS_DWARF(ch))
GET_HEIGHT(ch) = 41 + dice(1, 10);
else if (IS_GNOME(ch))
GET_HEIGHT(ch) = 36 + dice(1, 6);
else if (IS_ELF(ch))
GET_HEIGHT(ch) = 50 + dice(1, 10);
else /* if (IS_HUMAN(ch)) */
GET_HEIGHT(ch) = 59 + dice(2, 10);
}

return;
}


The half giant part should make them taller then 180 centimeters, but i made a test char that turned out to be only 96 centimeters.

Anyone who can help me get this to work, pls ?
Like is there something missing in the height code ?
Last edit: 06 Apr 2013 23:22 by JTP.

Please Log in or Create an account to join the conversation.

More
06 Apr 2013 23:46 #1825 by thomas
Character height is a ubyte:
Code:
struct char_player_data { char passwd[MAX_PWD_LENGTH+1]; /**< PC's password */ char *name; /**< PC / NPC name */ char *short_descr; /**< NPC 'actions' */ char *long_descr; /**< PC / NPC look description */ char *description; /**< NPC Extra descriptions */ char *title; /**< PC / NPC title */ byte sex; /**< PC / NPC sex */ byte chclass; /**< PC / NPC class */ byte level; /**< PC / NPC level */ struct time_data time; /**< PC AGE in days */ ubyte weight; /**< PC / NPC weight */ ubyte height; /**< PC / NPC height */ };
unsigned bytes have values in the range 0-255, and it should work for you. However, it may be wrong where you print it out; please check that function.

Please Log in or Create an account to join the conversation.

More
07 Apr 2013 17:27 - 07 Apr 2013 18:02 #1841 by JTP
I just found this in DB.C:
/* Bias the height and weight of the character depending on what gender
* they have chosen. While it is possible to have a tall, heavy female it's
* not as likely as a male. Height is in centimeters. Weight is in pounds.
* The only place they're ever printed (in stock code) is SPELL_IDENTIFY. */
if (GET_SEX(ch) == SEX_MALE) {
GET_WEIGHT(ch) = rand_number(120, 180);
GET_HEIGHT(ch) = rand_number(160, 200); /* 5'4" - 6'8" */
} else {
GET_WEIGHT(ch) = rand_number(100, 160);
GET_HEIGHT(ch) = rand_number(150, 180); /* 5'0" - 6'0" */
}

1: Could that have affected my race height code ?
2: Could this code above be changed instead into something simuler to my code ?

Maybe just put my code in there instead:
if (GET_SEX(ch) == SEX_MALE) {
if (IS_HALF_GIANT(ch))
GET_WEIGHT(ch) = 180 + dice(1, 10);
GET_HEIGHT(ch) = 180 + dice(1, 10);
else if (IS_DWARF(ch))
GET_WEIGHT(ch) = 43 + dice(1, 10);
GET_HEIGHT(ch) = 43 + dice(1, 10);
else if (IS_GNOME(ch))
GET_WEIGHT(ch) = 43 + dice(1, 10);
GET_HEIGHT(ch) = 43 + dice(1, 10);
else if (IS_ELF(ch))
GET_WEIGHT(ch) = 55 + dice(1, 10);
GET_HEIGHT(ch) = 55 + dice(1, 10);
else /* if (IS_HUMAN(ch)) */
GET_WEIGHT(ch) = 60 + dice(2, 10);
GET_HEIGHT(ch) = 60 + dice(2, 10);
} else { /* if (IS_FEMALE(ch)) */
if (IS_HALF_GIANT(ch))
GET_WEIGHT(ch) = 170 + dice(1, 10);
GET_HEIGHT(ch) = 170 + dice(1, 10);
else if (IS_DWARF(ch))
GET_WEIGHT(ch) = 41 + dice(1, 10);
GET_HEIGHT(ch) = 41 + dice(1, 10);
else if (IS_GNOME(ch))
GET_WEIGHT(ch) = 36 + dice(1, 6);
GET_HEIGHT(ch) = 36 + dice(1, 6);
else if (IS_ELF(ch))
GET_WEIGHT(ch) = 50 + dice(1, 10);
GET_HEIGHT(ch) = 50 + dice(1, 10);
else /* if (IS_HUMAN(ch)) */
GET_WEIGHT(ch) = 59 + dice(2, 10);
GET_HEIGHT(ch) = 59 + dice(2, 10);
}
Last edit: 07 Apr 2013 18:02 by JTP.

Please Log in or Create an account to join the conversation.

More
07 Apr 2013 17:52 #1844 by DirtyDevil
Something I have always done when coding and think another piece of code is affecting another is to comment out the code and test.
From what you have posted it does look like that other code is affecting yours. Probably no reason why you could not replace that piece of code with yours.

Just add the code test and see what happens.

I really need to get back up to speed with this codebase. Last time I worked on Circle was between 1994 and 1998

Please Log in or Create an account to join the conversation.

More
07 Apr 2013 18:05 - 07 Apr 2013 18:08 #1845 by JTP
Well there is no need for me to have it in races.c if i can replace what i found in db.c :)
Last edit: 07 Apr 2013 18:08 by JTP.

Please Log in or Create an account to join the conversation.

More
07 Apr 2013 18:14 #1846 by JTP
cant seem to find where max height and weight are defined, someone pls write.

Please Log in or Create an account to join the conversation.

Time to create page: 0.193 seconds