Im running the circlemud 3.1 w goodies bundle from the developer site... this is copy pasted from my own src after I debugged all the buffers.. hope it helps : )- ACMD(do_forage) { struct obj_data *item_found = '\0'; int item_no = 18650; /* Initialize with first item poss. */ char buf[MAX_STRING_LENGTH]; if(GET_MOVE(ch) < 100) { send_to_char(ch , "You do not have enough energy right now.\r\n"); return; } if(SECT(ch->in_room) != SECT_FIELD && SECT(ch->in_room) != SECT_FOREST && SECT(ch->in_room) != SECT_HILLS && SECT(ch->in_room) != SECT_MOUNTAIN && SECT(ch->in_room) ) { send_to_char(ch , "You cannot forage on this type of terrain!\r\n"); return; } if(GET_SKILL(ch, SKILL_FORAGE) <= 0) { send_to_char(ch,"You have no idea how to forage!\r\n"); return; } send_to_char(ch , "You start searching the area for signs of food.\r\n"); act("$n starts foraging the area for food.\r\n", FALSE, ch, 0, 0, TO_ROOM); if(rand_number(1,101) > GET_SKILL(ch, SKILL_FORAGE)) { WAIT_STATE(ch, PULSE_VIOLENCE * 2); GET_MOVE(ch) -= (100 - GET_LEVEL(ch)); send_to_char(ch , "\r\nYou have no luck finding anything to eat.\r\n"); return; } else { switch (rand_number(1,7)) { case 1: item_no = 18650; break; /*<--- Here are the objects you need to code */ case 2: /* Add more or remove some, just change the */ item_no = 18651; break; /* switch(number(1, X) */ case 3: item_no = 18652; break; case 4: item_no = 18653; break; case 5: item_no = 18654; break; case 6: item_no = 18655; break; case 7: item_no = 18656; break; } WAIT_STATE( ch, PULSE_VIOLENCE * 2); /* Not really necessary */ GET_MOVE(ch) -= (150 - GET_LEVEL(ch)); item_found = read_object( item_no, VIRTUAL); obj_to_char(item_found, ch); sprintf(buf, "You have found %s!\r\n", item_found->short_description); send_to_char(ch , buf); act("$n has found something in his forage attempt.\r\n", FALSE, ch , 0, 0, TO_ROOM); return; } } -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/26/03 PDT