Re: [Question][Newbie-Sorta][Longish] Weapon Spell Affections.

From: Jon Barrett (mixtli@SINFO.NET)
Date: 05/26/98

At 06:52 PM 5/26/98 +1000, you wrote:
>Ok, I need some help with the following...

Yes, you do...

>I'm trying to get objects to set the AFF bits
>after fooling around making changes I added
>another case in the parse_object function
>this all works fine and dandy... but what I
>want to know, is what I have to change in
>any of the structures... I see that
>obj_flag_data has a long, called bitvector,

You do not need to change any of the structures.  You already said that the
obj_flag_data bitvector variable is there; that is all you need.

>so I wrote myself a routine that did the following:
>long find_aff(long affect)
>  long tmp;
>  switch (affect) {
>    case 0: tmp = AFF_BLIND; break;
>    case 1: tmp = AFF_INVISIBLE; break;
>    etc...
>    default: tmp = AFF_UNUSED20; break;
>  }
>  return tmp;

This code is useless.  The bitvector variable is exactly that, a
'bitvector'.  You can set multiple affects just like mob flags.  If you
don't know what bitvectors are, RTFD.

>this is called in the case statement
>of parse_object using the following:
>obj_proto[i].obj_flags.bitvector = asciiflag_conv(f1);

You dont need to do that.  All you need to do is read the variable and run
it through asciiflag_conv(), just like the other obj flags(RTFC).

try this:
obj_proto[i].obj_flags.bitvector = asciiflag_conv(f1);

>can someone please tell me what I'm doing wrong?

It always helps to _understand_ the code before you go messing with it.  If
you understood the code, you would know to look at equip_char() in
handler.c(unequip_char() too), right around line 513

equip_char() line 513:

for (j = 0; j < MAX_OBJ_AFFECT; j++)

obj->obj_flags.bitvector, TRUE);

That will add the aff to the char...

>(BTW I also want to change the structure so I can
>have objects that do more than one affection, could
>I do this by changing bitvector to
>long bitvector[MAX_AFFECTIONS]
>and then modifying the affect code to loop until

Also if you understood bitvectors, you would know that this capability is
already there.  How in the world do you give mobs multiple affects?

>I'm RTFCING like crazy, this one just has me

Looking for code in all the wrong places.....


  Did you take the time to look at the snippets page?  I know for certain
there is a no brainer snippet that will _tell_ you how to do exactly what
you want....

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

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