Stat Roller

Posted by Yourdrunkendad on Sat 23 Aug 2003 05:32 PM — 5 posts, 19,655 views.

#0
I'm trying to get my stat roller working perfectly (mainly using bits of other stat rollers than I found and liked certain aspects of each, and I'm combining them frankenstein styles) and I'm soo close, I hope someone out there can fill in the missing link for me. Originally my statroller wasn't calling the racial attributes into play at all until the player entered the game, nor was it setting the classes prime attribute (on my mud the classes prime attribute can not be lower than16 base) so I've played around I got it to take into account racial bonuses, with a call to the following edited version of name_stamp_stats

void name_stamp_stats( CHAR_DATA *ch )
{
     ch->perm_str = 6 + dice( 2,6 );
     ch->perm_dex = 6 + dice( 2,6 );
     ch->perm_wis = 6 + dice( 2,6 );
     ch->perm_int = 6 + dice( 2,6 );
     ch->perm_con = 6 + dice( 2,6 );
     ch->perm_cha = 6 + dice( 2,6 );
     ch->perm_lck = 6 + dice( 2,6 );
	
	 switch ( class_table[ch->class]->attr_prime )
	    {
	    case APPLY_STR: ch->perm_str = 16; break;
	    case APPLY_INT: ch->perm_int = 16; break;
	    case APPLY_WIS: ch->perm_wis = 16; break;
	    case APPLY_DEX: ch->perm_dex = 16; break;
	    case APPLY_CON: ch->perm_con = 16; break;
	    case APPLY_CHA: ch->perm_cha = 16; break;
	    case APPLY_LCK: ch->perm_lck = 16; break;
	    }

		 
     ch->perm_str	+= race_table[ch->race]->str_plus;
     ch->perm_int	+= race_table[ch->race]->int_plus;
     ch->perm_wis	+= race_table[ch->race]->wis_plus;
     ch->perm_dex	+= race_table[ch->race]->dex_plus;
     ch->perm_con	+= race_table[ch->race]->con_plus;
     ch->perm_cha	+= race_table[ch->race]->cha_plus; 
     ch->perm_lck	+= race_table[ch->race]->lck_plus;
}

It now sets the racial attributes into the roller, and also the classes prime attribute, however the problem is this:
I want the minimum prime attribute to be 16, not always 16, which is what it's giving now and then adding racial bonuses.
I tried adding
if ( class_table[ch->class]->attr_prime <=15)

before the switch (class_table..... however that did nothing.
Basically what I'm asking is if anyone can see a way to make that code give the character a minimum of 16 roll on their prime attribute stat but still allow them a possible higher roll of 17 or 18 after racial attributes. I really appreciate the help. Thank You!
Amended on Sat 23 Aug 2003 05:35 PM by Yourdrunkendad
Australia Forum Administrator #1
To make 16 the minimum, don't you want something like:

case APPLY_STR: ch->perm_str = UMAX (ch->perm_str, 16); break;


In other words, take the current value, or 16, whichever is higher.
#2
I am having a problem with a stat roller very similar to Yourdrunkendad's. My code is :

void name_stamp_stats( CHAR_DATA *ch )
{
ch->perm_str = 6 + dice( 2,6 );
ch->perm_dex = 6 + dice( 2,6 );
ch->perm_wis = 6 + dice( 2,6 );
ch->perm_int = 6 + dice( 2,6 );
ch->perm_con = 6 + dice( 2,6 );
ch->perm_cha = 6 + dice( 2,6 );
ch->perm_lck = 6 + dice( 2,6 );

ch->perm_str += race_table[ch->race]->str_plus;
ch->perm_int += race_table[ch->race]->int_plus;
ch->perm_wis += race_table[ch->race]->wis_plus;
ch->perm_dex += race_table[ch->race]->dex_plus;
ch->perm_con += race_table[ch->race]->con_plus;
ch->perm_cha += race_table[ch->race]->cha_plus;
ch->perm_lck += race_table[ch->race]->lck_plus;
}

The problem is this : The stats do not include racial or class bonuses when they are displayed, and if these bonuses take the stat beyond 18, it gets reset back down to 16.

For example, a human warrior is created(stock race and class) and the player rolls a 17 for strength. Since strength is the warrior's prime attribute and humans get no strength bonus, it should bring strength up to 19. Instead the stat becomes 16 after the player finishes creating the character.

Any suggestions?
Canada #3
A couple: Where is it being reset to 16? Find that place, and looks like it should fix your problem. Another: Why use something like that function? Not quite sure what your looking for, but IMHO, stock SWR's stat roller is a fairly good one, if your like stat rollers, which I don't, but thats another topic. Its fairly easy to do, in fact, and is only a simply case statement in nanny(). I would suggest you take a look at it, as it may shed some light on your current issue, if you don't decide to use it instead.

There is a copy in the Nicks download section in the smaug releases as SWRFUSS.
#4
Thanks for the help Greven. I installed the SWR stat roller and was able to get it working properly with a bit of tinkering.