Squads: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(wording)
(more information)
Line 1: Line 1:
Squads allow you to group NPCs in ways they understand. Members of a squad will cover each other, move together, share information, and take turns at attacking their enemies. However, they have limitations:
Squads allow you to group NPCs in ways they understand. Members of a squad will cover each other, move together, share information, and take turns at attacking their enemies. However, they have limitations:
 
* Squads cannot be directly influenced in the regular ways that individual [[NPC]]s can be. The mapper can still influence the individual squad members.
* Squads '''cannot be directly influenced'''. The mapper must instead influence the individual squad members.
* Squads will not stay together if directed otherwise by a scripted or semi-scripted sequence.
* Squads will not stay together if directed otherwise by a scripted or semi-scripted sequence.
* There are no squad leaders, unlike Half-Life 1.
* There are no squad leaders, unlike Half-Life 1.
* Squad tactics are less complex than in Half-Life 1.
* Squad tactics are less complex than in Half-Life 1.
To form a squad, edit the '''Squad Name''' property for each NPC that will be a part of it. All NPCs sharing the same squad name are in the same squad.
==Squad-level I/O==


To form a squad, edit the '''Squad Name''' property for each NPC that will be a part of it. All NPCs sharing the same squad name are in the same squad.
NPCs can be manipulated ''as a squad'' by:
* [[ai_battle_line]]
* the '''wake squad''' keyvalue of NPCs in the same squad
 
An NPC can be added to or removed from a squad at map runtime by its '''SetSquad''' input. An [[npc_maker]] can also set the squadname of NPCs it spawns, but that squadname cannot be changed at map runtime.
 
The player's squad is special, and has additional relevant [[inputs and outputs]]:
* the '''OnJoinedPlayerSquad''' and '''OnLeftPlayerSquad''' inputs of [[npc_citizen]]s
* NPCs have an '''OnDenyCommanderUse''' input for when they refuse to join the player's squad
* NPCs also have an '''OnDamagedByPlayerSquad''' input
See also the "Player squad transition point" of [[info_node_hint]] for taking the player's squad across level transitions.
 
Some squad I/O is class-specific:
* some Combine NPCs: the '''LookOn''' and '''LookOff''' inputs can force a Combine NPC to ''only'' see through its squadmates' eyes
* [[npc_spotlight]]: the '''SquadDetectedEnemy''' output fires when its squad finds an enemy (useful for shining at that enemy) and a corresponding '''SquadLostEnemy''' output.


[[Category:AI]]
[[Category:AI]]

Revision as of 14:35, 22 September 2005

Squads allow you to group NPCs in ways they understand. Members of a squad will cover each other, move together, share information, and take turns at attacking their enemies. However, they have limitations:

  • Squads cannot be directly influenced in the regular ways that individual NPCs can be. The mapper can still influence the individual squad members.
  • Squads will not stay together if directed otherwise by a scripted or semi-scripted sequence.
  • There are no squad leaders, unlike Half-Life 1.
  • Squad tactics are less complex than in Half-Life 1.

To form a squad, edit the Squad Name property for each NPC that will be a part of it. All NPCs sharing the same squad name are in the same squad.

Squad-level I/O

NPCs can be manipulated as a squad by:

An NPC can be added to or removed from a squad at map runtime by its SetSquad input. An npc_maker can also set the squadname of NPCs it spawns, but that squadname cannot be changed at map runtime.

The player's squad is special, and has additional relevant inputs and outputs:

  • the OnJoinedPlayerSquad and OnLeftPlayerSquad inputs of npc_citizens
  • NPCs have an OnDenyCommanderUse input for when they refuse to join the player's squad
  • NPCs also have an OnDamagedByPlayerSquad input

See also the "Player squad transition point" of info_node_hint for taking the player's squad across level transitions.

Some squad I/O is class-specific:

  • some Combine NPCs: the LookOn and LookOff inputs can force a Combine NPC to only see through its squadmates' eyes
  • npc_spotlight: the SquadDetectedEnemy output fires when its squad finds an enemy (useful for shining at that enemy) and a corresponding SquadLostEnemy output.