![]() |
I'm trying to add so when you create a character, the race selection is based on what align you are. This shouldnt be too hard, but somehow it's not working for me. I will copy the error message and a bit of code here, if you know what my problem is, please let me know.
Error message: In function 'nanny': struture has no member named 'good' struture has no member named 'neutral' struture has no member named 'evil' And this is what I have added in Merc.h under pc_race_typ struct pc_race_type /* additional data for pc races */ { char * name; char who_name[6]; sh_int points; sh_int class_mult[MAX_CLASS]; char * skills[5]; sh_int stats[MAX_STATS]; sh_int max_stats[MAX_STATS]; sh_int size; int good; int neutral; int evil; }; I also added a TRUE or FALSE statements on every pc race in the race_table in const.c aswell. What am I missing here or is this too little information? Melker. |
I'm not familiar with Merc, but maybe I can help you if you include the code that references the align (or better yet, the whole "nanny" function)
|
It's not Merc, it's RoT code. Just that theres a file named
Merc.h. |
[code]
void nanny( DESCRIPTOR_DATA *d, char *argument ) { DESCRIPTOR_DATA *d_old, *d_next; char buf[MAX_STRING_LENGTH]; char newbuf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; char strsave[MAX_INPUT_LENGTH]; CHAR_DATA *ch; char *pwdnew; char *p; int iClass,race,i,weapon; int pos; bool fOld; while (isspace(*argument)) argument++; ch = d->character; switch (d->connected) { default; bug( "Nanny; bad d->connected %d.", d->connected ); close_socket( d ); return; case CON_GET_NAME; if ( argument[0] == '\0') { close_socket( d ); return; } argument[0] = UPPER(argument[0]); if ( !check_parse_name( argument ) ) { write_to_buffer(d,"Illegal name, try another.\n\r",0); write_to_buffer(d,"(If you've used this name here before, and are no\n\r",0); write_to_buffer(d," longer able to, it may be because we've added a\n\r",0); write_to_buffer(d," new mobile that uses the same name. Log in with\n\r",0); write_to_buffer(d," a new name, and let an IMM know, and we will fix it.)\n\r",0); write_to_buffer(d,"\n\rName; ",0); return; } fOld = load_char_obj( d, argument ); ch = d->character; if (IS_SET(ch->act, PLR_DENY)) { sprintf( log_buf, "Denying access to %s@%s.", argument, d->host ); log_string( log_buf ); write_to_buffer( d, "You are denied access.\n\r", 0 ); close_socket( d ); return; } if (check_ban(d->host,BAN_PERMIT) && !IS_SET(ch->act,PLR_PERMIT)) { write_to_buffer(d,"Your site has been banned from this mud.\n\r",0); close_socket(d); return; } if (IS_SET(ch->comm, COMM_WIPED ) ) { write_to_buffer(d,"You have been wiped.\n\r",0); close_socket( d ); return; } if (check_reconnect(d,argument,FALSE)) fOld = TRUE; else { if ( wizlock && !IS_IMMORTAL(ch)) { write_to_buffer( d, "The game is wizlocked.\n\r", 0 ); close_socket( d ); return; } } if (fOld) { /* Old player */ write_to_buffer( d, "Password; ", 0 ); write_to_buffer( d, echo_off_str, 0 ); d->connected = CON_GET_OLD_PASSWORD; return; } else { /* New player */ if (newlock) { write_to_buffer( d, "The game is newlocked.\n\r", 0 ); close_socket( d ); return; } if (check_ban(d->host,BAN_NEWBIES)) { write_to_buffer(d, "New players are not allowed from your site.\n\r",0); close_socket(d); return; } write_to_buffer(d,"Final Days is not a role-playing MUD, but overly\n\r",0); write_to_buffer(d,"unreasonable character names will not be permitted.\n\r",0); write_to_buffer(d,"The immortal staff has final decision regarding names.\n\r",0); sprintf( buf, "Did I get that right, %s (Y/N)? ", argument ); write_to_buffer( d, buf, 0 ); d->connected = CON_CONFIRM_NEW_NAME; return; } break; case CON_GET_OLD_PASSWORD; write_to_buffer( d, "\n\r", 2 ); if ( strcmp(argument, ch->pcdata->pwd )) { write_to_buffer( d, "Wrong password.\n\r", 0 ); close_socket( d ); return; } write_to_buffer( d, echo_on_str, 0 ); if (check_playing(d,ch->name)) return; ch->pcdata->socket = str_dup(d->host); if (check_reconnect(d,ch->name,TRUE)) return; sprintf(log_buf,"%s@%s has connected.",ch->name,d->host); log_string(log_buf); wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch) ); ch->pcdata->socket = str_dup(d->host); if (IS_SET(ch->act,PLR_REROLL)) { int bplat, bgold, iq, aq, clan, clead, crank; sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name ) ); sprintf(newbuf, "%s", str_dup( ch->pcdata->pwd )); sprintf( argument, "%s", capitalize( ch->name ) ); bplat = ch->platbank; bgold = ch->goldbank; iq = ch->qps; aq = ch->questpoints; clan = ch->clan; clead = ch->clead; crank = ch->pcdata->clanrank; free_char( d->character ); d->character = NULL; fOld = load_char_reroll( d, argument ); ch = d->character; free_string( ch->pcdata->pwd ); ch->pcdata->pwd = str_dup( newbuf ); newbuf[0] = '\0'; ch->pcdata->tier = 1; ch->pcdata->socket = str_dup( d->host ); ch->platbank = bplat; ch->goldbank = bgold; ch->qps = iq; ch->questpoints = aq; ch->clan = clan; ch->clead = clead; ch->pcdata->clanrank = crank; write_to_buffer( d, echo_on_str, 0 ); send_to_desc("{8=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=[{xRaces{8]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\r\n\r",d); pos = 0; for ( race = 1; race_table[race].name != NULL; race++ ) { if (!race_table[race].pc_race) break; sprintf(newbuf,"%6s{8<{C%2d{8> {x%-20s"," ",race,race_table[race].name); send_to_desc(newbuf,d); pos++; if (pos >= 2) { write_to_buffer(d,"\n\r",1); pos = 0; } } newbuf[0] = '\0'; write_to_buffer(d,"\n\r\n\r",0); send_to_desc("Please select a race or type '{8help <race>{x' for more info; ",d); d->connected = CON_GET_NEW_RACE; break; } if ( IS_IMMORTAL(ch) ) { do_help( ch, "imotd" ); d->connected = CON_READ_IMOTD; } else { do_help( ch, "motd" ); d->connected = CON_READ_MOTD; } break; /* RT code for breaking link */ case CON_BREAK_CONNECT; switch( *argument ) { case 'y' ; case 'Y'; for ( d_old = descriptor_list; d_old != NULL; d_old = d_next ) { d_next = d_old->next; if (d_old == d || d_old->character == NULL) continue; if (str_cmp(ch->name,d_old->original ? d_old->original->name ; d_old->character->name)) continue; close_socket(d_old); } ch->pcdata->socket = str_dup( d->host ); if (check_reconnect(d,ch->name,TRUE)) return; write_to_buffer(d,"Reconnect attempt failed.\n\rName; ",0); if ( d->character != NULL ) { free_char( d->character ); d->character = NULL; } d->connected = CON_GET_NAME; break; case 'n' ; case 'N'; write_to_buffer(d,"Name; ",0); if ( d->character != NULL ) { free_char( d->character ); d->character = NULL; } d->connected = CON_GET_NAME; break; default; write_to_buffer(d,"Please type Y or N? ",0); break; } break; case CON_CONFIRM_NEW_NAME; switch ( *argument ) { case 'y'; case 'Y'; sprintf( buf, "New character.\n\rGive me a password for %s; %s", ch->name, echo_off_str ); ch->pcdata->socket = str_dup( d->host ); write_to_buffer( d, buf, 0 ); d->connected = CON_GET_NEW_PASSWORD; break; case 'n'; case 'N'; write_to_buffer( d, "Ok, what IS it, then? ", 0 ); free_char( d->character ); d->character = NULL; d->connected = CON_GET_NAME; break; default; write_to_buffer( d, "Please type Yes or No? ", 0 ); break; } break; case CON_GET_NEW_PASSWORD; write_to_buffer( d, "\n\r", 2 ); if ( strlen(argument) < 5 ) { write_to_buffer( d, "Password must be at least five characters long.\n\rPassword; ", 0 ); return; } pwdnew = argument; for ( p = pwdnew; *p != '\0'; p++ ) { if ( *p == '~' ) { write_to_buffer( d, "New password not acceptable, try again.\n\rPassword; ", 0 ); return; } } free_string( ch->pcdata->pwd ); ch->pcdata->pwd = str_dup( pwdnew ); write_to_buffer( d, "Please retype password; ", 0 ); d->connected = CON_CONFIRM_NEW_PASSWORD; break; case CON_CONFIRM_NEW_PASSWORD; write_to_buffer( d, "\n\r", 2 ); if ( strcmp( argument, ch->pcdata->pwd ) ) { write_to_buffer( d, "Passwords don't match.\n\rRetype password; ", 0 ); d->connected = CON_GET_NEW_PASSWORD; return; } write_to_buffer(d,"\n\r", 2 ); write_to_buffer(d,"You may be good, neutral, or evil.\n\r",0); write_to_buffer(d,"Which alignment (G/N/E)? ",0); d->connected = CON_GET_ALIGNMENT; break; case CON_GET_ALIGNMENT; switch( argument[0]) { case 'g' ; case 'G' ; ch->alignment = 750; break; case 'n' ; case 'N' ; ch->alignment = 0; break; case 'e' ; case 'E' ; ch->alignment = -750; break; default; write_to_buffer(d,"That's not a valid alignment.\n\r",0); write_to_buffer(d,"Which alignment (G/N/E)? ",0); return; } write_to_buffer(d,"\n\r",0); for ( race = 0; race < MAX_PC_RACE; race++ ) { do_help( ch, "NANNY_RACES" ); if (IS_GOOD(ch)) { do_help(ch,"GOOD_RACES"); write_to_buffer(d,"\n\r\n\r",1); send_to_char( "Enter the name of your desired race; ", ch ); d->connected = CON_GET_NEW_RACE; break; } if (IS_NEUTRAL(ch)) { do_help(ch,"NEUTRAL_RACES"); write_to_buffer(d,"\n\r\n\r",1); send_to_char( "Enter the name of your desired race; ", ch ); d->connected = CON_GET_NEW_RACE; break; } if (IS_EVIL(ch)) { do_help(ch,"EVIL_RACES"); write_to_buffer(d,"\n\r\n\r",1); send_to_char( "Enter the name of your desired race; ", ch ); d->connected = CON_GET_NEW_RACE; break; } } break; case CON_GET_NEW_RACE; one_argument(argument,arg); if (!strcmp(arg,"help")) { argument = one_argument(argument,arg); if (argument[0] == '\0') do_help(ch,"race help"); else do_help(ch,argument); write_to_buffer(d, "What is your race (help for more information)? ",0); break; } race = race_lookup(argument); if ((race == 0) || (!race_table[race].pc_race) || (IS_GOOD(ch) && !race_table[race].good) || (IS_NEUTRAL(ch) && !race_table[race].neutral) || (IS_EVIL(ch) && !race_table[race].evil)) { send_to_char( "Invalid selection.\n\rEnter race name; ", ch ); return; } ch->race = race; /* initialize stats */ for (i = 0; i < MAX_STATS; i++) ch->perm_stat[i] = pc_race_table[race].stats[i]; ch->affected_by = ch->affected_by|race_table[race].aff; ch->shielded_by = ch->shielded_by|race_table[race].shd; ch->imm_flags = ch->imm_flags|race_table[race].imm; ch->res_flags = ch->res_flags|race_table[race].res; ch->vuln_flags = ch->vuln_flags|race_table[race].vuln; ch->form = race_table[race].form; ch->parts = race_table[race].parts; /* add skills */ for (i = 0; i < 5; i++) { if (pc_race_table[race].skills[i] == NULL) break; group_add(ch,pc_race_table[race].skills[i],FALSE); } /* add cost */ ch->pcdata->points = pc_race_table[race].points; ch->size = pc_race_table[race].size; write_to_buffer( d, "What is your sex (M/F/N)? ", 0 ); d->connected = CON_GET_NEW_SEX; break; case CON_GET_NEW_SEX; switch ( argument[0] ) { case 'm'; case 'M'; ch->sex = SEX_MALE; ch->pcdata->true_sex = SEX_MALE; break; case 'f'; case 'F'; ch->sex = SEX_FEMALE; ch->pcdata->true_sex = SEX_FEMALE; break; case 'n'; case 'N'; ch->sex = SEX_NEUTRAL; ch->pcdata->true_sex = SEX_NEUTRAL; break; default; write_to_buffer( d, "That's not a sex.\n\rWhat IS your sex? ", 0 ); return; } write_to_buffer( d, echo_on_str, 0 ); write_to_buffer(d,"The following classes are available;\n\r\n\r",0); if (ch->pcdata->tier != 1) { ch->pcdata->tier = 0; for ( iClass = 0; iClass < MAX_CLASS/2; iClass++ ) { write_to_buffer(d," ",0); write_to_buffer(d,class_table[iClass].name,0); write_to_buffer(d,"\n\r",1); } } else { for ( iClass = MAX_CLASS/2; iClass < MAX_CLASS; iClass++ ) { write_to_buffer(d," ",0); write_to_buffer(d,class_table[iClass].name,0); write_to_buffer(d,"\n\r",1); } } write_to_buffer(d,"\n\r\n\r",0); write_to_buffer(d,"What is your class ? ",0); d->connected = CON_GET_NEW_CLASS; break; case CON_GET_NEW_CLASS; iClass = class_lookup(argument); if ( iClass == -1 ) { write_to_buffer( d, "That's not a class.\n\rWhat IS your class? ", 0 ); return; } if (ch->pcdata->tier != 1) { if (iClass >= (MAX_CLASS/2)) { write_to_buffer( d, "That's not a first tier class.\n\rWhat IS your class? ", 0 ); return; } } else { if (iClass < (MAX_CLASS/2)) { write_to_buffer( d, "That's not a second tier class.\n\rWhat IS your class? ", 0 ); return; } } ch->class = iClass; sprintf( log_buf, "%s@%s new player.", ch->name, d->host ); log_string( log_buf ); wiznet("Newbie alert! $N sighted.",ch,NULL,WIZ_NEWBIE,0,0); wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch) ); write_to_buffer(d,"\n\r",0); group_add(ch,"rom basics",FALSE); group_add(ch,class_table[ch->class].base_group,FALSE); ch->pcdata->learned[gsn_recall] = 50; write_to_buffer(d,"Do you wish to customize this character?\n\r",0); write_to_buffer(d,"Customization takes time, but allows a wider range of skills and abilities.\n\r",0); write_to_buffer(d,"Customize (Y/N)? ",0); d->connected = CON_DEFAULT_CHOICE; break; case CON_DEFAULT_CHOICE; write_to_buffer(d,"\n\r",2); switch ( argument[0] ) { case 'y'; case 'Y'; ch->gen_data = new_gen_data(); ch->gen_data->points_chosen = ch->pcdata->points; do_help(ch,"group header"); list_group_costs(ch); write_to_buffer(d,"You already have the following skills;\n\r",0); do_skills(ch,""); do_help(ch,"menu choice"); d->connected = CON_GEN_GROUPS; break; case 'n'; case 'N'; group_add(ch,class_table[ch->class].default_group,TRUE); write_to_buffer( d, "\n\r", 2 ); write_to_buffer(d, "Please pick a weapon from the following choices;\n\r",0); buf[0] = '\0'; for ( i = 0; weapon_table[i].name != NULL; i++) if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) { strcat(buf,weapon_table[i].name); strcat(buf," "); } strcat(buf,"\n\rYour choice? "); write_to_buffer(d,buf,0); d->connected = CON_PICK_WEAPON; break; default; write_to_buffer( d, "Please answer (Y/N)? ", 0 ); return; } break; case CON_PICK_WEAPON; write_to_buffer(d,"\n\r",2); weapon = weapon_lookup(argument); if (weapon == -1 || ch->pcdata->learned[*weapon_table[weapon].gsn] <= 0) { write_to_buffer(d, "That's not a valid selection. Choices are;\n\r",0); buf[0] = '\0'; for ( i = 0; weapon_table[i].name != NULL; i++) if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) { strcat(buf,weapon_table[i].name); strcat(buf," "); } strcat(buf,"\n\rYour choice? "); write_to_buffer(d,buf,0); return; } ch->pcdata->learned[*weapon_table[weapon].gsn] = 40; write_to_buffer(d,"\n\r",2); do_help(ch,"motd"); d->connected = CON_READ_MOTD; break; case CON_GEN_GROUPS; send_to_char("\n\r",ch); if (!str_cmp(argument,"done")) { sprintf(buf,"Creation points; %d\n\r",ch->pcdata->points); send_to_char(buf,ch); sprintf(buf,"Experience per level; %ld\n\r", (long)exp_per_level(ch,ch->gen_data->points_chosen)); if (ch->pcdata->points < 40) ch->train = (40 - ch->pcdata->points + 1) / 2; free_gen_data(ch->gen_data); ch->gen_data = NULL; send_to_char(buf,ch); write_to_buffer( d, "\n\r", 2 ); write_to_buffer(d, "Please pick a weapon from the following choices;\n\r",0); buf[0] = '\0'; for ( i = 0; weapon_table[i].name != NULL; i++) if (ch->pcdata->learned[*weapon_table[i].gsn] > 0) { strcat(buf,weapon_table[i].name); strcat(buf," "); } strcat(buf,"\n\rYour choice? "); write_to_buffer(d,buf,0); d->connected = CON_PICK_WEAPON; break; } if (!parse_gen_groups(ch,argument)) send_to_char( "Choices are; list,learned,premise,add,drop,info,help, and done.\n\r" ,ch); do_help(ch,"menu choice"); break; case CON_READ_IMOTD; write_to_buffer(d,"\n\r",2); do_help( ch, "motd" ); d->connected = CON_READ_MOTD; break; case CON_READ_MOTD; if ( ch->pcdata == NULL || ch->pcdata->pwd[0] == '\0') { write_to_buffer( d, "Warning! Null password!\n\r",0 ); write_to_buffer( d, "Please report old password with bug.\n\r",0); write_to_buffer( d, "Type 'password null <new password>' to fix.\n\r",0); } write_to_buffer(d,"\n\rWelcome to Final Days! Kill or be killed.\n\r",0); ch->next = char_list; char_list = ch; d->connected = CON_PLAYING; reset_char(ch); if ( ch->level == 0 ) { ch->perm_stat[class_table[ch->class].attr_prime] += 3; /* add this while initializing all the racial stuff for new characters */ ch->level = 1; ch->exp = exp_per_level(ch,ch->pcdata->points); ch->hit = ch->max_hit; ch->mana = ch->max_mana; ch->move = ch->max_move; ch->train = 40; ch->practice = 25; set_title(ch,"the adventurer."); //do_pack(ch,"self"); //obj_to_char(create_object(get_obj_index(OBJ_VNUM_M AP),0),ch); //obj_to_char(create_object(get_obj_index(OBJ_VNUM_W MAP),0),ch); //obj_to_char(create_object(get_obj_index(OBJ_VNUM_E MAP),0),ch); char_to_room( ch, get_room_index( ROOM_VNUM_SCHOOL ) ); send_to_char("\n\r",ch); } else if ( ch->in_room != NULL ) { char_to_room( ch, ch->in_room ); } else if ( IS_IMMORTAL(ch) ) { char_to_room( ch, get_room_index( ROOM_VNUM_CHAT ) ); } else { if ( ch->alignment < 0 ) char_to_room( ch, get_room_index( ROOM_VNUM_TEMPLEB ) ); else char_to_room( ch, get_room_index( ROOM_VNUM_TEMPLE ) ); } act( "$n has entered Final Days.", ch, NULL, NULL, TO_ROOM ); if (IS_IMMORTAL(ch) ) { wiznet("$N has entered Final Days.",ch,NULL, WIZ_LOGINS,WIZ_SITES,get_trust(ch)); do_look( ch, "auto" ); } else { sprintf(buf,"%s has entered Final Days.",ch->name); do_announce(ch,buf); do_look( ch, "auto" ); wiznet("$N has entered Final Days.",ch,NULL, WIZ_LOGINS,WIZ_SITES,get_trust(ch)); } if (IS_SET(ch->act,PLR_QUESTOR)) REMOVE_BIT(ch->act,PLR_QUESTOR); if (ch->pet != NULL) { char_to_room(ch->pet,ch->in_room); act("$n has entered Final Days.",ch->pet,NULL,NULL,TO_ROOM); } if (ch->mount != NULL) { char_to_room(ch->mount,ch->in_room); act("$n has entered the game.",ch->mount,NULL,NULL,TO_ROOM); add_follower(ch->mount, ch); do_mount( ch, ch->mount->name); } do_unread(ch,""); break; case CON_CHAR_REROLL; write_to_buffer(d,"The following races are available;\n\r\n\r",0); pos = 0; for ( race = 1; race_table[race].name != NULL; race++ ) { if (!race_table[race].pc_race) break; sprintf(newbuf, "%6s%-24s", " ", race_table[race].name); write_to_buffer(d,newbuf,0); pos++; if (pos >= 2) { write_to_buffer(d,"\n\r",1); pos = 0; } } newbuf[0] = '\0'; write_to_buffer(d,"\n\r\n\r",0); write_to_buffer(d,"What is your race (help for more information)? ",0); d->connected = CON_GET_NEW_RACE; break; } return; } [/quote] Sorry didnt read the entire reply before. (I'm tired) heheh |
|
|
|
if ((race == 0)
|| (!race_table[race].pc_race) || (IS_GOOD(ch) && !race_table[race].good) || (IS_NEUTRAL(ch) && !race_table[race].neutral) || (IS_EVIL(ch) && !race_table[race].evil)) Looks like you are checking for the new attributes in race_table, but you've added them to the struct pc_race_type, not race_type, so you should be checking in pc_race_table (or adding them to race_type). |
|
I added the align stuff in both race_types in merc.h
it compiles good. But when I create a character, I get stuck. I can't choose races. *boggles* |
A bit more information and/or a copy-and-paste from the point in the login screen where you get stuck would really help.
|
Enter the name of your desired race: dwarf
Invalid selection. Enter race name: And it keeps doing that, doesnt matter what align or race a pick. |
Please post the appropriate part of the current version of nanny() - ie the part starting where I quoted earlier, and a few line below - plus the entry for dwarf in pc_race_table and in race_table.
|
[code]
if ((race == 0) || (!race_table[ch->race].pc_race) || (IS_GOOD(ch) && !race_table[ch->race].good) || (IS_NEUTRAL(ch) && !race_table[ch->race].neutral) || (IS_EVIL(ch) && !race_table[ch->race].evil)) { send_to_char( "Invalid selection.\n\rEnter race name; ", ch ); return; } [/quote] [code] { "dwarf", "Dwarf", 9, { 175, 150, 200, 130, 175, 175, 200, 200, 175, 175, 175, 140, 125, 170, 105, 140, 140, 170, 170, 140, 140, 140 }, { "bash" }, { 73, 63, 74, 53, 74, 59, 83, 63 }, { 80, 70, 81, 60, 81, 66, 90, 70 }, SIZE_MEDIUM, TRUE, /* Alignment good */ TRUE, /* Alignment neutral */ FALSE /* Alignment evil */ }, [/quote] [code] { "dwarf", TRUE, 0, AFF_INFRARED, 0, 0, RES_EARTH|RES_POISON|RES_DISEASE, VULN_WATER, SHD_TERRA, A|H|M|V, A|B|C|D|E|F|G|H|I|J|K }, [/quote] |
I assume the middle table of the 3 you posted is pc_race_table and the last is race_table.
If that is the case, then your nanny() code is checking for the alignment attributes in race_table, but you have put them in pc_race_table. Try changing the nanny() code to use pc_race_table() instead - eg if ((race == 0) || (!race_table[race].pc_race) || (IS_GOOD(ch) && !pc_race_table[race].good) || (IS_NEUTRAL(ch) && !pc_race_table[race].neutral) || (IS_EVIL(ch) && !pc_race_table[race].evil)) |
I did what you told me too, but now it doesnt seem to check the align anymore. Every race work for whatever align I pick.
|
Looking again at the code from nanny(), it looks like you were using the player's current race to check, not the race he is selecting (ie you were using ch->race, not race).
Have you changed that, or are you still using ch->race ? I suggest you check your code for IS_GOOD(), IS_NEUTRAL() and IS_EVIL(). If there's no obvious errors there, I suggest you add some debugging code to show what is going on - eg print out the values of IS_GOOD(), IS_NEUTRAL(), IS_EVIL(), and the values of pc_race_table[race].good etc. |
I've changed that. And it's still ignoring the align check.
And I've also compared the values in merc.h and in the nanny part in comm.c and it should work... |
Merc.h
[code] #define IS_GOOD(ch) (ch->alignment >= 350) #define IS_EVIL(ch) (ch->alignment <= -350) #define IS_NEUTRAL(ch) (!IS_GOOD(ch) && !IS_EVIL(ch)) struct race_type { char * name; /* call name of the race */ bool pc_race; /* can be chosen by pcs */ long act; /* act bits for the race */ long aff; /* aff bits for the race */ long off; /* off bits for the race */ long imm /* imm bits for the race */ long res /* res bits for the race */ long vuln; /* vuln bits for the race */ long shd; /* shd bits for the race */ long form; /* default form flag for the race */ long parts; /* default parts for the race */ bool good; bool neutral; bool evil; }; struct pc_race_type /* additional data for pc races */ { char * name; /* MUST be in race_type */ char who_name[6]; sh_int points; /* cost in points of the race */ sh_int class_mult[MAX_CLASS]; char * skills[5]; /* bonus skills for the race */ sh_int stats[MAX_STATS]; /* starting stats */ sh_int max_stats[MAX_STATS]; /* maximum stats */ sh_int size; /* aff bits for the race */ bool good; bool neutral; bool evil; }; [/quote] [code] case CON_GET_ALIGNMENT; { switch ( argument[0] ) { case '1'; ch->alignment = 1000; break; case '2'; ch->alignment = 750; break; case '3'; ch->alignment = 500; break; case '4'; ch->alignment = 250; break; case '5'; ch->alignment = 0; break; case '6'; ch->alignment = -250; break; case '7'; ch->alignment = -500; break; case '8'; ch->alignment = -750; break; case '9'; ch->alignment = -1000; break; default; send_to_char("Sorry thats not a valid alignment.\n\r\n\r",ch); return; } } write_to_buffer(d,"\n\r",0); for ( race = 0; race < MAX_PC_RACE; race++ ) { do_help( ch, "NANNY_RACES" ); if (IS_GOOD(ch)) { do_help(ch,"GOOD_RACES"); write_to_buffer(d,"\n\r\n\r",1); send_to_char( "Enter the name of your desired race; ", ch ); d->connected = CON_GET_NEW_RACE; break; } if (IS_NEUTRAL(ch)) { do_help(ch,"NEUTRAL_RACES"); write_to_buffer(d,"\n\r\n\r",1); send_to_char( "Enter the name of your desired race; ", ch ); d->connected = CON_GET_NEW_RACE; break; } if (IS_EVIL(ch)) { do_help(ch,"EVIL_RACES"); write_to_buffer(d,"\n\r\n\r",1); send_to_char( "Enter the name of your desired race; ", ch ); d->connected = CON_GET_NEW_RACE; break; } } break; case CON_GET_NEW_RACE; one_argument(argument,arg); if (!strcmp(arg,"help")) { argument = one_argument(argument,arg); if (argument[0] == '\0') do_help(ch,"race help"); else do_help(ch,argument); write_to_buffer(d, "What is your race (help for more information)? ",0); break; } race = race_lookup(argument); if ((race == 0) || (!race_table[race].pc_race) || (IS_GOOD(ch) && !race_table[race].good) || (IS_NEUTRAL(ch) && !race_table[race].neutral) || (IS_EVIL(ch) && !race_table[race].evil)) ch->race = race; /* initialize stats */ for (i = 0; i < MAX_STATS; i++) ch->perm_stat[i] = pc_race_table[race].stats[i]; ch->affected_by = ch->affected_by|race_table[race].aff; ch->shielded_by = ch->shielded_by|race_table[race].shd; ch->imm_flags = ch->imm_flags|race_table[race].imm; ch->res_flags = ch->res_flags|race_table[race].res; ch->vuln_flags = ch->vuln_flags|race_table[race].vuln; ch->form = race_table[race].form; ch->parts = race_table[race].parts; // ch->alignment = race_table[race].good; // ch->alignment = race_table[race].neutral; // ch->alignment = race_table[race].evil; [/quote] |
Looks like you've lost the code that should immediately follow the bit we've been discussing -
[code] { send_to_char( "Invalid selection.\n\rEnter race name; ", ch ); return; } [/quote] |
All times are GMT -4. The time now is 11:28 PM. |
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022