On Sun, 13 Oct 1996 mvaughn@gte.net wrote: > Ok, I would like to give my characters on startup money (Already know > that) but also a newbie sword and newbie armor.. how would I do that > in the class.c ? I know which function I just need an example. > Much appreciated it. Various newbie equipping functions have been posted here since... hm, probably pl4 (the first public release of 3.0). So I've seen a lot of implementations, they al go along the same lines, although my own code went far beyond anything I had seen posted here. Here's the basic idea... #define IN_BAG -2 #define INVENTORY -1 void equip_newbie (struct char_data *ch) { int newbie_eq[][3] = { { <vnum of obj>, <quantity>, <wear pos> }, { -1, 0, -1 } }; int bag_vnum = <vnum of bag>; int rnum; struct obj_data *bag, *obj; /* first we load the bag and put it into their inventory */ if ((bag = read_object(bag_vnum, VIRTUAL))) obj_to_char(bag, ch); for (x = 0; newbie_eq[x][0] != -1; x++) { if ((obj = read_object(newbie_eq[x][0], VIRTUAL))) { for (y = 0; y < newbie_eq[x][1]; y++) { if (newbie_eq[x][2] == INVENTORY) obj_to_char(obj, ch); else if (newbie_eq[x][2] == IN_BAG) obj_to_obj(obj, bag); else { if (!GET_EQ(ch, newbie_eq[x][2])) equip_char(ch, obj, newbie_eq[x][2]); else obj_to_char(obj, ch); } } } } send_to_char("The gods have equipped you.\r\n", ch); } Then you fill in the vnums. For example (these objectrs probably don't exist on your MUD, or are not the same as they are on mine): { 100, 1, WEAR_WIELD }, /* load a skullcrusher */ { 101, 1, WEAR_FEET }, /* load fur sandals */ { 102, 1, INVENTORY }, /* canteen of murky water */ { 103, 1, INVENTORY }, /* a minor heal potion */ { 104, 1, INVENTORY }, /* one ration into inventory */ { 104, 4, IN_BAG }, /* four more in the bag */ { 105, 1, WEAR_HOLD }, /* a walking stick */ { -1, 0, -1 } /* MUST BE LAST */ You'll have to select your own objects, of course. Don't forget to set the bag vnum, either. It might be nice to do various things with this code. I've thought about making it load from a text file so that I don't have to recompile the MUD whenever I want to change what newbies get; It might also be nice to have different sets of eq for different classes/races/whatever. <*=-+Daniel+-=*> "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