Re: Error in IDnum mob field?

From: rclark (rclark@peganet.com)
Date: 09/05/96


Here's what I did on my mud.

I needed unique idents for all of my mobs to so some special "tricks".

I made a global variable (long) called mobid. (This should go in the header
of comm.c) and set it to -1 (mob numbering would then start at at -2, don't
ask me why -2, but I don't like -1, people tend to use that for wierd
things)

I put a new long int into mob_specials called mobidnum (in structs.h)

I changed GET_IDNUM(ch) in utils.h to 

#define GET_IDNUM(ch) (IS_NPC(ch) ? (ch)->mob_specials.mobidnum : (I forget
what the original is) )

In read_mobile in db.c I decrement mobid. (mobid--)
I then assign the id to the mob GET_IDNUM(mob)=mobid;

Now all the mobs have unique idnums. Unless you actually exceed the 2
billion
limit things should be fine.


----------
> From: Casper Lund <ncl@mailhost.net>
> To: circle@cspo.queensu.ca
> Subject:  Error in IDnum mob field?
> Date: Wednesday, August 14, 1996 2:45 PM
> 
> As I understand it, the IDnum is supposed to be an unique identifier
> of the mob, but on my mud the IDnum field of all mobs is set to 0.
> I've never noticed it before, so I don't know if it's been that all
> the time.
> 
> My problem is that my mobs, which are equipped with memory, simply
> bashes away at everything that moves at the moment (including them
> selves), and when I looked into the matter I could see that the memory
> routine stores the remembered mobs IDnum and recognizes it by that. 
> But since all my mobs have IDnum 0, it could very well be the reason
> that my mobs are being so unfriendly.
> 
> Maybe I fucked something up so all mob IDnums are wiped at
> bootup/zreset, I dunno.. :(
> 
> Can anyone help me out a bit?
> 
> 
> --
> Casper Lund
> .ncl@mailhost.net
> ..http://home1.inet.tele.dk/nci
> ...Incoming mail forwarded via the PObox II remailer
> +-----------------------------------------------------------+
> | Ensure that you have read the CircleMUD Mailing List FAQ: |
> |   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
> +-----------------------------------------------------------+
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



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