# Sandbox.Npcs.BaseCombatNpc

A combat NPC that searches for whoever its faction is hostile to, advances on them, fires in bursts, and
repositions. It is an [Sandbox.Npcs.Factions.Enemy](/api/Sandbox.Npcs.Factions/Enemy) unless its [Sandbox.Npcs.BaseNpc.Faction](/api/Sandbox.Npcs.BaseNpc/Faction) says otherwise, and
follows its [Sandbox.Npcs.BaseCombatNpc.Leader](/api/Sandbox.Npcs.BaseCombatNpc/Leader) between fights when it has one.
The senses and speech layers are optional: without senses it never notices anyone, without speech it stays silent.

- Kind: class
- Namespace: `Sandbox.Npcs`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.Npcs.BaseNpc](/api/Sandbox.Npcs.BaseNpc)

## Constructors

- [`BaseCombatNpc`](/api/Sandbox.Npcs.BaseCombatNpc/.ctor)

## Properties

- [`AimSpreadScale`](/api/Sandbox.Npcs.BaseCombatNpc/AimSpreadScale): Skill multiplier on the weapon's NPC spread - 1 is a average shot, lower is more accurate.
- [`CalloutRange`](/api/Sandbox.Npcs.BaseCombatNpc/CalloutRange): Allies of the same faction within this range are told where a spotted hostile is.
- [`FollowDistance`](/api/Sandbox.Npcs.BaseCombatNpc/FollowDistance): How close to its [Sandbox.Npcs.BaseCombatNpc.Leader](/api/Sandbox.Npcs.BaseCombatNpc/Leader) the NPC follows before stopping.
- [`IdleBehaviour`](/api/Sandbox.Npcs.BaseCombatNpc/IdleBehaviour): What to do when there's nothing going on: hold the post or patrol around it.
- [`Inventory`](/api/Sandbox.Npcs.BaseCombatNpc/Inventory): The inventory this NPC holds its weapons in: the one on its GameObject, or a [Sandbox.Npcs.BaseNpcInventory](/api/Sandbox.Npcs.BaseNpcInventory) the host adds when it has a weapon and no inventory. Null until then.
- [`Leader`](/api/Sandbox.Npcs.BaseCombatNpc/Leader): Who this NPC follows when it is not fighting or investigating, if anyone. Set it on the host.
- [`PainLines`](/api/Sandbox.Npcs.BaseCombatNpc/PainLines): Said now and then when hurt, one at random. Empty stays silent.
- [`PatrolLines`](/api/Sandbox.Npcs.BaseCombatNpc/PatrolLines): Said now and then while patrolling, one at random. Empty stays silent.
- [`PatrolRadius`](/api/Sandbox.Npcs.BaseCombatNpc/PatrolRadius): How far from its post the NPC wanders when it patrols.
- [`ReactionTimeAlert`](/api/Sandbox.Npcs.BaseCombatNpc/ReactionTimeAlert): Seconds (min, max) to react to a fresh contact when already alert - weapon up, searching or fighting.
- [`ReactionTimeRelaxed`](/api/Sandbox.Npcs.BaseCombatNpc/ReactionTimeRelaxed): Seconds (min, max) to react to a fresh contact when caught at ease - weapon lowered.
- [`RelaxDelay`](/api/Sandbox.Npcs.BaseCombatNpc/RelaxDelay): How long the weapon stays up after the last sign of trouble before the NPC relaxes.
- [`SearchTimeout`](/api/Sandbox.Npcs.BaseCombatNpc/SearchTimeout): How long after the last intel on a hostile (seen, heard or called out) to keep searching for it.
- [`SpeedVariation`](/api/Sandbox.Npcs.BaseCombatNpc/SpeedVariation): Each soldier moves up to this much faster or slower than the rest (0.05 = ±5%), so a squad doesn't move in lockstep. Keep it small - too much pushes a walk into a jog.
- [`SpotLines`](/api/Sandbox.Npcs.BaseCombatNpc/SpotLines): Said on spotting a fresh contact, one at random. Empty stays silent.
- [`TauntLines`](/api/Sandbox.Npcs.BaseCombatNpc/TauntLines): Said now and then between bursts, one at random. Empty stays silent.
- [`Weapon`](/api/Sandbox.Npcs.BaseCombatNpc/Weapon): The weapon this NPC uses to attack: the one it starts with, then whichever is out of its [Sandbox.Npcs.BaseCombatNpc.Inventory](/api/Sandbox.Npcs.BaseCombatNpc/Inventory). Its NPC usage decides the engagement range and burst cadence - the same soldier fights differently with a shotgun than an SMG.
- [`WeaponChoices`](/api/Sandbox.Npcs.BaseCombatNpc/WeaponChoices): Weapon prefabs to arm this NPC with - one is picked at random when it spawns, replacing [Sandbox.Npcs.BaseCombatNpc.Weapon](/api/Sandbox.Npcs.BaseCombatNpc/Weapon). Empty keeps the prefab's weapon.

## Methods

- [`ArmWith`](/api/Sandbox.Npcs.BaseCombatNpc/ArmWith): Swap the current weapon for one made from a weapon prefab. Host only. Before the NPC has started the new weapon goes out in its spawn snapshot; after that the [Sandbox.Npcs.BaseCombatNpc.Inventory](/api/Sandbox.Npcs.BaseCombatNpc/Inventory) picks it up and removes the old one.
