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

From: Count Zero (count.zero@panacom.com)
Date: 03/02/97


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

what am I missing?

int count;
struct char_data *rch;
struct char_data *vict;

count = 0;
vict = NULL;

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

-Count Zero-





+-----------------------------------------------------------+
| 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