Re: QUESTION: Races & Perm Attributes

From: Patrick J. Dughi (dughi@IMAXX.NET)
Date: 07/10/97

> I did a crappy little thing to make spells stay, using the innate code
> from Pat, and my own little piece of ugliness =)
> in do_start I added
> ACMD( do_innate );
> int spl;
> extern char *spells[];
> switch (GET_RACE(ch)) {
>   case RACE_TROLL:
>    spl = SPELL_REGEN;
>    break;
>    spl = SPELL_FLY;
>    break;
>   default:
>    spl = 0;
>    break;
> }
> if (spl) {
> mag_affects(LVL_IMMORT -1, ch, ch, spl, 0);
> sprintf(buf2, "%s %s", GET_NAME( ch ), spells[spl]);
> do_innate(ch, buf2, 0, SCMD_SINNATE);
> }
> It is very ugly, and I right now you cant assign more than one spell,
> but this is just mail code, which I did today just because I was going
> to do it anyway. Hope it at least helps for now.

        Actually, what I did is something like the following:

Make an array somewhere which has the spells each race gets innate.
(Also, which immunities, resistances, special skills, etc.. but lets stick
to spells for now)
So, fairy mob/players have {SPELL_FLY, SPELL_SANCT, SPELL_NOTHING} and
then in db.c when they're loaded, (and in act.wizard.c when race is set)
first, all affects are removed, and then it goes through the array[race][]
till it gets to SPELL_NOTHING.  Its a little cleaner, and can be called by
a simple function like

  race_abilities(struct char_data *ch);

, right after everything is initialized.

                Huzzah. :)


      | Ensure that you have read the CircleMUD Mailing List FAQ: |
      |   |

This archive was generated by hypermail 2b30 : 12/08/00 PST