Re: [CODE] Random Room In a zone

From: Daniel Koepke (dkoepke@california.com)
Date: 01/04/97


On Sat, 4 Jan 1997, Søren Peter skou wrote:

> Now here the fun begins, 'cause the word on the Scroll may never be the
> same (no prob there) but It need to be placed somewhere randomly in that
> exact zone. Anyone with an idea to how to do that?

That's not too hard, really.  You need to know the starting vnum of
the zone.  For instance, room 2000.  Then you roll a random number
between 2000 and 2999, and check if it exists.  For instance:

  int nr == NOWHERE;

  while (nr == NOWHERE)
    nr = real_room(number(2000, 2099));

The above code does not account for rooms that the person wouldn't
be able to get into.  So, you should make fairly certain you don't
have any unaccessable rooms in your zone, or you could create a
flag for rooms you don't want to be selected randomly, or you could
make the scroll have a new item type and do code for it's timer to
expire and the scroll to reappear elsewhere.

Something to that effect.


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


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