Standoffs

From Valve Developer Community
Jump to: navigation, search
English (en)日本語 (ja)Translate (Translate)

Purpose

Standoffs bring out advanced tactical behaviors in NPCs such as npc_combine_s, npc_citizen, and npc_metropolice. The overarching idea is that NPCs involved in an ai_goal_standoff will use cover points while advancing on their target and, optionally, stay behind an ai_battle_line. Their preference for advancing to this line (or crossing it), as well as how aggressively they use cover, can be adjusted by the mapper. The ai_battle_line entity also provides the option for the player to act as a battle line.

Practical applications of this setup include:

  • Making Combine Soldiers weave and duck behind cover while advancing to the battle line.
  • Making Civil Protection forces stand their ground at a line of the mapper's choosing.
  • Making a friendly group of Citizens get into a long-distance shootout with Combine Soldiers until the player intervenes.
  • Making a group of Citizens advance or retreat with the player in a firefight.
  • Preventing Citizens from crossing a wide open area until some event occurs during a fight that causes everyone to charge forward.
  • Generally giving any confrontation involving these entities more structure.

Half-Life 2 Half-Life 2 maps with notable examples of standoffs include d3_c17_05 (along the main street and within the metrocop garrison) and d3_c17_07 (the Alyx defense mission).

A standoff consists of two component types:

Furthermore, NPCs should ideally have a number of info_node_hints, flagged with Tactical Cover Low or Tactical Cover Medium hint types appropriately located around the battlefield. NPCs that share the same hintgroup with these hints will be encouraged to use them during standoffs. For example, Combine Soldiers may crouch-run between HINT_TACTICAL_COVER_LOW points and fire at the player while crouching, or npc_metropolice and npc_citizen will use "peeking" animations while using a HINT_TACTICAL_COVER_LOW.

Icon-Bug.pngBug:Soldiers do not have ACT_RANGE_AIM_LOW and ACT_RANGE_ATTACK1_LOW listed as "crouch activities" in their AI. This is a problem when using them in standoffs, as there is a chance they will literally shoot through cover when using an ACT_COVER_LOW node.  [todo tested in?]

Structure

Standoff diagram.png

NPCs follow the rules of engagement given them by an ai_goal_standoff. In addition, they will always stay behind any ai_battle_lines that apply to them. There is one standoff and any number of battle lines per force.

Tip.pngTip:Although the above image provides a useful example of a standoff, note that not every faction or NPC in a battle needs to be part of one. For example, a group of Citizens who don't have a standoff can fight against Combine Soldiers who do. Or, you could have some Combine Soldiers who obey a standoff fighting alongside others that hunt down the player through other means.

Components

ai_goal_standoff

Specifies what NPCs are a part of the standoff and what special rules they should follow.

Keyvalues

  • Reaction to tactical change: Defines how the AI should react if the standoff ends or changes. Changes listed include the leader moving (see Player battleline), enemies being killed, or hint group changing.
    • Move when ready (default AI): Act as normal.
    • Move when seek cover: Move when you next need to find cover.
    • Move immediately: Move to a different position straight away.
  • Aggressiveness: How aggressively should NPCs in this standoff behave?
    • A high level will make the NPCs push forward and spend more time shooting and less hiding, and other settings permitting, move forwards as far as they can.
    • A low level will make NPCs spend more time behind cover and less likely to move forwards.
    • Once an active battle line is reached, settings above Medium become redundant.
    • If set to 5, with smart edit off, custom standoff parameters will take affect.
  • Player battleline: Find cover near the player half the time, if you are friendly towards him. This will not override any other active battle lines! Player facing has an unknown effect. If this is enabled, the player becomes the 'leader' of the standoff.
  • Stay at cover location: Once a NPC has found cover, it will stick to it until the standoff is over. This disables NPCs advancing to the battle line.
  • Abandon if enemies hide: End the standoff if there has been no recently known enemy activity in the area.
  • CustomCoverOnReload: (!FGD) If set to '1' NPCs will reload in cover, if set to '0' they won't (It's likely they'll move to cover afterward).
  • CustomMinTimeShots: (!FGD) The minimum amount of time to wait in cover.
  • CustomMaxTimeShots: (not in FGD) The maximum amount of time to wait in cover.
  • CustomMinShots: (!FGD) The minimum amount of shots to take before taking cover.
  • CustomMaxShots: (!FGD) The maximum amount of shots to take before taking cover.
  • CustomOddsCover: (!FGD) The likelihood of taking cover when shot (a number between 0 and 100).

