Squads: Difference between revisions
Gameplayer (talk | contribs) No edit summary |
Gameplayer (talk | contribs) No edit summary |
||
| Line 30: | Line 30: | ||
* The player's squad is <code>player_squad</code>. | * The player's squad is <code>player_squad</code>. | ||
* {{ent|npc_citizen}} NPCs have a spawnflag to place them in the player's squad on spawn: <code>65536</code>. | * {{ent|npc_citizen}} NPCs have a spawnflag to place them in the player's squad on spawn: <code>65536</code>. | ||
* Use {{cmd|npc_squads}} | * Use {{cmd|npc_squads}} or {{cmd|npc_combat}} commands in-game to view all existing squads in current map. | ||
==See also== | ==See also== | ||
Latest revision as of 13:36, 17 September 2024
Squads in
Source allow you to group NPCs in ways they understand. Members of a squad will cover each other, move together, share information, and take turns 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 squad leaders, but unlike in
GoldSrc, they don't influence the squad in any substantial way. - Squads can contain no more than 16 members.
- Only two soldiers in a squad can attack at a time, so large squads may be highly ineffective.
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, no matter their PVS or location on the map.
Squad-Level I/O
NPCs can be manipulated as a squad by:
- ai_battle_line
- The
wake squadkeyvalue 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
OnJoinedPlayerSquadandOnLeftPlayerSquadinputs of npc_citizens. - NPCs have an
OnDenyCommanderUseinput for when they refuse to join the player's squad - NPCs also have an
OnDamagedByPlayerSquadinput - NPCs can be set to auto-join the player's squad with the console command
npc_citizen_auto_player_squad - The player can manually remove or add NPCs to their squad if the command
npc_citizen_auto_player_squad_allow_useis set. This requiresnpc_citizen_auto_player_squadto be disabled.
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
LookOnandLookOffinputs can force a Combine NPC to only see through its squadmates' eyes - npc_spotlight: the
SquadDetectedEnemyoutput fires when its squad finds an enemy (useful for shining at that enemy) and a correspondingSquadLostEnemyoutput.
Misc
- The player's squad is
player_squad. - npc_citizen NPCs have a spawnflag to place them in the player's squad on spawn:
65536. - Use
npc_squadsornpc_combatcommands in-game to view all existing squads in current map.