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

From: Erwin S. Andreasen (erwin@pip.dknet.dk)
Date: 03/03/97


On Sun, 2 Mar 1997, Count Zero wrote:


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

==============================================================================
Erwin Andreasen  Viby J, Denmark   Computer Science Student at Aarhus Business
erwin@pip.dknet.dk        <URL:http://pip.dknet.dk/~pip1773/>          College
==============================================================================



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