[CODE] The Bread of Life

From: Mike Carpenter (abram@DELTANET.COM)
Date: 09/26/97


To all those who have contributed code..Thanks.

The following snippet will allow you to create
an object that will never let a player get hungry or
thirsty again...everytime there hunger or thirst goes
below 3 "The Bread of Life"  will replenish them.
I made the object a food item, so if they eat it, it acts
just like a waybread and its gone, but if they leave it
in their inventory, they will never go hungry or thirsty.
If you use this please give me a little credit, its one of
my very first programs for muds.  There shouldn't
be any bugs in this, but who knows.  If you have any
questions please email me at Abram@deltanet.com

Have fun,
Abram
Legends of Blades and Magic
Mud.inc.net 9000

p.s. I have seen something like this somewhere, so the idea isnt mine, but
the code is.



/* In limits.c */
/* With all the Externs at top of file add this one: */
extern struct index_data *obj_index;


/* find: */
void gain_condition(struct char_data * ch, int condition, int value)
bool intoxicated;

/* add this */
struct obj_data *obj;


/* find: */
 if (GET_COND(ch, condition) == -1)    /* No change */
    return;

/* Add the following: */
  for(obj=ch->carrying; obj; obj=obj->next_content)
   if(GET_OBJ_VNUM(obj) == 15277){  /* you will need to change the vnum */
        if((GET_COND(ch, FULL) < 3) || (GET_COND(ch, THIRST) < 3)){
        GET_COND(ch, FULL) = 50;
        GET_COND(ch, THIRST) = 50;
        send_to_char("You feel hungry and thirsty however,\r\n", ch);
        send_to_char("The Bread of Life replenishes you!\r\n", ch);
        }
        else
        GET_COND(ch, FULL) -= 1;
        GET_COND(ch, THIRST) -= 1;
        return;
   }

/* Stop here. */

  intoxicated = (GET_COND(ch, DRUNK) > 0);

  GET_COND(ch, condition) += value;

/* Feel free to adjust anything here to your liking, im sure there are */
/* are other ways to do this. */


     +------------------------------------------------------------+
     | 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/08/00 PST