Re: Random Shop Equipment

From: John Evans (evansj@HI-LINE.NET)
Date: 02/17/98


On Mon, 16 Feb 1998, S. Mead wrote:

> I want to make a special procedure so that a shopkeeper can have their
> normal assortment of goods plus one other object from a random list,
> like a special object.  So every reboot one special object will be
> selected randomly and put into the shopkeeper's list.
>
> What would be the best way to do this?  Make a new proc for the mob or
> maybe making another Zone command?

In reset_zone() in db.c in the case 'M':

After the mob is read and placed in his room, I gave it a 25% chance of
loading a random object into its inventory. These random objects are ones
that exist within the game, so it's just code like:

        if (number(1,100) <= 25) {
          obj = read_object(number(26, 80), VIRTUAL);
          obj_to_char(obj, mob);
        }

That is placed right after the char_to_room() call.

Hope that helps.

PS: The code does NO error checking to make sure that the obj exists.
This is one of those cases where the items created and the code were
designed around one-another, so keep that in mind.

John Evans <evansj@hi-line.net>  --  http://www.hi-line.net/~evansj/

Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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