adding new mob flags

Posted by Bryn on Sat 11 Jan 2003 10:52 AM — 17 posts, 66,744 views.

#0
Is it possible to add new mob flags?
e.g. #define ACT_BANKER 31
Australia Forum Administrator #1
Yes, but don't get carried away. Most flags are stored as 32-bit numbers, so the highest number would be 31 (starting at zero), and even 31 might be doubtful as the high-order one would be the sign bit.
USA #2
do the define in mud.h and also in build.c add a ,"banker" where it lists the actflags
#3
see, the problem is when i added the 31, it wouldnt show up when i tried to add the banker flag to a mob. The only way i could get it to work was to switch out another flag for it.
Australia Forum Administrator #4
I warned you about 31, being the sign bit. Possibly it doesn't save/restore properly.
#5
1-30 were taken.....oh well. Is there any way around that, or another way to set mobs as a banker? If not, which mob flag would be best to remove for the banker code?


Thanks so much,
Bryn
Canada #6
You can try making a whole new set of flags, me and my coder did that when we needed more room flags. And if you have that set you have 32 more bits to play around with.
-Shad
USA #7
Hook in an act2 structure for another 31 flags, fill those up and hook in an act3 structure.... repeat as necessary to provide the flags you decide you need for your mud.
United Kingdom #8
How do you go about creating this new set???
i need loads more act flags (the 32 are used up now)...and i have no idea on how to create them so soe help would be very nice
Rash
Australia Forum Administrator #9
Look at how the act flags are done and duplicate that with a different name (eg. act3).



For instance, in mud.h:


    EXT_BV              act;
    EXT_BV              act3;


In db.c where the flags are loaded:



  pMobIndex->act                  = fread_bitvector( fp );
  pMobIndex->act3                 = fread_bitvector( fp );



In save.c where mobs are saved:


  fprintf( fp, "Flags %s\n",   print_bitvector(&mob->act) );
  fprintf( fp, "Flags3 %s\n",   print_bitvector(&mob->act3) );


I have probably missed some, but that is the general idea.
Amended on Sun 20 Jul 2003 04:51 AM by Nick Gammon
Australia Forum Administrator #10
Be cautious that you don't make the new area files incompatible with existing ones, and vice-versa. Also the Area Editor, if you are using that, won't recognise the new flags.
United Kingdom #11
Thankx Nick as allways your a help! :)
but...theres a problem and im to dumb to figure it out..

gcc -c -O -g3 -Wall -Wuninitialized -DSMAUG save.c
save.c: In function `load_char_obj':
save.c:949: warning: suggest explicit braces to avoid ambiguous `else'
save.c: In function `fwrite_mobile':
save.c:2305: structure has no member named `act2'
make[1]: *** [save.o] Error 1
make[1]: Leaving directory `/home/Mckenna/smaug/dist/src'
make: *** [all] Error 2

thats the problem any ideas?
Australia Forum Administrator #12
Sounds like you don't have a flag called act2.
USA #13
Be sure to:
$ make clean
$ make
whenever you modify mud.h
United Kingdom #14
Could anyone who has added in to smaug this extra act structure post on how they did it i.e. like Nick did but with everythng u did to get it to work... im a n00bie and im still learning... and this is confusing to me!
Thankx
Canada #15
Check out this post:

It a couple of pages back, but it describes the process for adding new variables to mobs, methods of having them woked into your area files, and some problems that may arise. It very handy.
USA #16
Look at that, one of my topic actually helps someone. :P