Assault: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 5: Line 5:
* '''assault_assaultpoint''' (any number)
* '''assault_assaultpoint''' (any number)


Its purpose is to make an NPC follow a predesigned route. In this regard it is quite similar to [[path_corner]]: the differences revolve around assaults being designed for combat situations and through that their increased flexibility. This article will detail how to use them.
Its purpose is to make a NPC follow a predesigned route. In this regard it is quite similar to '''[[path_corner]]''': the differences revolve around assaults being designed for combat situations and through that their increased flexibility. This article will detail how to use them.


==Structure==
==Structure==
Line 14: Line 14:
Assaults can be triggered in one of two ways:
Assaults can be triggered in one of two ways:


# An ai_goal_assault fires, forcibly attaching NPCs to rally points.
# An '''ai_goal_assault''' fires, forcibly attaching NPCs to '''assault_rallypoints'''.
# An NPC chooses a rally point on its own when it receives the '''Assault''' input through the [[Entity_I/O_-_How_to_hook_up_entity_inputs_and_outputs.|I/O system]].
# A NPC chooses an '''assault_rallypoint''' on its own when it receives the '''Assault''' input through the [[Entity_I/O_-_How_to_hook_up_entity_inputs_and_outputs.|I/O system]].
----
----
===ai_goal_assault===
===ai_goal_assault===
This entity specifies what NPCs are to carry out the assault and triggers it when any conditions given are met. One ai_goal_assault can handle multiple rally points. An ai_goal_assault must be '''Active''' before being triggered.
This entity specifies what NPCs are to carry out the assault and triggers it when any conditions given are met. One goal can handle multiple rally points. Must be '''Active''' before being triggered.


====Keyvalues====
====Keyvalues====
* '''Actor(s) to affect:''' Enter the name of the actors that will perform the assault. This field supports wildcards, should they be needed.
* '''Actor(s) to affect:''' Enter the name of the NPCs that will perform the assault. This field supports wildcards, should they be needed.
* '''Rally Point Set:''' The name of the assault_rallypoint at which this assault will begin. This field can also support wildcards, which will be matched with the wildcards in '''Actor(s) to affect'''. This means that rebel_1 will go to rally_1, rebel_2 to rally_2, and so on.
* '''Rally Point Set:''' The name of the '''assault_rallypoint''' at which this assault will begin. This field can also support wildcards, which will be matched with the wildcards in '''Actor(s) to affect'''. This means that rebel_1 will go to rally_1, rebel_2 to rally_2, and so on.
* '''Search Type:''' It is also possible to specify classes. If your NPCs do not have names, or you want all NPCs of a certain type to join the assault, you can set this to 'Classname' and make the appropriate changes to '''Actor(s) to affect'''.
* '''Search Type:''' It is also possible to specify classes. If your NPCs do not have names, or you want all NPCs of a certain type to join the assault, you can set this to 'Classname' and make the appropriate changes to '''Actor(s) to affect'''.
* '''Start Active:''' Should this goal be active when the map begins?
* '''Start Active:''' Should this goal be active when the map begins?
Line 34: Line 34:


====Inputs====
====Inputs====
'''Assault:''' When a NPC receives this input, it will search for the best assault available. Use the rally point keyvalue '''Priority''' to influence this decision.
'''Assault:''' When a NPC receives this input, it will search for the best assault available. Use the ‘‘‘assault_rallypoint’’’ keyvalue '''Priority''' to influence this decision.
----
----
===assault_rallypoint===
===assault_rallypoint===
Line 43: Line 43:
* '''Assault Delay:''' The amount of time to wait here once the assault has begun before moving to the first assault_assaultpoint.
* '''Assault Delay:''' The amount of time to wait here once the assault has begun before moving to the first assault_assaultpoint.
* '''Rally Sequence:''' Set a specific animation sequence for NPCs waiting to begin the assault.
* '''Rally Sequence:''' Set a specific animation sequence for NPCs waiting to begin the assault.
* '''Priority:''' If when an NPC receives the '''Assault''' input it will choose a suitable rally point from those available to it. '''Priority''' allows the mapper to influence this decision. Higher numbers make a rally point more appealing to an NPC.
* '''Priority:''' When a NPC receives the '''Assault''' input it will choose a suitable rallypoint from those available to it. '''Priority''' allows the mapper to influence this decision. Higher numbers make a rallypoint more appealing.


====Outputs====
====Outputs====
Line 72: Line 72:


====Outputs====
====Outputs====
* '''OnArrival:''' Fires when an NPC arrives.
* '''OnArrival:''' Fires when a NPC arrives.
* '''OnAssaultClear:''' Fires when the point is cleared.
* '''OnAssaultClear:''' Fires when the point is cleared.



Revision as of 04:21, 3 July 2005

An assault consists of two or three component types:

  • ai_goal_assault (1 per assault, optional)
  • assault_rallypoint (1 per NPC)
  • assault_assaultpoint (any number)

Its purpose is to make a NPC follow a predesigned route. In this regard it is quite similar to path_corner: the differences revolve around assaults being designed for combat situations and through that their increased flexibility. This article will detail how to use them.

Structure

Assault diagram.png

An assault consists of a rally point followed by a string of consecutive assault points. An assault point must be 'cleared' before continuing: clearing a point by default consists of standing on it and ensuring there are no hostiles in sight for the timeout period, but is completely configurable.

