/* ================== BotVoiceChat_WantOnOffense ================== */ void BotVoiceChat_WantOnOffense(bot_state_t *bs, int client, int mode) { char netname[MAX_NETNAME]; int preference; preference = BotGetTeamMateTaskPreference(bs, client); preference &= ~TEAMTP_DEFENDER; preference |= TEAMTP_ATTACKER; BotSetTeamMateTaskPreference(bs, client, preference); // EasyClientName(client, netname, sizeof(netname)); BotAI_BotInitialChat(bs, "keepinmind", netname, NULL); trap_BotEnterChat(bs->cs, client, CHAT_TELL); BotVoiceChatOnly(bs, client, VOICECHAT_YES); trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); }
/* ================== BotMatch_Suicide ================== */ void BotMatch_Suicide(bot_state_t *bs, bot_match_t *match) { char netname[MAX_MESSAGE_SIZE]; int client; if (!TeamPlayIsOn()) return; //if not addressed to this bot if (!BotAddressedToBot(bs, match)) return; // trap_EA_Command(bs->client, "kill"); // trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname)); client = ClientFromName(netname); // BotVoiceChat(bs, client, VOICECHAT_TAUNT); trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); }
/* ================== BotMatch_TaskPreference ================== */ void BotMatch_TaskPreference(bot_state_t *bs, bot_match_t *match) { char netname[MAX_NETNAME]; char teammatename[MAX_MESSAGE_SIZE]; int teammate, preference; ClientName(bs->client, netname, sizeof(netname)); if (Q_stricmp(netname, bs->teamleader) != 0) return; trap_BotMatchVariable(match, NETNAME, teammatename, sizeof(teammatename)); teammate = ClientFromName(teammatename); if (teammate < 0) return; preference = BotGetTeamMateTaskPreference(bs, teammate); switch(match->subtype) { case ST_DEFENDER: { preference &= ~TEAMTP_ATTACKER; preference |= TEAMTP_DEFENDER; break; } case ST_ATTACKER: { preference &= ~TEAMTP_DEFENDER; preference |= TEAMTP_ATTACKER; break; } case ST_ROAMER: { preference &= ~(TEAMTP_ATTACKER|TEAMTP_DEFENDER); break; } } BotSetTeamMateTaskPreference(bs, teammate, preference); // EasyClientName(teammate, teammatename, sizeof(teammatename)); BotAI_BotInitialChat(bs, "keepinmind", teammatename, NULL); trap_BotEnterChat(bs->cs, teammate, CHAT_TELL); BotVoiceChatOnly(bs, teammate, VOICECHAT_YES); trap_EA_Action(bs->client, ACTION_AFFIRMATIVE); }
/* ================ BotCommandAction The bot will send the specified action in the next command. NOTE: The action is one of ACTION_*, listed in botlib.h. NOTE: All of the movement actions, including walking, jumping, and crouching, will be ignored. It is NOT the responsibility of this function to manipulate bot movement. See ai_move.c for that. ================ */ void BotCommandAction(bot_state_t *bs, int action) { usercmd_t *cmd; // Inform the engine of the action trap_EA_Action(bs->client, action); // Look up the bot's next command structure cmd = &bs->cmd; // Set the appropriate command button for this action if (action & ACTION_RESPAWN) cmd->buttons |= BUTTON_ATTACK; if (action & ACTION_ATTACK) cmd->buttons |= BUTTON_ATTACK; if (action & ACTION_TALK) cmd->buttons |= BUTTON_TALK; if (action & ACTION_GESTURE) cmd->buttons |= BUTTON_GESTURE; if (action & ACTION_USE) cmd->buttons |= BUTTON_USE_HOLDABLE; if (action & ACTION_AFFIRMATIVE) cmd->buttons |= BUTTON_AFFIRMATIVE; if (action & ACTION_NEGATIVE) cmd->buttons |= BUTTON_NEGATIVE; if (action & ACTION_GETFLAG) cmd->buttons |= BUTTON_GETFLAG; if (action & ACTION_GUARDBASE) cmd->buttons |= BUTTON_GUARDBASE; if (action & ACTION_PATROL) cmd->buttons |= BUTTON_PATROL; if (action & ACTION_FOLLOWME) cmd->buttons |= BUTTON_FOLLOWME; }