Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ adding new mob flags

adding new mob flags

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Bryn   (14 posts)  Bio
Date Sat 11 Jan 2003 10:52 AM (UTC)
Message
Is it possible to add new mob flags?
e.g. #define ACT_BANKER 31
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 11 Jan 2003 09:57 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Chris L   USA  (57 posts)  Bio
Date Reply #2 on Sat 11 Jan 2003 10:21 PM (UTC)
Message
do the define in mud.h and also in build.c add a ,"banker" where it lists the actflags
Top

Posted by Bryn   (14 posts)  Bio
Date Reply #3 on Mon 13 Jan 2003 01:39 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 13 Jan 2003 02:16 AM (UTC)
Message
I warned you about 31, being the sign bit. Possibly it doesn't save/restore properly.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Bryn   (14 posts)  Bio
Date Reply #5 on Mon 13 Jan 2003 02:24 AM (UTC)
Message
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
Top

Posted by Shadoan   Canada  (21 posts)  Bio
Date Reply #6 on Mon 13 Jan 2003 02:25 AM (UTC)
Message
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

Edge of Darkness MUD and Hosting Service,
Head Administrator(Retired)
All your SWR needs, right here, right now.
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #7 on Mon 13 Jan 2003 02:36 AM (UTC)
Message
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.

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Rash   United Kingdom  (56 posts)  Bio
Date Reply #8 on Sat 19 Jul 2003 11:54 PM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #9 on Sun 20 Jul 2003 04:50 AM (UTC)

Amended on Sun 20 Jul 2003 04:51 AM (UTC) by Nick Gammon

Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #10 on Sun 20 Jul 2003 04:52 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Rash   United Kingdom  (56 posts)  Bio
Date Reply #11 on Wed 30 Jul 2003 03:04 AM (UTC)
Message
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?
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #12 on Thu 31 Jul 2003 01:32 AM (UTC)
Message
Sounds like you don't have a flag called act2.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Lothig   USA  (5 posts)  Bio
Date Reply #13 on Sat 02 Aug 2003 02:18 AM (UTC)
Message
Be sure to:
$ make clean
$ make
whenever you modify mud.h
Top

Posted by Rash   United Kingdom  (56 posts)  Bio
Date Reply #14 on Tue 28 Oct 2003 09:20 AM (UTC)
Message
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
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


49,327 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.