OpportunisticallyUseWeaponAbilities

From Valve Developer Community
Jump to: navigation, search
English (en)
Edit

OpportunisticallyUseWeaponAbilities is a NextBot action in Team Fortress 2 Team Fortress 2, for tf_bots, that makes the acting bot use a weapon ability. This action is called when bomb is carrying item_teamflag in the Mann Vs. Machine gamemode; and the action is passively called in CTFBotTacticalMonitor::Update.

Code: OpportunisticallyUseWeaponAbilities is defined in game/server/tf/bot/tf_bot.cpp.
Note.pngNote:The weapons are listed in the order they are processed.

Elaboration

OpportunisticallyUseWeaponAbilities uses a timer, between 0.1 seconds (100ms) and 0.2 seconds (200ms), to determine when to use a special ability. If the timer has not elasped, then the action will be aborted.

Shields

The actor bot will generally attempt to charge if they are the Demoman class and they have a shield item equipped.

The bot will not attempt to charge if they have the CTFBot::AIR_CHARGE_ONLY attribute (the bot is already charging in the air); and their Z velocity is higher than zero. (Positive Z indicates going up.)

B.A.S.E Jumper

If the bot has a BASE Jumper equipped; then it will attempt to use the parachute. The bot will activate the BASE Jumper's parachute when **all** of the below conditions are true:

  1. The bot's health ratio is higher than the health threshold 0.5.
  2. The bot does not have TF_COND_BURNING. (The bot is not burning.)
  3. The bot has negative-Z velocity (or falling).
  4. The bot can traverse 150hu downards. (Generally this means they can fall 150hu below.)

If the bot already has TF_COND_PARACHUTE_DEPLOYED, then the bot will press the jump button (to deactivate the parachute) if any of these conditions are true:

  • The bot's health ratio is lower than 0.5 (50%). (flHealthPercent < flHealthThreshold)
  • The bot has TF_COND_BURNING. (The bot is on fire.)
  • The bot can not traverse down 150hu. (Generally this means that the bot is 150hu away from the ground.)

TF_WEAPON_BUFF_ITEM

Note.pngNote:TF_WEAPON_BUFF_ITEM, in game code, refers to the Buff Banner, Battalion's Backup, and Concheror.

If the buff item charge is full, then the bot will attack with the buff item (to use it).

TF_WEAPON_BAT_WOOD

If the Sandman clip is greater than 0, then the acting bot will alt-attack the primary known threat with the Sandman.

TF_WEAPON_LUNCHBOX

If the lunchbox item has ammo, then the bot will (attempt to) use the lunchbox item. The Crit-A-Cola and Bonk charge meters are also checked if the acting bot's class is the Scout.