/* Random death messages written by Keberus Maou'San
Basically this sends a random message about a victims death when a char kills them...spiff
To use this code keep this header in place
Again: this is written for FotE, but can be easily converted for SMAUG
*/
Step 1:
Towards the top of fight.c add:
char *rand_death( CHAR_DATA * ch );
----------------------
Step 2:
change:
if ( IS_NPC(victim) && IS_SET( victim->act, ACT_NOKILL ) )
act( AT_YELLOW, "$n flees for $s life ... barely escaping certain death!", victim, 0, 0, TO_ROOM );
else if ( IS_NPC(victim) && IS_SET( victim->act, ACT_DROID ) )
act( AT_DEAD, "$n EXPLODES into many small pieces!", victim, 0, 0, TO_ROOM );
else
act( AT_DEAD, "$n is DEAD!", victim, 0, 0, TO_ROOM );
send_to_char( "&WYou have been KILLED!\n\r", victim);
to:
if( IS_NPC( victim ) && xIS_SET( victim->act, ACT_NOKILL ) )
act( AT_YELLOW, "$n flees for $s life ... barely escaping certain death!", victim, 0, 0, TO_ROOM );
else
act( "dead", rand_death( victim ), victim, 0, 0, TO_ROOM );
send_to_char( "&WYou have been KILLED!\n\r", victim );d put this in there
----------------------
Step 3:
create a file called rand_death.c or add below to any file you want
-----------------------------------------------------------------------------
#define MAX_HDEATHS 7
#define MAX_DDEATHS 4
struct death_type
{
char *text;
};
const struct death_type hdeath_table[MAX_HDEATHS] = {
{"$n is DEAD!"},
{"$n falls to the ground...DEAD!"},
{"$n drops to the floor...Lifeless!"},
{"With a violent twisting motion, $n falls to the ground and ceases to move!"},
{"Blood spills out from $n's body, leaving you standing in a pool of blood!"},
{"A mixture of stomach acid and blood spill from $n's body as the fighting punctures $s stomach!"},
{"$n's entrails spill out onto the ground, spraying blood everywhere!"}
};
const struct death_type ddeath_table[MAX_DDEATHS] = {
{"$n shorts out as you take a chunk out of $s voltage regulator!"},
{"$n's main fuel line snaps, resulting in a spectacular explosion!"},
{"$n quietly powers down, then falls to the ground, shattering into rubble!"},
{"$n EXPLODES into many small pieces!"}
};
char *rand_death( CHAR_DATA * ch )
{
static char buf[MAX_STRING_LENGTH];
int number;
if( !IS_DROID( ch ) )
{
number = number_range( 1, MAX_HDEATHS ) - 1;
sprintf( buf, "%s\n\r", hdeath_table[number].text );
}
else if( IS_DROID( ch ) )
{
number = number_range( 1, MAX_DDEATHS ) - 1;
sprintf( buf, "%s\n\r", ddeath_table[number].text );
}
else
log_string( "rand_death unknown race...it's not droid...and not humanoid" );
return buf;
}