Welcome to the Builder Academy

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

More
07 Apr 2013 18:29 #1848 by DirtyDevil
The below is in Structs.h

thomas wrote: 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 18:33 #1849 by rudeboyrave
make sure you put the code to set the height and weight after where they choose thier race, otherwise it wouldnt work because height and weight are set usually right after the name and sex.

CyberASSAULT
www.cyberassault.org
cyberassault.org 11111
A post-apocalyptic, sci-fi MUD.

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

More
07 Apr 2013 18:37 #1851 by DirtyDevil
If you need something larger than 255 then an ush_int which is defined as an Unsigned Short in Structs.h has ranges 0 to 65,535

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

More
07 Apr 2013 18:43 #1852 by JTP
Well the stock height and weight is defined in db.c
so guess ill remove it and put in my own.


tnx Dirtydevil forgot about ush_int

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

More
08 Apr 2013 11:04 - 08 Apr 2013 11:31 #1867 by JTP
Code:
send_to_char(ch, "Height: %d - Weight: %d \r\n", GET_HEIGHT(ch), GET_WEIGHT(ch));
.

Ok in order for the code to replace the height/weight in DB.C i had to make it like the code below, it compiles fine. But it seems to me that the weight part works just fine BUT not the height, i made a dwarf it should as male range from:
GET_WEIGHT(ch) = 43 + dice(1, 10);
GET_HEIGHT(ch) = 43 + dice(1, 10);

But the test male dwarf i made got:
Height: 174 <---Way taller then my define
Weight: 52 <---Well within my dwarf male define


The same happend when i made a female elf:
GET_WEIGHT(ch) = 50 + dice(1, 10);
GET_HEIGHT(ch) = 50 + dice(1, 10);

But the test female elf i made got:
Height: 168 <---Again way taller then my define
Weight: 59 <---Again well within my define

I even tried with : rand_number(180, 240); and made a test char that turned out being 172.

What is wrong, why does weight work but not height ??

Code:
IN DB.C /* Called during character creation after picking character class (and then * never again for that character). */ void init_char(struct char_data *ch) { int i; /* below above */ you find below that i remmed out and put in my code */ // 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" */ // } if (GET_SEX(ch) == SEX_MALE) { if (IS_HALF_GIANT(ch)) { GET_WEIGHT(ch) = 180 + dice(1, 10); GET_HEIGHT(ch) = 200 + dice(1, 10); } else if (IS_HALFLING(ch)) { GET_WEIGHT(ch) = 43 + dice(1, 10); GET_HEIGHT(ch) = 43 + 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) = 70 + dice(1, 10); GET_HEIGHT(ch) = 170 + dice(1, 10); } else if (GET_SEX(ch) == SEX_FEMALE) { if (IS_HALF_GIANT(ch)) { GET_WEIGHT(ch) = 170 + dice(1, 10); GET_HEIGHT(ch) = 190 + dice(1, 10); } else if (IS_HALFLING(ch)) { GET_WEIGHT(ch) = 43 + dice(1, 10); GET_HEIGHT(ch) = 43 + 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) = 60 + dice(1, 10); GET_HEIGHT(ch) = 160 + dice(1, 10); }
.
Last edit: 08 Apr 2013 11:31 by JTP.

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

More
08 Apr 2013 11:41 #1868 by zusuk
Hey JTP

Your problem is mismatched brackets... I'd suggest your function looks more like this with the brackets:
Code:
void init_char(struct char_data *ch) { int i; /* you can add more code here */ if (GET_SEX(ch) == SEX_MALE) { if (IS_HALF_GIANT(ch)) { GET_WEIGHT(ch) = 180 + dice(1, 10); GET_HEIGHT(ch) = 200 + dice(1, 10); } else if (IS_HALFLING(ch)) { GET_WEIGHT(ch) = 43 + dice(1, 10); GET_HEIGHT(ch) = 43 + 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) = 70 + dice(1, 10); GET_HEIGHT(ch) = 170 + dice(1, 10); } } else if (GET_SEX(ch) == SEX_FEMALE) { if (IS_HALF_GIANT(ch)) { GET_WEIGHT(ch) = 170 + dice(1, 10); GET_HEIGHT(ch) = 190 + dice(1, 10); } else if (IS_HALFLING(ch)) { GET_WEIGHT(ch) = 43 + dice(1, 10); GET_HEIGHT(ch) = 43 + 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) = 60 + dice(1, 10); GET_HEIGHT(ch) = 160 + dice(1, 10); } } /* you can add more code here */ }

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

Time to create page: 0.202 seconds