CNPC_PlayerCompanion

From Source Entities
Jump to navigation Jump to search

CNPC_PlayerCompanion is a code class in the Half-Life 2 series. These NPCs are seen throughout the games following the player at different times.

Note: In order to change the readiness level, the NPC must have a weapon and cannot be in a vehicle. Alyx simply refuses to change readiness via input.

To do: Why do the vehicle inputs only work when the npc is Alyx and the vehicle is the Episode 2 jeep? (vehicle.mdl specifically)

Keyvalues[edit | edit source]

Always transition (AlwaysTransition) <boolean>
If this NPC is not touching a trigger_transition when the player steps into the associated trigger_changelevel, the NPC will automatically teleport to a hint entity inside it with Hint (hinttype) set to Player squad transition point.
Prevent picking up weapons? (DontPickupWeapons) <boolean>
If yes, the NPC is not allowed to pick up weapons from the ground.

Inputs[edit | edit source]

GiveWeapon <string>
Gives the NPC a weapon with this name.
OutsideTransition
Teleports the NPC to the Player squad transition point hint closest to the player. NPC must not be in a vehicle, and Always transition must be Yes.
SetReadinessLow
Sets the readiness level to "low". (Bored, default.)
SetReadinessMedium
Sets the readiness level to "medium". (Aiming gun.)
SetReadinessHigh
Sets the readiness level to "high". (Aiming gun, only subtly different from medium.)
SetReadinessPanic
Sets the readiness level to "panic". (Crouch down, may put hands up.)
SetReadinessStealth
Sets the readiness level to "stealth. (Seems identical to low?)
LockReadiness <float>
Locks the readiness at its current level for the specified number of seconds.
EnableAlwaysTransition
Sets Always transition to Yes.
DisableAlwaysTransition
Sets Always transition to No.
EnableWeaponPickup
Sets Prevent picking up weapons? to Yes.
DisableWeaponPickup
Sets Prevent picking up weapons? to No.
EnterVehicle <target_destination> (only available in Hl2.pngEpisodicP1.png)
Makes the NPC run to the specified vehicle and enter it.
EnterVehicleImmediately <target_destination> (only available in Hl2.pngEpisodicP1.png)
Teleports the NPC into the specified vehicle.
ExitVehicle  (only available in Hl2.pngEpisodicP1.png)
Makes the NPC exit the vehicle.
CancelEnterVehicle  (only available in Hl2.pngEpisodicP1.png)
If the NPC is currently attempting the enter the vehicle, tell it to stop trying.
ClearAllOutputs  (only available in Hl2.pngEpisodicP1.png)
Gets rid of every IO connection stemming from this entity.

Outputs[edit | edit source]

OnWeaponPickup
Fires when the NPC picks up a weapon.