Re: [CODE] Setting alignment upon start

From: ShadowRealm MUD (mud@k4d4th.org)
Date: 03/19/01


On Mon, 19 Mar 2001, flawed wrote:

> So how would this be done?

I used a slightly different approach, assigning random values from each
third of the range depending on the player's choice at creation. It's a
bit ugly and devoid of comments, but should still be easy to follow...

This is what I used in nanny()

  case CON_QALIGN:                /* query alignment of new user */
    switch (*arg) {
    case 'b':
    case 'B':
      /* evil */
      SET_BIT(d->character->char_specials.saved.act, PLR_ALIGN_EVIL);
      break;
    case 'g':
    case 'G':
      /* good */
      SET_BIT(d->character->char_specials.saved.act, PLR_ALIGN_GOOD);
      break;
    case 'i':
    case 'I':
      /* neutral */
      break;
    case 'r':
    case 'R':
      switch (number(0, 2))
      {
        case 0:
          SET_BIT(d->character->char_specials.saved.act, PLR_ALIGN_EVIL);
          break;
        case 1:
          SET_BIT(d->character->char_specials.saved.act, PLR_ALIGN_GOOD);
          break;
        case 2:
        default:
          break;
      }
      break;
    default:
      SEND_TO_Q("That is not a valid choice...\r\n", d);
      if (IS_SET(d->character->player_specials->saved.pref, PRF_COLOR_1))
      {
        if (d->character->player.sex == SEX_FEMALE)
          SEND_TO_Q(ALIGN_MENU_F_C, d);
        else SEND_TO_Q(ALIGN_MENU_M_C, d);
      }
      else
      {
        if (d->character->player.sex == SEX_FEMALE)
          SEND_TO_Q(ALIGN_MENU_F, d);
        else SEND_TO_Q(ALIGN_MENU_M, d);
      }
      return;
    }

...and then this is in roll_real_abils()

  if (IS_SET(ch->char_specials.saved.act, PLR_ALIGN_EVIL))
    ch->char_specials.saved.alignment = number(-1000, -334);
  else if (IS_SET(ch->char_specials.saved.act, PLR_ALIGN_GOOD))
    ch->char_specials.saved.alignment = number(334, 1000);
  else ch->char_specials.saved.alignment = number(-333, 333);

...and add the necessary preference bits into your player definition. I
did things this way so that a reroll by an Imm would give them another
semi-random alignment within their chosen ethos. I'm sure it's not the
best way to do things, but it works.

--
ShadowRealm Management - http://mud.yuggoth.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST