Ejemplo n.º 1
0
/*
==================
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;
}
Ejemplo n.º 2
0
/*
==================
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;
}
Ejemplo n.º 3
0
/*
==================
BotVisibleEnemies
==================
*/
int BotVisibleEnemies(bot_state_t *bs) {
	float vis;
	int i;
	aas_entityinfo_t entinfo;

	for (i = 0; i < MAX_CLIENTS; i++) {

		if (i == bs->client) continue;
		//
		BotEntityInfo(i, &entinfo);
		//
		if (!entinfo.valid) continue;
		//if the enemy isn't dead and the enemy isn't the bot self
		if (EntityIsDead(&entinfo) || entinfo.number == bs->entitynum) continue;
		//if the enemy is invisible and not shooting
		if (EntityIsInvisible(&entinfo) && !EntityIsShooting(&entinfo)) {
			continue;
		}
		//if on the same team
		if (BotSameTeam(bs, i)) continue;
		//check if the enemy is visible
		vis = BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, i);
		if (vis > 0) return qtrue;
	}
	return qfalse;
}
Ejemplo n.º 4
0
/*
=======================================================================================================================================
BotChat_HitNoDeath
=======================================================================================================================================
*/
int BotChat_HitNoDeath(bot_state_t *bs) {
	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;
	}

	if (lasthurt_client < 0 || lasthurt_client >= MAX_CLIENTS) {
		return qfalse;
	}

	if (bs->lastchat_time > FloatTime() - TIME_BETWEENCHATTING) {
		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;
	}
	// don't chat in tournament mode
	if (gametype == GT_TOURNAMENT) {
		return qfalse;
	}

	if (random() > rnd * 0.5) {
		return qfalse;
	}

	if (!BotValidChatPosition(bs)) {
		return qfalse;
	}

	if (BotVisibleEnemies(bs)) {
		return qfalse;
	}

	if (bs->enemy >= MAX_CLIENTS) {
		return qfalse;
	}

	if (bs->enemy >= 0) {
		// get the entity information
		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 = FloatTime();
	bs->chatto = CHAT_ALL;
	return qtrue;
}