Ability Score Rolling Function [by fantasia]
Snippet Posted Wednesday, August 12th @ 11:23:29 PM, by George Greer in the Players dept.
. Click the link below to read it or download it.

From: fantasia <eagle@virtual.zipnet.net>
Subject: roll_real_abils()

Because so many ppl asked for this here it is my roll_real_abils().
you will note that i made very little modifications to it.

void roll_real_abils(struct char_data * ch)
{
  int i, j, k, temp;
  ubyte table[6];
  ubyte rolls[4];

  for (i = 0; i < 6; i++)
    table[i] = 0;

  for (i = 0; i < 6; i++) {
    for (j = 0; j < 4; j++)
      rolls[j] = number(1, 6);
    temp = rolls[0] + rolls[1] + rolls[2] + rolls[3] -
      MIN(rolls[0], MIN(rolls[1], MIN(rolls[2], rolls[3])));
    for (k = 0; k < 6; k++)
      if (table[k] < temp) {
        temp ^= table[k];
        table[k] ^= temp;
        temp ^= table[k];
      }
  }
  ch->real_abils.str_add = 0;
  ch->real_abils.str = table[0];
  ch->real_abils.intel = table[1];
  ch->real_abils.dex = table[2];
  ch->real_abils.con = table[3];
  ch->real_abils.wis = table[4];
  ch->real_abils.cha = table[5];
  ch->aff_abils = ch->real_abils;
}


<< Abbreviations [by Zigg] | Reply | View as text | Flattened | Add Object Applies [by Frollo] >>

 


Related Links
  Intel
download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.