Inputs

  • Activate/Deactivate: Force the beginning or end of the standoff. A standoff usually automatically activates when hostiles are encountered and deactivates when they are dead or out of sight for long enough.
  • SetAggressiveness: Manipulate the Aggressiveness keyvalue.
    • Accepts Very Low/Low/Medium/High/Very High or 0-5 where 5 equals Very High.

ai_battle_line

All NPCs covered by this entity will stay behind it. They may make small exceptions to round obstacles if required. The pigeon model on top of the entity signifies its direction when in-editor. Use ai_drawbattlelines to give an in-game visualisation of battle line positions.

Battle lines can have some very interesting uses: you might perhaps parent them to a member of the standoff or use them in reverse, to keep the standoff moving forwards.

Note.pngNote:The player's 'commander mode' creates a battle line when the player's squad is ordered to go somewhere.
Note.pngNote:The ai_battle_line should be oriented to face the direction you do not want the NPCs covered by the entity to pass.

Keyvalues

  • Actor(s) or squad to affect: Specify the NPCs to be involved in the standoff.
    Tip.pngTip:Have multiple squads graded by weapons for a more dynamic battle.
  • Strict: Can the player override this battle line with squad commands? This is a double negative: Yes means it IS strict and CANNOT be overwritten. Set to No to allow the player to order NPCs over the line.
    • Note that this keyvalue will not overwrite the standoff's aggressiveness. NPCs in a standoff obey their aggressiveness as well as your commands, and sometimes they will conflict.

Flags

  • Use parent's orientation: If this flag is not checked and the battle line is parented to an NPC, when that NPC turns the battle line will turn with it. This is in almost all situations very undesirable.

Limitations and Bugs

  • NPCs set to Very Low aggressiveness can sometimes charge out in front of the enemy entirely on their own. Nodegraph manipulation may present a solution.
  • Commanding squads in a standoff is difficult as they do not always follow you or your orders.
  • NPCs will go over battle lines in some circumstances, such as having hostiles in sight but not range or wanting to heal another NPC.
  • When choosing whether to go over a battle line, the decision is made regardless of obstacles. This can lead to large backtracks.

Example

Download Example (VMF)

This example map contains two ai_goal_standoff entities and four ai_battle_line entities: three for the rebels, one for the Combine.

  • Rebels
    • ai_goal_standoff
      • Aggressiveness: Medium. The rebels will fight with a balanced strategy.
    • 3x ai_battle_line
      • 2x battleline_platform
        • Actor(s) or squad to affect: rebel_platform_squad. This is the one rebel standing on the platform when the map loads.
        • Strict: The rebel will not cross the battle line even if ordered to (the rebel is not commandable given this, but change that flag to see the effect yourself).
        • The two battle lines are at 90 degree angles, so that the NPC is 'boxed in' on the platform.
      • battleline_rebel
        • Actor(s) or squad to affect: rebel_*. This wildcard-matches all rebels on the map (which are named rebel_1 through rebel_4).
        • Strict: No. The NPCs will not go over this battle line of their own accord, but will if ordered to by the player.
  • Combine
    • ai_goal_standoff
      • Aggressiveness: Very High. The Combine will move as far forwards as they can before reaching an impassable area or battle_line.
    • 1x ai_battle_line
      • battleline_combine
        • Actor(s) or squad to affect: combine_longrange.
        • The other Combine squad, combine_shortrange, does not have a battle line and you will see them (armed with shotguns) moving the whole length of the map if they need to.


There are two buttons near the player spawn, both labelled with their use. The left button sets how Aggressive the Combine are (toggles between VeryHigh and VeryLow), and the right button disables all ai_battle_lines.