reaction/code/game/ai_chat.c

1367 lines
34 KiB
C
Raw Normal View History

//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
2001-12-31 16:28:42 +00:00
// $Log$
// Revision 1.10 2005/02/15 16:33:39 makro
// Tons of updates (entity tree attachment system, UI vectors)
//
2002-07-22 06:35:03 +00:00
// Revision 1.9 2002/07/22 06:35:03 niceass
// cleaned up the powerup code
//
// Revision 1.8 2002/06/16 20:06:13 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
// Revision 1.7 2002/06/16 17:37:59 jbravo
// Removed the MISSIONPACK ifdefs and missionpack only code.
//
2002-04-01 12:45:54 +00:00
// Revision 1.6 2002/04/01 12:45:54 makro
// Changed some weapon names
//
// Revision 1.5 2002/01/11 19:48:29 jbravo
// Formatted the source in non DOS format.
//
2001-12-31 16:28:42 +00:00
// Revision 1.4 2001/12/31 16:28:41 jbravo
// I made a Booboo with the Log tag.
//
//
//-----------------------------------------------------------------------------
2001-05-06 20:50:27 +00:00
// Copyright (C) 1999-2000 Id Software, Inc.
//
/*****************************************************************************
* name: ai_chat.c
*
* desc: Quake3 bot AI
*
* $Archive: /MissionPack/code/game/ai_chat.c $
* $Author$
* $Revision$
* $Modtime: 11/19/00 8:39a $
* $Date$
*
*****************************************************************************/
#include "g_local.h"
#include "../botlib/botlib.h"
#include "../botlib/be_aas.h"
#include "../botlib/be_ea.h"
#include "../botlib/be_ai_char.h"
#include "../botlib/be_ai_chat.h"
#include "../botlib/be_ai_gen.h"
#include "../botlib/be_ai_goal.h"
#include "../botlib/be_ai_move.h"
#include "../botlib/be_ai_weap.h"
2001-05-06 20:50:27 +00:00
//
#include "ai_main.h"
#include "ai_dmq3.h"
#include "ai_chat.h"
#include "ai_cmd.h"
#include "ai_dmnet.h"
//
#include "chars.h" //characteristics
#include "inv.h" //indexes into the inventory
#include "syn.h" //synonyms
#include "match.h" //string matching types and vars
2001-05-06 20:50:27 +00:00
#define TIME_BETWEENCHATTING 25
/*
==================
BotNumActivePlayers
==================
*/
int BotNumActivePlayers(void)
{
2001-05-06 20:50:27 +00:00
int i, num;
char buf[MAX_INFO_STRING];
static int maxclients;
if (!maxclients)
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
num = 0;
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
trap_GetConfigstring(CS_PLAYERS + i, buf, sizeof(buf));
2001-05-06 20:50:27 +00:00
//if no config string or no name
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n")))
continue;
2001-05-06 20:50:27 +00:00
//skip spectators
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR)
continue;
2001-05-06 20:50:27 +00:00
//
num++;
}
return num;
}
/*
==================
BotIsFirstInRankings
==================
*/
int BotIsFirstInRankings(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
int i, score;
char buf[MAX_INFO_STRING];
static int maxclients;
playerState_t ps;
if (!maxclients)
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
score = bs->cur_ps.persistant[PERS_SCORE];
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
trap_GetConfigstring(CS_PLAYERS + i, buf, sizeof(buf));
2001-05-06 20:50:27 +00:00
//if no config string or no name
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n")))
continue;
2001-05-06 20:50:27 +00:00
//skip spectators
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR)
continue;
2001-05-06 20:50:27 +00:00
//
BotAI_GetClientState(i, &ps);
if (score < ps.persistant[PERS_SCORE])
return qfalse;
2001-05-06 20:50:27 +00:00
}
return qtrue;
}
/*
==================
BotIsLastInRankings
==================
*/
int BotIsLastInRankings(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
int i, score;
char buf[MAX_INFO_STRING];
static int maxclients;
playerState_t ps;
if (!maxclients)
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
score = bs->cur_ps.persistant[PERS_SCORE];
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
trap_GetConfigstring(CS_PLAYERS + i, buf, sizeof(buf));
2001-05-06 20:50:27 +00:00
//if no config string or no name
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n")))
continue;
2001-05-06 20:50:27 +00:00
//skip spectators
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR)
continue;
2001-05-06 20:50:27 +00:00
//
BotAI_GetClientState(i, &ps);
if (score > ps.persistant[PERS_SCORE])
return qfalse;
2001-05-06 20:50:27 +00:00
}
return qtrue;
}
/*
==================
BotFirstClientInRankings
==================
*/
char *BotFirstClientInRankings(void)
{
2001-05-06 20:50:27 +00:00
int i, bestscore, bestclient;
char buf[MAX_INFO_STRING];
static char name[32];
static int maxclients;
playerState_t ps;
if (!maxclients)
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
bestscore = -999999;
bestclient = 0;
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
trap_GetConfigstring(CS_PLAYERS + i, buf, sizeof(buf));
2001-05-06 20:50:27 +00:00
//if no config string or no name
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n")))
continue;
2001-05-06 20:50:27 +00:00
//skip spectators
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR)
continue;
2001-05-06 20:50:27 +00:00
//
BotAI_GetClientState(i, &ps);
if (ps.persistant[PERS_SCORE] > bestscore) {
bestscore = ps.persistant[PERS_SCORE];
bestclient = i;
}
}
EasyClientName(bestclient, name, 32);
return name;
}
/*
==================
BotLastClientInRankings
==================
*/
char *BotLastClientInRankings(void)
{
2001-05-06 20:50:27 +00:00
int i, worstscore, bestclient;
char buf[MAX_INFO_STRING];
static char name[32];
static int maxclients;
playerState_t ps;
if (!maxclients)
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
worstscore = 999999;
bestclient = 0;
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
trap_GetConfigstring(CS_PLAYERS + i, buf, sizeof(buf));
2001-05-06 20:50:27 +00:00
//if no config string or no name
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n")))
continue;
2001-05-06 20:50:27 +00:00
//skip spectators
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR)
continue;
2001-05-06 20:50:27 +00:00
//
BotAI_GetClientState(i, &ps);
if (ps.persistant[PERS_SCORE] < worstscore) {
worstscore = ps.persistant[PERS_SCORE];
bestclient = i;
}
}
EasyClientName(bestclient, name, 32);
return name;
}
/*
==================
BotRandomOpponentName
==================
*/
char *BotRandomOpponentName(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
int i, count;
char buf[MAX_INFO_STRING];
int opponents[MAX_CLIENTS], numopponents;
static int maxclients;
static char name[32];
if (!maxclients)
maxclients = trap_Cvar_VariableIntegerValue("sv_maxclients");
numopponents = 0;
opponents[0] = 0;
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++) {
if (i == bs->client)
continue;
2001-05-06 20:50:27 +00:00
//
trap_GetConfigstring(CS_PLAYERS + i, buf, sizeof(buf));
2001-05-06 20:50:27 +00:00
//if no config string or no name
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n")))
continue;
2001-05-06 20:50:27 +00:00
//skip spectators
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR)
continue;
2001-05-06 20:50:27 +00:00
//skip team mates
if (BotSameTeam(bs, i))
continue;
2001-05-06 20:50:27 +00:00
//
opponents[numopponents] = i;
numopponents++;
}
count = random() * numopponents;
for (i = 0; i < numopponents; i++) {
count--;
if (count <= 0) {
EasyClientName(opponents[i], name, sizeof(name));
return name;
}
}
EasyClientName(opponents[0], name, sizeof(name));
return name;
}
/*
==================
BotMapTitle
==================
*/
char *BotMapTitle(void)
{
2001-05-06 20:50:27 +00:00
char info[1024];
static char mapname[128];
trap_GetServerinfo(info, sizeof(info));
strncpy(mapname, Info_ValueForKey(info, "mapname"), sizeof(mapname) - 1);
mapname[sizeof(mapname) - 1] = '\0';
2001-05-06 20:50:27 +00:00
return mapname;
}
/*
==================
BotWeaponNameForMeansOfDeath
==================
*/
char *BotWeaponNameForMeansOfDeath(int mod)
{
switch (mod) {
case MOD_SHOTGUN:
return "Shotgun";
break;
case MOD_GAUNTLET:
return "Gauntlet";
break;
case MOD_MACHINEGUN:
return "Machinegun";
break;
case MOD_GRENADE:
case MOD_GRENADE_SPLASH:
return "Grenade Launcher";
break;
case MOD_ROCKET:
case MOD_ROCKET_SPLASH:
return "Rocket Launcher";
break;
case MOD_PLASMA:
case MOD_PLASMA_SPLASH:
return "Plasmagun";
break;
case MOD_RAILGUN:
return "Railgun";
break;
case MOD_LIGHTNING:
return "Lightning Gun";
break;
case MOD_BFG:
case MOD_BFG_SPLASH:
return "BFG10K";
break;
case MOD_GRAPPLE:
return "Grapple";
break;
2002-04-01 12:45:54 +00:00
//Makro - added RQ3 weapon names
case MOD_PISTOL:
return RQ3_PISTOL_NAME;
break;
case MOD_MP5:
return RQ3_MP5_NAME;
break;
case MOD_M4:
return RQ3_M4_NAME;
break;
case MOD_M3:
return RQ3_M3_NAME;
break;
case MOD_HANDCANNON:
return RQ3_HANDCANNON_NAME;
break;
case MOD_SNIPER:
return RQ3_SSG3000_NAME;
break;
case MOD_AKIMBO:
return RQ3_AKIMBO_NAME;
break;
case MOD_KNIFE:
case MOD_KNIFE_THROWN:
return RQ3_KNIFE_NAME;
break;
2002-04-01 12:45:54 +00:00
/*
case MOD_BLEEDING:
return RQ3_PISTOL_NAME;
break;
case MOD_KICK:
return RQ3_PISTOL_NAME;
break;
case MOD_FRIENDLY_FIRE:
return RQ3_PISTOL_NAME;
break;
*/
default:
return "[unknown weapon]";
break;
2001-05-06 20:50:27 +00:00
}
}
/*
==================
BotRandomWeaponName
==================
*/
char *BotRandomWeaponName(void)
{
2001-05-06 20:50:27 +00:00
int rnd;
rnd = random() * 8.9;
switch (rnd) {
2002-04-01 12:45:54 +00:00
//Makro - changed to RQ3 weapon names
/*
case 0: return "Gauntlet";
case 1: return "Shotgun";
case 2: return "Machinegun";
case 3: return "Grenade Launcher";
case 4: return "Rocket Launcher";
case 5: return "Plasmagun";
case 6: return "Railgun";
case 7: return "Lightning Gun";
default: return "BFG10K";
*/
2002-04-01 12:45:54 +00:00
case 0:
return RQ3_PISTOL_NAME;
break;
case 1:
return RQ3_M3_NAME;
break;
case 2:
return RQ3_MP5_NAME;
break;
case 3:
return RQ3_HANDCANNON_NAME;
break;
case 4:
return RQ3_SSG3000_NAME;
break;
case 5:
return RQ3_M4_NAME;
break;
case 6:
return RQ3_GRENADE_NAME;
break;
case 7:
return RQ3_AKIMBO_NAME;
break;
case 8:
return RQ3_KNIFE_NAME;
break;
default:
return RQ3_PISTOL_NAME;
break;
2001-05-06 20:50:27 +00:00
}
}
/*
==================
BotVisibleEnemies
==================
*/
int BotVisibleEnemies(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
float vis;
int i;
aas_entityinfo_t entinfo;
for (i = 0; i < MAX_CLIENTS; i++) {
if (i == bs->client)
continue;
2001-05-06 20:50:27 +00:00
//
BotEntityInfo(i, &entinfo);
//
if (!entinfo.valid)
continue;
2001-05-06 20:50:27 +00:00
//if the enemy isn't dead and the enemy isn't the bot self
if (EntityIsDead(&entinfo) || entinfo.number == bs->entitynum)
continue;
2001-05-06 20:50:27 +00:00
//if the enemy is invisible and not shooting
if (EntityIsInvisible(&entinfo) && !EntityIsShooting(&entinfo)) {
continue;
}
//if on the same team
if (BotSameTeam(bs, i))
continue;
2001-05-06 20:50:27 +00:00
//check if the enemy is visible
vis = BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, i);
if (vis > 0)
return qtrue;
2001-05-06 20:50:27 +00:00
}
return qfalse;
}
/*
==================
BotValidChatPosition
==================
*/
int BotValidChatPosition(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
vec3_t point, start, end, mins, maxs;
bsp_trace_t trace;
//if the bot is dead all positions are valid
if (BotIsDead(bs))
return qtrue;
2002-07-22 06:35:03 +00:00
2001-05-06 20:50:27 +00:00
//must be on the ground
//if (bs->cur_ps.groundEntityNum != ENTITYNUM_NONE) return qfalse;
//do not chat if in lava or slime
VectorCopy(bs->origin, point);
point[2] -= 24;
if (trap_PointContents(point, bs->entitynum) & (CONTENTS_LAVA | CONTENTS_SLIME))
return qfalse;
2001-05-06 20:50:27 +00:00
//do not chat if under water
VectorCopy(bs->origin, point);
point[2] += 32;
if (trap_PointContents(point, bs->entitynum) & MASK_WATER)
return qfalse;
2001-05-06 20:50:27 +00:00
//must be standing on the world entity
VectorCopy(bs->origin, start);
VectorCopy(bs->origin, end);
start[2] += 1;
end[2] -= 10;
trap_AAS_PresenceTypeBoundingBox(PRESENCE_CROUCH, mins, maxs);
BotAI_Trace(&trace, start, mins, maxs, end, bs->client, MASK_SOLID);
if (trace.ent != ENTITYNUM_WORLD)
return qfalse;
2001-05-06 20:50:27 +00:00
//the bot is in a position where it can chat
return qtrue;
}
/*
==================
BotChat_EnterGame
==================
*/
int BotChat_EnterGame(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32];
float rnd;
if (bot_nochat.integer)
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
2001-05-06 20:50:27 +00:00
//don't chat in teamplay
if (TeamPlayIsOn())
return qfalse;
2001-05-06 20:50:27 +00:00
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1);
if (!bot_fastchat.integer) {
if (random() > rnd)
return qfalse;
}
if (BotNumActivePlayers() <= 1)
return qfalse;
if (!BotValidChatPosition(bs))
return qfalse;
BotAI_BotInitialChat(bs, "game_enter", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
"[invalid var]", // 2
"[invalid var]", // 3
BotMapTitle(), // 4
NULL);
2001-05-06 20:50:27 +00:00
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChat_ExitGame
==================
*/
int BotChat_ExitGame(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32];
float rnd;
if (bot_nochat.integer)
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
2001-05-06 20:50:27 +00:00
//don't chat in teamplay
if (TeamPlayIsOn())
return qfalse;
2001-05-06 20:50:27 +00:00
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1);
if (!bot_fastchat.integer) {
if (random() > rnd)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (BotNumActivePlayers() <= 1)
return qfalse;
2001-05-06 20:50:27 +00:00
//
BotAI_BotInitialChat(bs, "game_exit", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
"[invalid var]", // 2
"[invalid var]", // 3
BotMapTitle(), // 4
NULL);
2001-05-06 20:50:27 +00:00
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChat_StartLevel
==================
*/
int BotChat_StartLevel(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32];
float rnd;
if (bot_nochat.integer)
return qfalse;
if (BotIsObserver(bs))
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
2001-05-06 20:50:27 +00:00
//don't chat in teamplay
if (TeamPlayIsOn()) {
trap_EA_Command(bs->client, "vtaunt");
return qfalse;
2001-05-06 20:50:27 +00:00
}
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1);
if (!bot_fastchat.integer) {
if (random() > rnd)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (BotNumActivePlayers() <= 1)
return qfalse;
BotAI_BotInitialChat(bs, "level_start", EasyClientName(bs->client, name, 32), // 0
NULL);
2001-05-06 20:50:27 +00:00
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChat_EndLevel
==================
*/
int BotChat_EndLevel(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32];
float rnd;
if (bot_nochat.integer)
return qfalse;
if (BotIsObserver(bs))
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
2001-05-06 20:50:27 +00:00
// teamplay
if (TeamPlayIsOn()) {
2001-05-06 20:50:27 +00:00
if (BotIsFirstInRankings(bs)) {
trap_EA_Command(bs->client, "vtaunt");
}
return qtrue;
}
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1);
if (!bot_fastchat.integer) {
if (random() > rnd)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (BotNumActivePlayers() <= 1)
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (BotIsFirstInRankings(bs)) {
BotAI_BotInitialChat(bs, "level_end_victory", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
"[invalid var]", // 2
BotLastClientInRankings(), // 3
BotMapTitle(), // 4
NULL);
} else if (BotIsLastInRankings(bs)) {
BotAI_BotInitialChat(bs, "level_end_lose", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
BotFirstClientInRankings(), // 2
"[invalid var]", // 3
BotMapTitle(), // 4
NULL);
} else {
BotAI_BotInitialChat(bs, "level_end", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
BotFirstClientInRankings(), // 2
BotLastClientInRankings(), // 3
BotMapTitle(), // 4
NULL);
2001-05-06 20:50:27 +00:00
}
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChat_Death
==================
*/
int BotChat_Death(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32];
float rnd;
if (bot_nochat.integer)
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
2001-05-06 20:50:27 +00:00
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_DEATH, 0, 1);
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
//if fast chatting is off
if (!bot_fastchat.integer) {
if (random() > rnd)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (BotNumActivePlayers() <= 1)
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (bs->lastkilledby >= 0 && bs->lastkilledby < MAX_CLIENTS)
EasyClientName(bs->lastkilledby, name, 32);
else
strcpy(name, "[world]");
//
if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledby)) {
if (bs->lastkilledby == bs->client)
return qfalse;
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "death_teammate", name, NULL);
bs->chatto = CHAT_TEAM;
} else {
2001-05-06 20:50:27 +00:00
//teamplay
if (TeamPlayIsOn()) {
trap_EA_Command(bs->client, "vtaunt");
return qtrue;
}
//
if (bs->botdeathtype == MOD_WATER)
BotAI_BotInitialChat(bs, "death_drown", BotRandomOpponentName(bs), NULL);
else if (bs->botdeathtype == MOD_SLIME)
BotAI_BotInitialChat(bs, "death_slime", BotRandomOpponentName(bs), NULL);
else if (bs->botdeathtype == MOD_LAVA)
BotAI_BotInitialChat(bs, "death_lava", BotRandomOpponentName(bs), NULL);
else if (bs->botdeathtype == MOD_FALLING)
BotAI_BotInitialChat(bs, "death_cratered", BotRandomOpponentName(bs), NULL);
else if (bs->botsuicide || //all other suicides by own weapon
bs->botdeathtype == MOD_CRUSH ||
bs->botdeathtype == MOD_SUICIDE ||
bs->botdeathtype == MOD_TARGET_LASER ||
bs->botdeathtype == MOD_TRIGGER_HURT || bs->botdeathtype == MOD_UNKNOWN ||
//Makro - custom message implies a trigger_hurt
bs->botdeathtype >= MOD_CUSTOM)
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "death_suicide", BotRandomOpponentName(bs), NULL);
else if (bs->botdeathtype == MOD_TELEFRAG)
BotAI_BotInitialChat(bs, "death_telefrag", name, NULL);
else {
if ((bs->botdeathtype == MOD_GAUNTLET ||
bs->botdeathtype == MOD_RAILGUN ||
bs->botdeathtype == MOD_BFG || bs->botdeathtype == MOD_BFG_SPLASH) && random() < 0.5) {
2001-05-06 20:50:27 +00:00
if (bs->botdeathtype == MOD_GAUNTLET)
BotAI_BotInitialChat(bs, "death_gauntlet", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
else if (bs->botdeathtype == MOD_RAILGUN)
BotAI_BotInitialChat(bs, "death_rail", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
else
BotAI_BotInitialChat(bs, "death_bfg", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
}
//choose between insult and praise
else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) {
BotAI_BotInitialChat(bs, "death_insult", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
} else {
BotAI_BotInitialChat(bs, "death_praise", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
}
}
bs->chatto = CHAT_ALL;
}
bs->lastchat_time = FloatTime();
return qtrue;
}
/*
==================
BotChat_Kill
==================
*/
int BotChat_Kill(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32];
float rnd;
if (bot_nochat.integer)
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
2001-05-06 20:50:27 +00:00
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_KILL, 0, 1);
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
//if fast chat is off
if (!bot_fastchat.integer) {
if (random() > rnd)
return qfalse;
}
if (bs->lastkilledplayer == bs->client)
return qfalse;
if (BotNumActivePlayers() <= 1)
return qfalse;
if (!BotValidChatPosition(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (BotVisibleEnemies(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
EasyClientName(bs->lastkilledplayer, name, 32);
//
bs->chatto = CHAT_ALL;
if (TeamPlayIsOn() && BotSameTeam(bs, bs->lastkilledplayer)) {
BotAI_BotInitialChat(bs, "kill_teammate", name, NULL);
bs->chatto = CHAT_TEAM;
} else {
2001-05-06 20:50:27 +00:00
//don't chat in teamplay
if (TeamPlayIsOn()) {
trap_EA_Command(bs->client, "vtaunt");
return qfalse; // don't wait
2001-05-06 20:50:27 +00:00
}
//
if (bs->enemydeathtype == MOD_GAUNTLET) {
BotAI_BotInitialChat(bs, "kill_gauntlet", name, NULL);
} else if (bs->enemydeathtype == MOD_RAILGUN) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "kill_rail", name, NULL);
} else if (bs->enemydeathtype == MOD_TELEFRAG) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL);
}
//choose between insult and praise
else if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1)) {
BotAI_BotInitialChat(bs, "kill_insult", name, NULL);
} else {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "kill_praise", name, NULL);
}
}
bs->lastchat_time = FloatTime();
return qtrue;
}
/*
==================
BotChat_EnemySuicide
==================
*/
int BotChat_EnemySuicide(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32];
float rnd;
if (bot_nochat.integer)
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
if (BotNumActivePlayers() <= 1)
return qfalse;
2001-05-06 20:50:27 +00:00
//
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENEMYSUICIDE, 0, 1);
2001-05-06 20:50:27 +00:00
//don't chat in teamplay
if (TeamPlayIsOn())
return qfalse;
2001-05-06 20:50:27 +00:00
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
//if fast chat is off
if (!bot_fastchat.integer) {
if (random() > rnd)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (!BotValidChatPosition(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (BotVisibleEnemies(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (bs->enemy >= 0)
EasyClientName(bs->enemy, name, 32);
else
strcpy(name, "");
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL);
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChat_HitTalking
==================
*/
int BotChat_HitTalking(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32], *weap;
int lasthurt_client;
float rnd;
if (bot_nochat.integer)
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
if (BotNumActivePlayers() <= 1)
return qfalse;
2001-05-06 20:50:27 +00:00
lasthurt_client = g_entities[bs->client].client->lasthurt_client;
if (!lasthurt_client)
return qfalse;
if (lasthurt_client == bs->client)
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS)
return qfalse;
2001-05-06 20:50:27 +00:00
//
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITTALKING, 0, 1);
//don't chat in teamplay
if (TeamPlayIsOn())
return qfalse;
2001-05-06 20:50:27 +00:00
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
//if fast chat is off
if (!bot_fastchat.integer) {
if (random() > rnd * 0.5)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (!BotValidChatPosition(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
2001-05-06 20:50:27 +00:00
//
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChat_HitNoDeath
==================
*/
int BotChat_HitNoDeath(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32], *weap;
float rnd;
int lasthurt_client;
aas_entityinfo_t entinfo;
lasthurt_client = g_entities[bs->client].client->lasthurt_client;
if (!lasthurt_client)
return qfalse;
if (lasthurt_client == bs->client)
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS)
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (bot_nochat.integer)
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
if (BotNumActivePlayers() <= 1)
return qfalse;
2001-05-06 20:50:27 +00:00
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNODEATH, 0, 1);
//don't chat in teamplay
if (TeamPlayIsOn())
return qfalse;
2001-05-06 20:50:27 +00:00
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
//if fast chat is off
if (!bot_fastchat.integer) {
if (random() > rnd * 0.5)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (!BotValidChatPosition(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (BotVisibleEnemies(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
BotEntityInfo(bs->enemy, &entinfo);
if (EntityIsShooting(&entinfo))
return qfalse;
2001-05-06 20:50:27 +00:00
//
ClientName(lasthurt_client, name, sizeof(name));
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
//
BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL);
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChat_HitNoKill
==================
*/
int BotChat_HitNoKill(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32], *weap;
float rnd;
aas_entityinfo_t entinfo;
if (bot_nochat.integer)
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
if (BotNumActivePlayers() <= 1)
return qfalse;
2001-05-06 20:50:27 +00:00
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNOKILL, 0, 1);
//don't chat in teamplay
if (TeamPlayIsOn())
return qfalse;
2001-05-06 20:50:27 +00:00
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
//if fast chat is off
if (!bot_fastchat.integer) {
if (random() > rnd * 0.5)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (!BotValidChatPosition(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (BotVisibleEnemies(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
BotEntityInfo(bs->enemy, &entinfo);
if (EntityIsShooting(&entinfo))
return qfalse;
2001-05-06 20:50:27 +00:00
//
ClientName(bs->enemy, name, sizeof(name));
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->enemy].client->lasthurt_mod);
//
BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL);
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChat_Random
==================
*/
int BotChat_Random(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
float rnd;
char name[32];
if (bot_nochat.integer)
return qfalse;
if (BotIsObserver(bs))
return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING)
return qfalse;
2001-05-06 20:50:27 +00:00
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT)
return qfalse;
2001-05-06 20:50:27 +00:00
//don't chat when doing something important :)
if (bs->ltgtype == LTG_TEAMHELP || bs->ltgtype == LTG_TEAMACCOMPANY || bs->ltgtype == LTG_RUSHBASE)
return qfalse;
2001-05-06 20:50:27 +00:00
//
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_RANDOM, 0, 1);
if (random() > bs->thinktime * 0.1)
return qfalse;
2001-05-06 20:50:27 +00:00
if (!bot_fastchat.integer) {
if (random() > rnd)
return qfalse;
if (random() > 0.25)
return qfalse;
2001-05-06 20:50:27 +00:00
}
if (BotNumActivePlayers() <= 1)
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (!BotValidChatPosition(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (BotVisibleEnemies(bs))
return qfalse;
2001-05-06 20:50:27 +00:00
//
if (bs->lastkilledplayer == bs->client) {
strcpy(name, BotRandomOpponentName(bs));
} else {
2001-05-06 20:50:27 +00:00
EasyClientName(bs->lastkilledplayer, name, sizeof(name));
}
if (TeamPlayIsOn()) {
trap_EA_Command(bs->client, "vtaunt");
return qfalse; // don't wait
2001-05-06 20:50:27 +00:00
}
//
if (random() < trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_MISC, 0, 1)) {
BotAI_BotInitialChat(bs, "random_misc", BotRandomOpponentName(bs), // 0
name, // 1
"[invalid var]", // 2
"[invalid var]", // 3
BotMapTitle(), // 4
BotRandomWeaponName(), // 5
NULL);
} else {
BotAI_BotInitialChat(bs, "random_insult", BotRandomOpponentName(bs), // 0
name, // 1
"[invalid var]", // 2
"[invalid var]", // 3
BotMapTitle(), // 4
BotRandomWeaponName(), // 5
NULL);
2001-05-06 20:50:27 +00:00
}
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
/*
==================
BotChatTime
==================
*/
float BotChatTime(bot_state_t * bs)
{
2012-01-14 00:18:42 +00:00
// int cpm;
2001-05-06 20:50:27 +00:00
2012-01-14 00:18:42 +00:00
// cpm = trap_Characteristic_BInteger(bs->character, CHARACTERISTIC_CHAT_CPM, 1, 4000);
2001-05-06 20:50:27 +00:00
return 2.0; //(float) trap_BotChatLength(bs->cs) * 30 / cpm;
2001-05-06 20:50:27 +00:00
}
/*
==================
BotChatTest
==================
*/
void BotChatTest(bot_state_t * bs)
{
2001-05-06 20:50:27 +00:00
char name[32];
char *weap;
int num, i;
num = trap_BotNumInitialChats(bs->cs, "game_enter");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "game_enter", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
"[invalid var]", // 2
"[invalid var]", // 3
BotMapTitle(), // 4
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "game_exit");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "game_exit", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
"[invalid var]", // 2
"[invalid var]", // 3
BotMapTitle(), // 4
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "level_start");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "level_start", EasyClientName(bs->client, name, 32), // 0
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "level_end_victory");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "level_end_victory", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
BotFirstClientInRankings(), // 2
BotLastClientInRankings(), // 3
BotMapTitle(), // 4
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "level_end_lose");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "level_end_lose", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
BotFirstClientInRankings(), // 2
BotLastClientInRankings(), // 3
BotMapTitle(), // 4
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "level_end");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "level_end", EasyClientName(bs->client, name, 32), // 0
BotRandomOpponentName(bs), // 1
BotFirstClientInRankings(), // 2
BotLastClientInRankings(), // 3
BotMapTitle(), // 4
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
EasyClientName(bs->lastkilledby, name, sizeof(name));
num = trap_BotNumInitialChats(bs->cs, "death_drown");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
//
BotAI_BotInitialChat(bs, "death_drown", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_slime");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "death_slime", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_lava");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "death_lava", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_cratered");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "death_cratered", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_suicide");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "death_suicide", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_telefrag");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "death_telefrag", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_gauntlet");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "death_gauntlet", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_rail");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "death_rail", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_bfg");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "death_bfg", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_insult");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "death_insult", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "death_praise");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "death_praise", name, // 0
BotWeaponNameForMeansOfDeath(bs->botdeathtype), // 1
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
//
EasyClientName(bs->lastkilledplayer, name, 32);
//
num = trap_BotNumInitialChats(bs->cs, "kill_gauntlet");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
//
BotAI_BotInitialChat(bs, "kill_gauntlet", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "kill_rail");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "kill_rail", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "kill_telefrag");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "kill_telefrag", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "kill_insult");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "kill_insult", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "kill_praise");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "kill_praise", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "enemy_suicide");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "enemy_suicide", name, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_client);
num = trap_BotNumInitialChats(bs->cs, "hit_talking");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "hit_nodeath");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "hit_nodeath", name, weap, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "hit_nokill");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
BotAI_BotInitialChat(bs, "hit_nokill", name, weap, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
//
if (bs->lastkilledplayer == bs->client) {
strcpy(name, BotRandomOpponentName(bs));
} else {
2001-05-06 20:50:27 +00:00
EasyClientName(bs->lastkilledplayer, name, sizeof(name));
}
//
num = trap_BotNumInitialChats(bs->cs, "random_misc");
for (i = 0; i < num; i++) {
2001-05-06 20:50:27 +00:00
//
BotAI_BotInitialChat(bs, "random_misc", BotRandomOpponentName(bs), // 0
name, // 1
"[invalid var]", // 2
"[invalid var]", // 3
BotMapTitle(), // 4
BotRandomWeaponName(), // 5
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
num = trap_BotNumInitialChats(bs->cs, "random_insult");
for (i = 0; i < num; i++) {
BotAI_BotInitialChat(bs, "random_insult", BotRandomOpponentName(bs), // 0
name, // 1
"[invalid var]", // 2
"[invalid var]", // 3
BotMapTitle(), // 4
BotRandomWeaponName(), // 5
NULL);
2001-05-06 20:50:27 +00:00
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
}