When two groups of hostile NPCs meet, they will automatically turn their energies to killing each other. This is usually the expected behaviour, but in some situations it can act against your designs. For instance, the NPCs may be required to have a shootout in the background until the player gets close enough, 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 all of these problems.
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.
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 (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.
- 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. 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 recent known enemy activity in the area.
- 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.
Very Low/Low/Medium/High/Very High or
0-5 where 5 equals Very High.
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.
- Actor(s) or squad to affect: Specify the NPCs to be involved in the standoff.
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.
- 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.
- SetParentAttachment: Once a parent has been set through keyvalues, use this input to set the battle line to attach to a particular attachment point on it. This would require a truly gigantic animated prop to become useful: god knows what Valve had that needed it...
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 irregardless of obstacles. This can lead to large backtracks.
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.
- 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.
- Actor(s) or squad to affect: rebel_*. This wildcard-matches all rebels on the map (which are named rebel_1 through to 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.
- 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
- 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.
К оглавлению справочника
© Valve Developer Community