Assaults can be triggered in one of two ways:

  1. An ai_goal_assault fires, forcibly attaching NPCs to assault_rallypoints.
  2. A NPC chooses an assault_rallypoint on its own when it receives the Assault input through the I/O system.

ai_goal_assault

This entity specifies what NPCs are to carry out the assault and triggers it when any conditions given are met. One goal can handle multiple rally points. Must be Active before being triggered.

Keyvalues

  • Actor(s) to affect: Enter the name of the NPCs that will perform the assault. This field supports wildcards, should they be needed.
  • Rally Point Set: The name of the assault_rallypoint at which this assault will begin. This field can also support wildcards, which will be matched with the wildcards in Actor(s) to affect. This means that rebel_1 will go to rally_1, rebel_2 to rally_2, and so on.
  • Search Type: It is also possible to specify classes. If your NPCs do not have names, or you want all NPCs of a certain type to join the assault, you can set this to 'Classname' and make the appropriate changes to Actor(s) to affect.
  • Start Active: Should this goal be active when the map begins?
  • Assault Cue: The goal can be set immediately after being activated, after it has received an input through the I/O system, or when the entity 'hears' gunfire depending on the setting here. Requires the goal to be Active first.

Inputs

  • BeginAssault: If the entity is Active and Assault Cue is set to Entity System Input, begin the assault(s).

NPC

NPCs can handle their own assaults.

Inputs

Assault: When a NPC receives this input, it will search for the best assault available. Use the ‘‘‘assault_rallypoint’’’ keyvalue Priority to influence this decision.


assault_rallypoint

All assaults begin at a rallypoint.

Keyvalues

  • Assault Point: The first assault_assaultpoint in the chain.
  • Assault Delay: The amount of time to wait here once the assault has begun before moving to the first assault_assaultpoint.
  • Rally Sequence: Set a specific animation sequence for NPCs waiting to begin the assault.
  • Priority: When a NPC receives the Assault input it will choose a suitable rallypoint from those available to it. Priority allows the mapper to influence this decision. Higher numbers make a rallypoint more appealing.

Outputs

  • OnArrival: Fires when the NPC arrives.

assault_assaultpoint

The body of an assault chain. Specifies where the assault should go once it has begun. There can be any number of assault_assaultpoints in each chain.

It is important to remember that assaultpoints affect the journey to them, not from them.

Keyvalues

  • Assault Hint Group: Constrain NPCs in the assault to this hint group.
  • Assault time out: How long to wait with no activity at this assaultpoint before moving on.
  • Clear on contact with enemies: If the assault meets enemies on its way to this point, it will consider it cleared and target the next point in the chain.
  • Allow diversion: If the assault comes into contact with hostiles on the way to the point, divert to kill them and resume once the area appears clear.
    • If it set to Yes NPCs will chase any hostiles until they are dead or out of sight for the period set in Assault time out.
    • If this is set to No assaulting NPCs will run non-stop to the next point, attacking enemies they can see but not chasing them.
  • Never Timeout: Force NPCs to try and reach this point forever, with no timeouts.

Flags

  • Clear this point on arrival, UNCONDITIONALLY: Move on to the next point once reaching this one regardless of any other influences.

Inputs

  • SetClearOnContact: Sets the Clear on contact with enemies keyvalue.
    • Accepts 1/0 or Yes/No.
  • SetAllowDiversion: Sets the Allow diversion keyvalue.
    • Accepts 1/0 or Yes/No.

Outputs

  • OnArrival: Fires when a NPC arrives.
  • OnAssaultClear: Fires when the point is cleared.

Limitations and bugs

  • When moving to an assaultpoint part way through a chain, the NPC will go to the standing posture for a moment before continuing. This looks unnatural.
  • NPCs will always arrive at a rally or assault point and turn to face in the direction the entity is set to. This is again unnatural in some cases.
  • NPCs must stand directly on an assaultpoint to clear it without timeout if Clear on contact with enemies is not set and triggered. This can result in illogical backtracking and means that groups of NPCs moving together each need their own assaultpoint to maintain the illusion.
  • A rallypoint can only serve one NPC per assault. If multiple NPCs are required to assault at the same time, each needs their own rallypoint. There may be a solution to this but it is not yet documented.
  • If enemies are in view of an assaultpoint, they will be seen just before the point is reached and probably calculated using the wrong (previous) settings. To avoid this, try to ensure assaultpoints are always in 'safe' areas.
  • Linking an assaultpoint to a rallypoint crashes the game.

Example

This example map contains a single NPC on a linear chain using all the major options available to designers when moving NPCs from assaultpoint to assaultpoint. There are four points, and each is configured differently:

  1. Clear on contact with enemies is enabled. When the NPC sees the hostiles, it clears out the assaultpoint and continues to 2.
  2. Clear this point on arrival, UNCONDITIONALLY is flagged. When the NPC reaches this point it clears it regardless of the fact that there are still hostiles in sight and begins to move towards 3.
  3. Allow diversion is set to No. The NPC will charge towards the assaultpoint without stopping or giving chase. It will however attack enemies in view.
  4. Allow diversion is set to Yes. The NPC will divert from moving to this point until there are no hostiles visible.

Note that the Metropolice cannot harm the NPC and will not attack the player in this example.

Example (VMF)