/* Tired of your players running around not eating and drinking
* like they're supposed to? This revamp of update.c will take
* care of that! This snippet was pieced together using a few
* things from fight.c, mainly the experience adjustment. Yes,
* players will loose experience for dying because they didn't
* drink.
*
* Currently players loose about 3hp every time their position is
* updated and they see "You are hungry/You are thirsty".
*
* You can adjust the hp loss with the "ch->hit -= 5" statement.
* Players also regain hunger/thirst/full when they die. So they wont
* continually die from hunger/thirst.
* It sends a notification across WizNet, and has messages such as:
*
* SAMPLES: (messages are easily changable)
*
* Players in room see:
* Athos withers away and dies from dehydration!
* Athos withers away and dies from starvation!
*
* WizNet logs:
* Athos died from dehydration in The Temple Of Mota [room 3001]
* Athos died from starvation in the Temple of Mota [room 3001]
*
* Player sees:
* You have died from dehydration!
* You have died from starvation!
*
*
* CREDITS: None to my knowledge other than the original credits provided
* in update.c. fairly easy cut & paste snippet.
* requires no credit for my part in piecing together.
* please adjust and hack n slash and flush if you want.
*
* All reviews are welcome. Critique the work. Flame it,
* boil it in a stew and eat it.
*
*/
IN UPDATE.C, FIND "void gain_condition"
IN "void gain_condition" find the iCond block.
**************************************************************
if (ch->pcdata->condition[iCond] == 0)
{
switch (iCond)
{
case COND_HUNGER:
send_to_char ("You are hungry.\n\r", ch);
break;
case COND_THIRST:
send_to_char ("You are thirsty.\n\r", ch);
break;
case COND_DRUNK:
if (condition != 0)
send_to_char ("You are sober.\n\r", ch);
break;
}
}
****************************************************************
and replace with:
/******************* BEGIN SNIPPET *****************************/
if (ch->pcdata->condition[iCond] == 0)
{
switch (iCond)
{
case COND_HUNGER:
/* DEATH FROM HUNGER */
ch->hit -= 5;
if (ch->hit > 0 )
{
send_to_char ("You are hungry.\n\r", ch);
}
if (ch->hit <= 0 )
{
act("{RYou have died from starvation!{x",ch,NULL,NULL,TO_CHAR);
act("{R$n withers away and dies from starvation!{x",ch,NULL,NULL,TO_ROOM);
if (ch->exp > exp_per_level (ch, ch->pcdata->points) * ch->level)
gain_exp (ch, (2 * (exp_per_level (ch, ch->pcdata->points)
* ch->level - ch->exp) / 3) + 50);
sprintf (log_buf, "%s died from hunger in %s [room %d]",
ch->name, ch->in_room->name, ch->in_room->vnum);
wiznet (log_buf, NULL, NULL, WIZ_DEATHS, 0, 0);
make_corpse (ch);
int i;
extract_char (ch, FALSE);
while (ch->affected)
affect_remove (ch, ch->affected);
ch->affected_by = race_table[ch->race].aff;
for (i = 0; i < 4; i++)
ch->armor[i] = 100;
ch->position = POS_RESTING;
ch->hit = UMAX (5, ch->hit);
ch->mana = UMAX (5, ch->mana);
ch->move = UMAX (5, ch->move);
ch->pcdata->condition[COND_THIRST] = 48;
ch->pcdata->condition[COND_HUNGER] = 48;
ch->pcdata->condition[COND_FULL] = 48;
return;
}
break;
case COND_THIRST:
/* DEATH FROM THIRST */
ch->hit -= 5;
if (ch->hit > 0 )
{
send_to_char ("You are thirsty.\n\r", ch);
}
if (ch->hit <= 0 )
{
act("{RYou have died from dehydration!{x",ch,NULL,NULL,TO_CHAR);
act("{R$n withers away and dies from dehydration!{x",ch,NULL,NULL,TO_ROOM);
if (ch->exp > exp_per_level (ch, ch->pcdata->points) * ch->level)
gain_exp (ch, (2 * (exp_per_level (ch, ch->pcdata->points)
* ch->level - ch->exp) / 3) + 50);
sprintf (log_buf, "%s died from dehydration in %s [room %d]",
ch->name, ch->in_room->name, ch->in_room->vnum);
wiznet (log_buf, NULL, NULL, WIZ_DEATHS, 0, 0);
make_corpse (ch);
int i;
extract_char (ch, FALSE);
while (ch->affected)
affect_remove (ch, ch->affected);
ch->affected_by = race_table[ch->race].aff;
for (i = 0; i < 4; i++)
ch->armor[i] = 100;
ch->position = POS_RESTING;
ch->hit = UMAX (5, ch->hit);
ch->mana = UMAX (5, ch->mana);
ch->move = UMAX (5, ch->move);
ch->pcdata->condition[COND_THIRST] = 48;
ch->pcdata->condition[COND_HUNGER] = 48;
ch->pcdata->condition[COND_FULL] = 48;
return;
}
break;
case COND_DRUNK:
if (condition != 0)
send_to_char ("You are sober.\n\r", ch);
break;
}
}
*****************END SNIPPET******************************************/
return;
}
The above return statement is part of the original gain_condition block, be
sure not to remove it.