本文整理汇总了C++中BotAI_BotInitialChat函数的典型用法代码示例。如果您正苦于以下问题:C++ BotAI_BotInitialChat函数的具体用法?C++ BotAI_BotInitialChat怎么用?C++ BotAI_BotInitialChat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BotAI_BotInitialChat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BotMatch_WrongWall
void BotMatch_WrongWall(bot_state_t* bs, bot_match_t *match){
char netname[MAX_MESSAGE_SIZE];
char buf[MAX_INFO_STRING];
int client;
if(gametype != GT_SPRAY)
return;
// talking about me ? (avoid clientfromname, its ambiguous)
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
trap_GetConfigstring(CS_PLAYERS + bs->client, buf, sizeof(buf));
Q_CleanStr( buf );
if (!Q_stricmp(Info_ValueForKey(buf, "n"), netname)){
// could be someone with same name, so make (more) sure
if( ClientInSprayroom(bs->client) ){
bs->which_wall = BotChooseCorrectWall(bs);
bs->enemy = -1;
// chat
BotAI_BotInitialChat(bs, "wall_missed", NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
return;
}
}
// check if opposite team
client = ClientFromName(netname);
if(!BotSameTeam(bs, client)){
float rnd;
// flame
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_INSULT, 0, 1);
if(random() > rnd) return;
BotAI_BotInitialChat(bs, "wall_insult", netname, NULL);
trap_BotEnterChat(bs->cs, 0, CHAT_ALL);
}
}
示例2: BotMatch_WhereAreYou
/*
==================
BotMatch_WhereAreYou
==================
*/
void BotMatch_WhereAreYou( bot_state_t *bs, bot_match_t *match ) {
float dist, bestdist;
int i, bestitem, redflagtt, blueflagtt, redtobluett;
bot_goal_t goal;
char *nearbyitems[] = {
"Shotgun",
"Grenade Launcher",
"Rocket Launcher",
"Plasmagun",
"Railgun",
"Lightning Gun",
"BFG10K",
"Quad Damage",
"Regeneration",
"Battle Suit",
"Speed",
"Invisibility",
"Flight",
"Armor",
"Heavy Armor",
"Red Flag",
"Blue Flag",
NULL
};
//
if ( !TeamPlayIsOn() ) {
return;
}
//if not addressed to this bot
if ( !BotAddressedToBot( bs, match ) ) {
return;
}
bestitem = -1;
bestdist = 999999;
for ( i = 0; nearbyitems[i]; i++ ) {
dist = BotNearestVisibleItem( bs, nearbyitems[i], &goal );
if ( dist < bestdist ) {
bestdist = dist;
bestitem = i;
}
}
if ( bestitem != -1 ) {
if ( gametype == GT_CTF ) {
redflagtt = trap_AAS_AreaTravelTimeToGoalArea( bs->areanum, bs->origin, ctf_redflag.areanum, TFL_DEFAULT );
blueflagtt = trap_AAS_AreaTravelTimeToGoalArea( bs->areanum, bs->origin, ctf_blueflag.areanum, TFL_DEFAULT );
redtobluett = trap_AAS_AreaTravelTimeToGoalArea( ctf_redflag.areanum, ctf_redflag.origin, ctf_blueflag.areanum, TFL_DEFAULT );
if ( redflagtt < ( redflagtt + blueflagtt ) * 0.4 ) {
BotAI_BotInitialChat( bs, "ctflocation", nearbyitems[bestitem], "red", NULL );
} else if ( blueflagtt < ( redflagtt + blueflagtt ) * 0.4 ) {
BotAI_BotInitialChat( bs, "ctflocation", nearbyitems[bestitem], "blue", NULL );
} else {
BotAI_BotInitialChat( bs, "location", nearbyitems[bestitem], NULL );
}
} else {
BotAI_BotInitialChat( bs, "location", nearbyitems[bestitem], NULL );
}
trap_BotEnterChat( bs->cs, bs->client, CHAT_TEAM );
}
}
示例3: BotMatch_CheckPoint
/*
=======================================================================================================================================
BotMatch_CheckPoint
=======================================================================================================================================
*/
void BotMatch_CheckPoint(bot_state_t *bs, bot_match_t *match) {
int areanum;
char buf[MAX_MESSAGE_SIZE];
vec3_t position;
bot_waypoint_t *cp;
if (!TeamPlayIsOn()) {
return;
}
trap_BotMatchVariable(match, POSITION, buf, MAX_MESSAGE_SIZE);
VectorClear(position);
// BotGPSToPosition(buf, position);
sscanf(buf, "%f %f %f", &position[0], &position[1], &position[2]);
position[2] += 0.5;
areanum = BotPointAreaNum(position);
if (!areanum) {
if (BotAddressedToBot(bs, match)) {
BotAI_BotInitialChat(bs, "checkpoint_invalid", NULL);
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
}
return;
}
trap_BotMatchVariable(match, NAME, buf, MAX_MESSAGE_SIZE);
// check if there already exists a checkpoint with this name
cp = BotFindWayPoint(bs->checkpoints, buf);
if (cp) {
if (cp->next) {
cp->next->prev = cp->prev;
}
if (cp->prev) {
cp->prev->next = cp->next;
} else {bs->checkpoints = cp->next;}
cp->inuse = qfalse;
}
// create a new check point
cp = BotCreateWayPoint(buf, position, areanum);
// add the check point to the bot's known chech points
cp->next = bs->checkpoints;
if (bs->checkpoints) {
bs->checkpoints->prev = cp;
}
bs->checkpoints = cp;
if (BotAddressedToBot(bs, match)) {
Com_sprintf(buf, sizeof(buf), "%1.0f %1.0f %1.0f", cp->goal.origin[0], cp->goal.origin[1], cp->goal.origin[2]);
BotAI_BotInitialChat(bs, "checkpoint_confirm", cp->name, buf, NULL);
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
}
}
示例4: BotChat_EndLevel
/*
==================
BotChat_EndLevel
==================
*/
int BotChat_EndLevel(bot_state_t *bs) {
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;
// teamplay
if (TeamPlayIsOn())
{
#ifdef MISSIONPACK
if (BotIsFirstInRankings(bs)) {
trap_EA_Command(bs->client, "vtaunt");
}
#endif
return qtrue;
}
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT) return qfalse;
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1);
if (!bot_fastchat.integer) {
if (random() > rnd) return qfalse;
}
if (BotNumActivePlayers() <= 1) return qfalse;
//
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);
}
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
示例5: BotChat_EndLevel
/*
==================
BotChat_EndLevel
==================
*/
int BotChat_EndLevel( bot_state_t *bs ) {
char name[32];
float rnd;
if ( bot_nochat.integer ) {
return qfalse;
}
if ( BotIsObserver( bs ) ) {
return qfalse;
}
if ( bs->lastchat_time > trap_AAS_Time() - 3 ) {
return qfalse;
}
//don't chat in teamplay
if ( TeamPlayIsOn() ) {
return qfalse;
}
rnd = trap_Characteristic_BFloat( bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1 );
if ( !bot_fastchat.integer ) {
if ( random() > rnd ) {
return qfalse;
}
}
if ( BotNumActivePlayers() <= 1 ) {
return qfalse;
}
//
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 );
}
bs->lastchat_time = trap_AAS_Time();
bs->chatto = CHAT_ALL;
return qtrue;
}
示例6: BotMatch_WhichTeam
/*
==================
BotMatch_LeaveSubteam
==================
*/
void BotMatch_WhichTeam(bot_state_t *bs, bot_match_t *match) {
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
//
if (strlen(bs->subteam)) {
BotAI_BotInitialChat(bs, "inteam", bs->subteam, NULL);
}
else {
BotAI_BotInitialChat(bs, "noteam", NULL);
}
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
}
示例7: BotChat_EnterGame
/*
==================
BotChat_EnterGame
==================
*/
int BotChat_EnterGame(bot_state_t *bs) {
char name[32];
float rnd;
if (bot_nochat.integer) return qfalse;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) return qfalse;
//don't chat in teamplay
if (TeamPlayIsOn()) return qfalse;
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT) return qfalse;
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);
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
示例8: BotChat_HitNoDeath
/*
==================
BotChat_HitNoDeath
==================
*/
int BotChat_HitNoDeath( bot_state_t *bs ) {
char name[32];
const char* 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;
}
//
if ( lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS ) {
return qfalse;
}
//
if ( bot_nochat.integer ) {
return qfalse;
}
if ( bs->lastchat_time > trap_AAS_Time() - 3 ) {
return qfalse;
}
if ( BotNumActivePlayers() <= 1 ) {
return qfalse;
}
rnd = trap_Characteristic_BFloat( bs->character, CHARACTERISTIC_CHAT_HITNODEATH, 0, 1 );
//don't chat in teamplay
if ( TeamPlayIsOn() ) {
return qfalse;
}
//if fast chat is off
if ( !bot_fastchat.integer ) {
if ( random() > rnd * 0.5 ) {
return qfalse;
}
}
if ( !BotValidChatPosition( bs ) ) {
return qfalse;
}
//if the enemy is visible
if ( BotEntityVisible( bs->client, bs->eye, bs->viewangles, 360, bs->enemy ) ) {
return qfalse;
}
//
BotEntityInfo( bs->enemy, &entinfo );
if ( EntityIsShooting( &entinfo ) ) {
return qfalse;
}
//
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 = trap_AAS_Time();
bs->chatto = CHAT_ALL;
return qtrue;
}
示例9: BotChat_ExitGame
/*
=======================================================================================================================================
BotChat_ExitGame
=======================================================================================================================================
*/
int BotChat_ExitGame(bot_state_t *bs) {
char name[32];
float rnd;
if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) {
return qfalse;
}
// don't chat in teamplay
if (TeamPlayIsOn()) {
return qfalse;
}
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT) {
return qfalse;
}
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_ENTEREXITGAME, 0, 1);
if (random() > rnd) {
return qfalse;
}
if (BotNumActivePlayers() <= 1) {
return qfalse;
}
BotAI_BotInitialChat(bs, "game_exit", EasyClientName(bs->client, name, 32), BotRandomOpponentName(bs), "[invalid var]", "[invalid var]", BotMapTitle(), NULL);
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
示例10: BotMatch_Kill
/*
==================
BotMatch_Kill
==================
*/
void BotMatch_Kill(bot_state_t *bs, bot_match_t *match) {
char enemy[MAX_MESSAGE_SIZE];
char netname[MAX_MESSAGE_SIZE];
int playernum;
if (!TeamPlayIsOn()) return;
//if not addressed to this bot
if (!BotAddressedToBot(bs, match)) return;
BotMatchVariable(match, ENEMY, enemy, sizeof(enemy));
//
playernum = FindEnemyByName(bs, enemy);
if (playernum < 0) {
BotAI_BotInitialChat(bs, "whois", enemy, NULL);
BotMatchVariable(match, NETNAME, netname, sizeof(netname));
playernum = PlayerFromName(netname);
BotEnterChat(bs->cs, playernum, CHAT_TELL);
return;
}
bs->teamgoal.entitynum = playernum;
//set the time to send a message to the team mates
bs->teammessage_time = FloatTime() + 2 * random();
//set the ltg type
bs->ltgtype = LTG_KILL;
//set the team goal time
bs->teamgoal_time = FloatTime() + TEAM_KILL_SOMEONE;
//
BotSetTeamStatus(bs);
BotPrintTeamGoal(bs);
}
示例11: BotChat_StartLevel
/*
==================
BotChat_StartLevel
==================
*/
int BotChat_StartLevel(bot_state_t *bs) {
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;
//don't chat in teamplay
if (TeamPlayIsOn()) {
#ifdef MISSIONPACK
trap_EA_Command(bs->client, "vtaunt");
#endif
return qfalse;
}
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT) return qfalse;
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1);
if (!bot_fastchat.integer) {
if (random() > rnd) return qfalse;
}
if (BotNumActivePlayers() <= 1) return qfalse;
BotAI_BotInitialChat(bs, "level_start",
EasyClientName(bs->client, name, 32), // 0
NULL);
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
示例12: BotChat_HitTalking
/*
==================
BotChat_HitTalking
==================
*/
int BotChat_HitTalking(bot_state_t *bs) {
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;
lasthurt_client = g_entities[bs->client].client->lasthurt_client;
if (!lasthurt_client) return qfalse;
if (lasthurt_client == bs->client) return qfalse;
//
if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS) return qfalse;
//
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITTALKING, 0, 1);
//don't chat in teamplay
if (TeamPlayIsOn()) return qfalse;
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT) return qfalse;
//if fast chat is off
if (!bot_fastchat.integer) {
if (random() > rnd * 0.5) return qfalse;
}
if (!BotValidChatPosition(bs)) return qfalse;
//
ClientName(g_entities[bs->client].client->lasthurt_client, name, sizeof(name));
weap = BotWeaponNameForMeansOfDeath(g_entities[bs->client].client->lasthurt_mod);
//
BotAI_BotInitialChat(bs, "hit_talking", name, weap, NULL);
bs->lastchat_time = FloatTime();
bs->chatto = CHAT_ALL;
return qtrue;
}
示例13: BotChat_StartLevel
/*
==================
BotChat_StartLevel
==================
*/
int BotChat_StartLevel( bot_state_t *bs ) {
char name[32];
float rnd;
if ( bot_nochat.integer ) {
return qfalse;
}
if ( BotIsObserver( bs ) ) {
return qfalse;
}
if ( bs->lastchat_time > trap_AAS_Time() - 3 ) {
return qfalse;
}
//don't chat in teamplay
if ( TeamPlayIsOn() ) {
return qfalse;
}
rnd = trap_Characteristic_BFloat( bs->character, CHARACTERISTIC_CHAT_STARTENDLEVEL, 0, 1 );
if ( !bot_fastchat.integer ) {
if ( random() > rnd ) {
return qfalse;
}
}
if ( BotNumActivePlayers() <= 1 ) {
return qfalse;
}
BotAI_BotInitialChat( bs, "level_start",
EasyClientName( bs->client, name, 32 ), // 0
NULL );
bs->lastchat_time = trap_AAS_Time();
bs->chatto = CHAT_ALL;
return qtrue;
}
示例14: BotMatch_Kill
/*
=======================================================================================================================================
BotMatch_Kill
=======================================================================================================================================
*/
void BotMatch_Kill(bot_state_t *bs, bot_match_t *match) {
char enemy[MAX_MESSAGE_SIZE];
int client;
if (!TeamPlayIsOn()) {
return;
}
// if not addressed to this bot
if (!BotAddressedToBot(bs, match)) {
return;
}
trap_BotMatchVariable(match, ENEMY, enemy, sizeof(enemy));
client = FindEnemyByName(bs, enemy);
if (client < 0) {
BotAI_BotInitialChat(bs, "whois", enemy, NULL);
trap_BotEnterChat(bs->cs, bs->client, CHAT_TEAM);
return;
}
bs->teamgoal.entitynum = client;
// set the time to send a message to the team mates
bs->teammessage_time = trap_AAS_Time() + 2 * random();
// set the ltg type
bs->ltgtype = LTG_KILL;
// set the team goal time
bs->teamgoal_time = trap_AAS_Time() + TEAM_KILL_SOMEONE;
#ifdef DEBUG
BotPrintTeamGoal(bs);
#endif // DEBUG
}
示例15: BotChat_HitNoKill
/*
==================
BotChat_HitNoKill
==================
*/
int BotChat_HitNoKill(bot_state_t *bs) {
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;
rnd = trap_Characteristic_BFloat(bs->character, CHARACTERISTIC_CHAT_HITNOKILL, 0, 1);
//don't chat in teamplay
if (TeamPlayIsOn()) return qfalse;
// don't chat in tournament mode
if (gametype == GT_TOURNAMENT) return qfalse;
//if fast chat is off
if (!bot_fastchat.integer) {
if (random() > rnd * 0.5) return qfalse;
}
if (!BotValidChatPosition(bs)) return qfalse;
//
if (BotVisibleEnemies(bs)) return qfalse;
//
BotEntityInfo(bs->enemy, &entinfo);
if (EntityIsShooting(&entinfo)) return qfalse;
//
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;
}