# Sandbox.Npcs.BaseNpc

A non-player character: health, senses, movement, speech and a schedule of tasks. Host-authoritative: the host
thinks, moves and takes damage for it, and clients follow the synced state.

- Kind: class
- Namespace: `Sandbox.Npcs`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.Component](/api/Sandbox.Component)

## Constructors

- [`BaseNpc`](/api/Sandbox.Npcs.BaseNpc/.ctor)

## Properties

- [`ActiveSchedule`](/api/Sandbox.Npcs.BaseNpc/ActiveSchedule): The current running schedule for this NPC.
- [`Animation`](/api/Sandbox.Npcs.BaseNpc/Animation): Animation layer - handles look-at and animation state
- [`DisplayName`](/api/Sandbox.Npcs.BaseNpc/DisplayName): The name games show for this NPC, such as when it is killed.
- [`EyeHeight`](/api/Sandbox.Npcs.BaseNpc/EyeHeight): How far above its origin this NPC sees from.
- [`EyePosition`](/api/Sandbox.Npcs.BaseNpc/EyePosition): Where this NPC sees from, [Sandbox.Npcs.BaseNpc.EyeHeight](/api/Sandbox.Npcs.BaseNpc/EyeHeight) above its origin.
- [`Faction`](/api/Sandbox.Npcs.BaseNpc/Faction): The faction this NPC belongs to -- its identity to others: one of [Sandbox.Npcs.Factions](/api/Sandbox.Npcs.Factions) or a game's own. Its default relationships follow from it, see [Sandbox.Npcs.BaseNpc.SetupRelationships](/api/Sandbox.Npcs.BaseNpc/SetupRelationships). Set it on the host: the NPC then works out afresh who it likes and hates and what to do. An NPC type can override it to compute it.
- [`FatalImpactSpeed`](/api/Sandbox.Npcs.BaseNpc/FatalImpactSpeed): Hitting something at or above this speed is fatal.
- [`GroundObject`](/api/Sandbox.Npcs.BaseNpc/GroundObject): The object we're standing on. Null if we're standing on nothing.
- [`GroundSurface`](/api/Sandbox.Npcs.BaseNpc/GroundSurface): If we're stnding on a surface this is it
- [`Health`](/api/Sandbox.Npcs.BaseNpc/Health): Current health, never negative. Below 1 starts death handling: assigning it on the host follows the same cancellable death path as damage, with no attacker. Not a number is ignored.
- [`IsAirborne`](/api/Sandbox.Npcs.BaseNpc/IsAirborne): Off our feet - thrown, dropped, or carried. Only NPCs whose mover keeps them on the ground (`P:Sandbox.Npcs.Layers.MovementLayer.UsesGround`); ones that fly or roll around on physics are never "airborne".
- [`IsOnGround`](/api/Sandbox.Npcs.BaseNpc/IsOnGround): Are we on the ground?
- [`MaxHealth`](/api/Sandbox.Npcs.BaseNpc/MaxHealth): The most health this NPC has. Raised to [Sandbox.Npcs.BaseNpc.Health](/api/Sandbox.Npcs.BaseNpc/Health) when the NPC starts if it's lower.
- [`MaxSafeImpactSpeed`](/api/Sandbox.Npcs.BaseNpc/MaxSafeImpactSpeed): Hitting something at or below this speed while airborne doesn't hurt - landing from a throw or a fall, or being slammed into a wall.
- [`Movement`](/api/Sandbox.Npcs.BaseNpc/Movement): Movement layer - walks the navmesh, flies or otherwise moves the NPC. Null if the NPC has none. An NPC can carry several, such as one to walk and one to fly: this is the enabled one, and [Sandbox.Npcs.BaseNpc.SetMovement](/api/Sandbox.Npcs.BaseNpc/SetMovement) switches between them.
- [`PhysicsCarrier`](/api/Sandbox.Npcs.BaseNpc/PhysicsCarrier): The entity carrying this NPC through physics, such as something that grabbed it. See [Sandbox.Npcs.BaseNpc.StartCarry](/api/Sandbox.Npcs.BaseNpc/StartCarry).
- [`Renderer`](/api/Sandbox.Npcs.BaseNpc/Renderer): The model the NPC is drawn with, which its animator drives and its ragdoll copies.
- [`Senses`](/api/Sandbox.Npcs.BaseNpc/Senses): Senses layer - handles environmental awareness and target detection. Null if the NPC has none.
- [`ShowDebugOverlay`](/api/Sandbox.Npcs.BaseNpc/ShowDebugOverlay): Draws this NPC's schedule, awareness and layer state as text above it.
- [`Speech`](/api/Sandbox.Npcs.BaseNpc/Speech): Speech layer - handles talking, lipsync, etc. Null if the NPC has none.

