RE: [code] Picking a random target off a list

From: Gary Barnett (gbarnett@polarnet.com)
Date: 03/02/97


>----------
>From: 	Count Zero[SMTP:count.zero@panacom.com]
>
>Ok, picked some bits and pieces up from both Daniel's suggestions and
>Erwin's...  Thanks to both of you for your help so far....
>
>New problem....
>
>this code snippet produces mobs that attack themselves sometimes.. hehe

<snip>

     Try this:

    for (rch = world[ch->in_room].people; rch; rch = rch->next_in_room)
      if ((FIGHTING(rch) == ch) && (number(0, count++) == 0) && (ch != rch))
        vict = FIGHTING(rch);


--Mallory

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
|    Or send 'info circle' to majordomo@cspo.queensu.ca     |
+-----------------------------------------------------------+



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