Standoffs

From Valve Developer Community
Revision as of 20:34, 1 July 2005 by TomEdwards (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

When two groups of NPCs meet, they will automatically turn their energies to killing each other. But what if you don’t want them to? For instance they may be required to have a shootout in the background until you can arrive on the scene to lead them on, or not cross an open area until a scripted sequence is ready to play. Or you may simply want to give an engagement more structure. Standoffs are the flexible solution to these problems.

A standoff can consist of two or three components for each group taking part:

  • ai_goal_standoff: Organises the standoff and interacts with NPCs.
  • ai_battle_line: An optional component to further control NPC behaviour.
  • info_nodes: pathfinding

Structure

Standoff diagram.png


NPCs follow the rules of engagement given them by an ai_goal_standoff. If any ai_battle_lines are attached to them, they will try to stay behind all. Both components can be configured independently for each named group in the fight.

ai_goal_standoff

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

  • Reaction to tactical change: Defines how the AI should react if the standoff ends or changes. Changes listed include the leader moving (leaders are currently not understood), 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.
  • Player battleline: Use the player as a mobile battle line, if you are friendly towards him. This will not override any other active battle lines! Player facing has an unknown effect.
  • 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 recent known enemy activity in the area.

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.

  • Parent: Like most entitles, ai_battle_line can be parented to another. Parent it to a designated squad leader to have a mobile battle line with the illusion of leadership.
  • Actor(s) or squad to affect: It is worth pointing out that setting squads containing of a portion of the NPCs in a standoff can allow for multiple simultaneous battle lines. Useful for grading different weapon ranges or NPC types.
  • Strict: Can the player override this battle line with squad commands? This is a double negative: Yes means it IS strict and CAN’T be overwritten. Set to No to allow the player to order NPCs over the line.
    • Note that this property will not overwrite the standoff's aggressiveness. NPCs in a standoff obey their aggressiveness as well as your commands, and sometimes they will conflict.

Limitations and Bugs

  • Sometimes during testing, NPCs set to Very Low aggressiveness would charge out in front of the enemy entirely on their own.
  • 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 irregardless of obstacles. This can lead to large backtracks.

Example

This example map contains two ai_goal_standoff entities and four ai_battle_line entitles: 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 commendable 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.
        • 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 impassably 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.


The button in view when the map loads allows you to disable the battle lines and examine the effects.

[Example (VMF)]