Re: Newbie Coder: Equipment

From: Mike Breuer (
Date: 09/20/01

----- Original Message -----
From: "Daryle Foulke" <>

> I would like to know where in the code you put the
> equipment that a player starts up with?  I can not
> seem to find it.

You can't find it, because by default new characters have the same equipment
you had when you were born.  :)

If I were going to add something like that, I'd probably write a function
for it and stick that function in db.c.  I'd call it from interpreter.c in
the nanny function... stick it in the CON_QCLASS case between the calls to
init_char() and save_char().  Alternatively, you could call it from
init_char() directly.  Here's a quick example function:

void equip_newbie(struct char_data *ch)
  struct obj_data *obj;

  if (!ch) return;

  /* Load some equipment */
  if ((obj = read_object(3010, VIRTUAL)))
    obj_to_char(obj, ch);
  /* Repeat above two lines for other objects as needed */

3010 is the virtual number of an object...replace it with whatever you want.

Potential improvements:

* Log an error if object doesn't exist.
* Assign equipment based on class (or race?), esp. for clerics if weapons
are given.
* Initialize object assignments from a file on boot (online editing?)

Have fun.


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/06/01 PST