## Methods

- [`CalculateEyePosition`](/api/Sandbox.Npcs.BaseNpc/CalculateEyePosition): Where a GameObject's eyes are: the camera for the local first person player, the "eyes" attachment if its model has one, an NPC's [Sandbox.Npcs.BaseNpc.EyePosition](/api/Sandbox.Npcs.BaseNpc/EyePosition), otherwise its bounds centre.
- [`ClearRelationship`](/api/Sandbox.Npcs.BaseNpc/ClearRelationship): Remove a per-entity override, falling back to the faction default.
- [`EmitStimulus`](/api/Sandbox.Npcs.BaseNpc/EmitStimulus): Broadcast a stimulus from this NPC's position for nearby NPCs to sense (a gunshot when it fires, a death when it dies, and so on).
- [`GetDisposition`](/api/Sandbox.Npcs.BaseNpc/GetDisposition): How this NPC regards another entity.
- [`GetRelationship`](/api/Sandbox.Npcs.BaseNpc/GetRelationship): The full relationship (disposition + priority) this NPC has toward another entity. Per-entity overrides win, then the faction relationship, then [Sandbox.Npcs.BaseNpc.GetFallbackRelationship](/api/Sandbox.Npcs.BaseNpc/GetFallbackRelationship). Override this for fully dynamic relationships.
- [`GetVelocity`](/api/Sandbox.Npcs.BaseNpc/GetVelocity): How fast a GameObject is moving: a player's controller velocity, an NPC's [Sandbox.Npcs.Layers.AnimationLayer.MoveVelocity](/api/Sandbox.Npcs.Layers.AnimationLayer/MoveVelocity) while it's moving, otherwise its rigidbody's velocity.
- [`IsLiveTarget`](/api/Sandbox.Npcs.BaseNpc/IsLiveTarget): Whether something can be hurt right now: it has an enabled [Sandbox.Component.IDamageable](/api/Sandbox.Component.IDamageable) on an active GameObject, on itself or below. NPCs only sense and attack live targets, so a dead player that stays in the world, or anything that takes no damage, is left alone.
- [`Launch`](/api/Sandbox.Npcs.BaseNpc/Launch): Throw the NPC into the air with this velocity, such as a leap or a shove: the mover lets go and physics carries the body until it lands. Nothing it hits before landing, nor the landing, does impact damage. Host only.
- [`SetMovement`](/api/Sandbox.Npcs.BaseNpc/SetMovement): Hand the NPC to another of its movement layers, such as from walking to flying. Its other movers are disabled and let go of the body where it is, and this one is enabled and takes it from there: a ground mover drops to the floor first. A move that was under way is dropped, and a [Sandbox.Npcs.Tasks.MoveToTask](/api/Sandbox.Npcs.Tasks.MoveToTask) running across the switch fails. Host only.
- [`SetRelationship`](/api/Sandbox.Npcs.BaseNpc/SetRelationship): Override how this NPC regards a specific entity, ignoring faction defaults -- e.g. a cop turning hostile toward someone it saw commit a crime.
- [`StartCarry`](/api/Sandbox.Npcs.BaseNpc/StartCarry): Something takes hold of this NPC and carries it through physics, such as a tool that grabbed it. The NPC is off its feet and its mover lets go until [Sandbox.Npcs.BaseNpc.StopCarry](/api/Sandbox.Npcs.BaseNpc/StopCarry). A new carrier takes it from the last one.
- [`StopCarry`](/api/Sandbox.Npcs.BaseNpc/StopCarry): The carrier lets go of this NPC. Does nothing when something else carries it by now.
