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

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


thanks! hehe

This snippet gave me a ton of grief....

still getting the hang of this coding stuff... and make stupid blunders..

hehe


> 
> >     for (rch = world[ch->in_room].people; rch; rch = rch->next_in_room)
> >       if ((FIGHTING(rch) == ch) && (number(0, count++) == 0))
> >         vict = FIGHTING(rch);
> 
> There you set 'vict' to be the person that your random target is fighting
> (which is always the mob itself):  just set it to rch instead. 
> 
> And it *is* ch->in_room, not rch->in_room: you want to go through the
> people in the room where the mob is. rch is unitialized at that time. 
> 



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