How do i add random messages IE when some dies form a weapon, uses an item or connects, disconnects, and suicides? (yes i am using reaper bot, but only to test most of this out.)
void () ClientConnect =
{
local string tmp;
local float num;
bprint (self.netname);
bprint (" has joined the fight\n");
self.id = FindGood();
self.impulse = 204.000;
initscore ();
if ( intermission_running ) {
ExitIntermission ();
}
};
void () ClientDisconnect =
{
local float num;
if ( gameover )
{
return ;
}
bprint (self.teamname);
bprint (self.netname);
bprint (" left the game with ");
MakeGood(self.id);
bprint (ftos (self.frags));
bprint (" kills\n");
sound (self,CHAN_BODY,"player/tornoff2.wav",TRUE,ATTN_NONE);
self.classname = "nobody";
set_suicide_frame ();
};
void (entity targ, entity attacker) ClientObituary =
{
local float rnum;
local string deathstring;
local string deathstring2;
local string deathstring3;
local string deathstring4;
local string deathstring5;
local string deathstring6;
rnum = random ();
if ( ((targ.classname == "player") || (targ.classname == "dmbot")) ) {
if ( (attacker.classname == "teledeath") )
{
bprint (targ.netname);
local float zufall;
zufall = random(); // randomize death messages
if (zufall > 0.75)
bprint (" was telefraged by ");
else if (zufall > 0.5)
bprint (" got in the way of ");
else if (zufall > 0.25)
bprint (" experienced birthing by ");
else
bprint (" had his personal space invaded by ");
bprint (attacker.owner.netname);
bprint ("\n");
if ( (attacker.owner.classname == "dmbot") )
{
TELEFRAGFLAG = TRUE;
}
attacker.owner.frags = (attacker.owner.frags + TRUE);
countkill (attacker.owner,targ);
if (attacker.owner.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, attacker.owner.id );
WriteShort( MSG_ALL, attacker.owner.frags );
}
return ;
}
if ( (attacker.classname == "teledeath2") )
{
bprint ("Satan's power deflects ");
bprint (targ.teamname);
bprint (targ.netname);
bprint ("'s telefrag\n");
countkill (targ,targ);
targ.frags = (targ.frags - TRUE);
if (targ.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, targ.id );
WriteShort( MSG_ALL, targ.frags );
}
return ;
}
if ( ((attacker.classname == "player") || (attacker.classname == "dmbot")) )
{
if ( (targ == attacker) ) {
attacker.frags = (attacker.frags - TRUE);
if (attacker.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, attacker.id );
WriteShort( MSG_ALL, attacker.frags );
}
countkill (attacker,attacker);
bprint (targ.teamname);
bprint (targ.netname);
if ( ((targ.weapon == FL_GODMODE) && (targ.waterlevel > TRUE)) ) {
bprint (" discharges into the water.\n");
return ;
}
if ( (targ.weapon == FL_INWATER) ) {
bprint (" tries to put the pin back in\n");
}
else
{
if ( rnum )
{
bprint (" becomes bored with life\n");
}
else
{
bprint (" checks if his weapon is loaded\n");
}
}
return ;
}
else
{
attacker.frags = (attacker.frags + TRUE);
if (attacker.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, attacker.id );
WriteShort( MSG_ALL, attacker.frags );
}
countkill (attacker,targ);
rnum = attacker.weapon;
if ( (rnum == IT_AXE) )
{
deathstring = " was ax-murdered by ";
deathstring = " was sliced by ";
deathstring = " was diced by ";
deathstring2 = "\n";
}
if ( (rnum == IT_SHOTGUN) )
{
deathstring = " chewed on ";
deathstring2 = "'s lead\n";
deathstring = " sucked on ";
deathstring2 = "'s shottie\n";
}
if ( (rnum == IT_SUPER_SHOTGUN) )
{
deathstring = " ate 2 loads of ";
deathstring2 = "'s shotgun shells\n";
}
if ( (rnum == IT_NAILGUN) )
{
deathstring = " was nailed by ";
deathstring2 = "'s nailgun\n";
}
if (rnum == IT_SUPER_NAILGUN)
{
deathstring = " was nailed to the wall by ";
deathstring2 = "'s supernail gun\n";
}
if ( (rnum == IT_GRENADE_LAUNCHER) )
{
deathstring = " eats ";
deathstring2 = "'s pineapple\n";
if ( (targ.health < -40.000) )
{
deathstring = " was gibbed by ";
deathstring2 = "'s grenade\n";
}
}
if (rnum == IT_ROCKET_LAUNCHER)
{
deathstring = " found ";
deathstring2 = "'s rocket up his ass\n";
if (targ.health < -40)
{
deathstring = " was destroyed by ";
deathstring2 = "'s rocket\n" ;
}
}
if ( (rnum == IT_LIGHTNING) ) {
deathstring = " accepts ";
if ( (attacker.waterlevel > TRUE) )
{
deathstring2 = "'s discharge\n";
}
else
{
deathstring2 = "'s shaft\n";
}
}
bprint (targ.teamname);
bprint (targ.netname);
bprint (deathstring);
bprint (attacker.teamname);
bprint (attacker.netname);
bprint (deathstring2);
}
return ;
} else {
targ.frags = (targ.frags - TRUE);
if (targ.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, targ.id );
WriteShort( MSG_ALL, targ.frags );
}
rnum = targ.watertype;
countkill (targ,targ);
bprint (targ.teamname);
bprint (targ.netname);
if ( (rnum == CONTENT_WATER) ) {
if ( (random () < 0.500) ) {
bprint (" sleeps with the fishes\n");
} else {
bprint (" sucks it down\n");
}
return ;
} else {
if ( (rnum == CONTENT_SLIME) ) {
if ( (random () < 0.500) ) {
bprint (" gulped a load of slime\n");
} else {
bprint (" can't exist on slime alone\n");
}
return ;
} else {
if ( (rnum == CONTENT_LAVA) ) {
if ( (targ.health < -15.000) ) {
bprint (" burst into flames\n");
return ;
}
if ( (random () < 0.500) ) {
bprint (" turned into hot slag\n");
} else {
bprint (" visits the Volcano God\n");
}
return ;
}
}
}
if ( (attacker.flags & FL_MONSTER) ) {
if ( (attacker.classname == "monster_army") ) {
bprint (" was shot by a Grunt\n");
}
if ( (attacker.classname == "monster_demon1") ) {
bprint (" was eviscerated by a Fiend\n");
}
if ( (attacker.classname == "monster_dog") ) {
bprint (" was mauled by a Rottweiler\n");
}
if ( (attacker.classname == "monster_dragon") ) {
bprint (" was fried by a Dragon\n");
}
if ( (attacker.classname == "monster_enforcer") ) {
bprint (" was blasted by an Enforcer\n");
}
if ( (attacker.classname == "monster_fish") ) {
bprint (" was fed to the Rotfish\n");
}
if ( (attacker.classname == "monster_hell_knight") ) {
bprint (" was slain by a Death Knight\n");
}
if ( (attacker.classname == "monster_knight") ) {
bprint (" was slashed by a Knight\n");
}
if ( (attacker.classname == "monster_ogre") ) {
bprint (" was destroyed by an Ogre\n");
}
if ( (attacker.classname == "monster_oldone") ) {
bprint (" became one with Shub-Niggurath\n");
}
if ( (attacker.classname == "monster_shalrath") ) {
bprint (" was exploded by a Vore\n");
}
if ( (attacker.classname == "monster_shambler") ) {
bprint (" was smashed by a Shambler\n");
}
if ( (attacker.classname == "monster_tarbaby") ) {
bprint (" was slimed by a Spawn\n");
}
if ( (attacker.classname == "monster_vomit") ) {
bprint (" was vomited on by a Vomitus\n");
}
if ( (attacker.classname == "monster_wizard") ) {
bprint (" was scragged by a Scrag\n");
}
if ( (attacker.classname == "monster_zombie") ) {
bprint (" joins the Zombies\n");
}
return ;
}
if ( (attacker.classname == "explo_box") ) {
bprint (" blew up\n");
return ;
}
if ( ((attacker.solid == SOLID_BSP) && (attacker != world)) )
{
local float zufall;
zufall = random(); // randomize death messages
if (zufall > 0.75)
bprint (" was squished\n");
else if (zufall > 0.5)
bprint (" did the monster mash\n");
else if (zufall > 0.25)
bprint (" was squashed\n");
else
bprint (" is more compact\n");
return;
}
if ( (targ.deathtype == "falling") ) {
targ.deathtype = "";
bprint (" fell to his death\n");
return ;
}
if ( ((attacker.classname == "trap_shooter") || (attacker.classname == "trap_spikeshooter")) ) {
bprint (" was spiked\n");
return;
}
if ( (attacker.classname == "fireball") ) {
bprint (" ate a lavaball\n");
return ;
}
if ( (attacker.classname == "trigger_changelevel") ) {
bprint (" tried to leave\n");
return ;
}
local float zufall;
zufall = random(); // randomize death messages
if (zufall > 0.75)
bprint (" died\n");
else if (zufall > 0.5)
bprint (" went to the wrong place\n");
else if (zufall > 0.25)
bprint (" went somewhere it wasn't supposed to be in\n");
}
}
};
{
local string tmp;
local float num;
bprint (self.netname);
bprint (" has joined the fight\n");
self.id = FindGood();
self.impulse = 204.000;
initscore ();
if ( intermission_running ) {
ExitIntermission ();
}
};
void () ClientDisconnect =
{
local float num;
if ( gameover )
{
return ;
}
bprint (self.teamname);
bprint (self.netname);
bprint (" left the game with ");
MakeGood(self.id);
bprint (ftos (self.frags));
bprint (" kills\n");
sound (self,CHAN_BODY,"player/tornoff2.wav",TRUE,ATTN_NONE);
self.classname = "nobody";
set_suicide_frame ();
};
void (entity targ, entity attacker) ClientObituary =
{
local float rnum;
local string deathstring;
local string deathstring2;
local string deathstring3;
local string deathstring4;
local string deathstring5;
local string deathstring6;
rnum = random ();
if ( ((targ.classname == "player") || (targ.classname == "dmbot")) ) {
if ( (attacker.classname == "teledeath") )
{
bprint (targ.netname);
local float zufall;
zufall = random(); // randomize death messages
if (zufall > 0.75)
bprint (" was telefraged by ");
else if (zufall > 0.5)
bprint (" got in the way of ");
else if (zufall > 0.25)
bprint (" experienced birthing by ");
else
bprint (" had his personal space invaded by ");
bprint (attacker.owner.netname);
bprint ("\n");
if ( (attacker.owner.classname == "dmbot") )
{
TELEFRAGFLAG = TRUE;
}
attacker.owner.frags = (attacker.owner.frags + TRUE);
countkill (attacker.owner,targ);
if (attacker.owner.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, attacker.owner.id );
WriteShort( MSG_ALL, attacker.owner.frags );
}
return ;
}
if ( (attacker.classname == "teledeath2") )
{
bprint ("Satan's power deflects ");
bprint (targ.teamname);
bprint (targ.netname);
bprint ("'s telefrag\n");
countkill (targ,targ);
targ.frags = (targ.frags - TRUE);
if (targ.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, targ.id );
WriteShort( MSG_ALL, targ.frags );
}
return ;
}
if ( ((attacker.classname == "player") || (attacker.classname == "dmbot")) )
{
if ( (targ == attacker) ) {
attacker.frags = (attacker.frags - TRUE);
if (attacker.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, attacker.id );
WriteShort( MSG_ALL, attacker.frags );
}
countkill (attacker,attacker);
bprint (targ.teamname);
bprint (targ.netname);
if ( ((targ.weapon == FL_GODMODE) && (targ.waterlevel > TRUE)) ) {
bprint (" discharges into the water.\n");
return ;
}
if ( (targ.weapon == FL_INWATER) ) {
bprint (" tries to put the pin back in\n");
}
else
{
if ( rnum )
{
bprint (" becomes bored with life\n");
}
else
{
bprint (" checks if his weapon is loaded\n");
}
}
return ;
}
else
{
attacker.frags = (attacker.frags + TRUE);
if (attacker.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, attacker.id );
WriteShort( MSG_ALL, attacker.frags );
}
countkill (attacker,targ);
rnum = attacker.weapon;
if ( (rnum == IT_AXE) )
{
deathstring = " was ax-murdered by ";
deathstring = " was sliced by ";
deathstring = " was diced by ";
deathstring2 = "\n";
}
if ( (rnum == IT_SHOTGUN) )
{
deathstring = " chewed on ";
deathstring2 = "'s lead\n";
deathstring = " sucked on ";
deathstring2 = "'s shottie\n";
}
if ( (rnum == IT_SUPER_SHOTGUN) )
{
deathstring = " ate 2 loads of ";
deathstring2 = "'s shotgun shells\n";
}
if ( (rnum == IT_NAILGUN) )
{
deathstring = " was nailed by ";
deathstring2 = "'s nailgun\n";
}
if (rnum == IT_SUPER_NAILGUN)
{
deathstring = " was nailed to the wall by ";
deathstring2 = "'s supernail gun\n";
}
if ( (rnum == IT_GRENADE_LAUNCHER) )
{
deathstring = " eats ";
deathstring2 = "'s pineapple\n";
if ( (targ.health < -40.000) )
{
deathstring = " was gibbed by ";
deathstring2 = "'s grenade\n";
}
}
if (rnum == IT_ROCKET_LAUNCHER)
{
deathstring = " found ";
deathstring2 = "'s rocket up his ass\n";
if (targ.health < -40)
{
deathstring = " was destroyed by ";
deathstring2 = "'s rocket\n" ;
}
}
if ( (rnum == IT_LIGHTNING) ) {
deathstring = " accepts ";
if ( (attacker.waterlevel > TRUE) )
{
deathstring2 = "'s discharge\n";
}
else
{
deathstring2 = "'s shaft\n";
}
}
bprint (targ.teamname);
bprint (targ.netname);
bprint (deathstring);
bprint (attacker.teamname);
bprint (attacker.netname);
bprint (deathstring2);
}
return ;
} else {
targ.frags = (targ.frags - TRUE);
if (targ.classname == "dmbot")
{
WriteByte( MSG_ALL, MSG_UPDATEFRAGS );
WriteByte( MSG_ALL, targ.id );
WriteShort( MSG_ALL, targ.frags );
}
rnum = targ.watertype;
countkill (targ,targ);
bprint (targ.teamname);
bprint (targ.netname);
if ( (rnum == CONTENT_WATER) ) {
if ( (random () < 0.500) ) {
bprint (" sleeps with the fishes\n");
} else {
bprint (" sucks it down\n");
}
return ;
} else {
if ( (rnum == CONTENT_SLIME) ) {
if ( (random () < 0.500) ) {
bprint (" gulped a load of slime\n");
} else {
bprint (" can't exist on slime alone\n");
}
return ;
} else {
if ( (rnum == CONTENT_LAVA) ) {
if ( (targ.health < -15.000) ) {
bprint (" burst into flames\n");
return ;
}
if ( (random () < 0.500) ) {
bprint (" turned into hot slag\n");
} else {
bprint (" visits the Volcano God\n");
}
return ;
}
}
}
if ( (attacker.flags & FL_MONSTER) ) {
if ( (attacker.classname == "monster_army") ) {
bprint (" was shot by a Grunt\n");
}
if ( (attacker.classname == "monster_demon1") ) {
bprint (" was eviscerated by a Fiend\n");
}
if ( (attacker.classname == "monster_dog") ) {
bprint (" was mauled by a Rottweiler\n");
}
if ( (attacker.classname == "monster_dragon") ) {
bprint (" was fried by a Dragon\n");
}
if ( (attacker.classname == "monster_enforcer") ) {
bprint (" was blasted by an Enforcer\n");
}
if ( (attacker.classname == "monster_fish") ) {
bprint (" was fed to the Rotfish\n");
}
if ( (attacker.classname == "monster_hell_knight") ) {
bprint (" was slain by a Death Knight\n");
}
if ( (attacker.classname == "monster_knight") ) {
bprint (" was slashed by a Knight\n");
}
if ( (attacker.classname == "monster_ogre") ) {
bprint (" was destroyed by an Ogre\n");
}
if ( (attacker.classname == "monster_oldone") ) {
bprint (" became one with Shub-Niggurath\n");
}
if ( (attacker.classname == "monster_shalrath") ) {
bprint (" was exploded by a Vore\n");
}
if ( (attacker.classname == "monster_shambler") ) {
bprint (" was smashed by a Shambler\n");
}
if ( (attacker.classname == "monster_tarbaby") ) {
bprint (" was slimed by a Spawn\n");
}
if ( (attacker.classname == "monster_vomit") ) {
bprint (" was vomited on by a Vomitus\n");
}
if ( (attacker.classname == "monster_wizard") ) {
bprint (" was scragged by a Scrag\n");
}
if ( (attacker.classname == "monster_zombie") ) {
bprint (" joins the Zombies\n");
}
return ;
}
if ( (attacker.classname == "explo_box") ) {
bprint (" blew up\n");
return ;
}
if ( ((attacker.solid == SOLID_BSP) && (attacker != world)) )
{
local float zufall;
zufall = random(); // randomize death messages
if (zufall > 0.75)
bprint (" was squished\n");
else if (zufall > 0.5)
bprint (" did the monster mash\n");
else if (zufall > 0.25)
bprint (" was squashed\n");
else
bprint (" is more compact\n");
return;
}
if ( (targ.deathtype == "falling") ) {
targ.deathtype = "";
bprint (" fell to his death\n");
return ;
}
if ( ((attacker.classname == "trap_shooter") || (attacker.classname == "trap_spikeshooter")) ) {
bprint (" was spiked\n");
return;
}
if ( (attacker.classname == "fireball") ) {
bprint (" ate a lavaball\n");
return ;
}
if ( (attacker.classname == "trigger_changelevel") ) {
bprint (" tried to leave\n");
return ;
}
local float zufall;
zufall = random(); // randomize death messages
if (zufall > 0.75)
bprint (" died\n");
else if (zufall > 0.5)
bprint (" went to the wrong place\n");
else if (zufall > 0.25)
bprint (" went somewhere it wasn't supposed to be in\n");
}
}
};
Comment