CBaseNPCMaker

From Source Entities
Jump to navigation Jump to search

Code classes:

CBaseNPCMaker is a code class in some Source games. This class spawns NPCs.

Flags[edit | edit source]

  • 16: Fade Corpse - Sets Fade Corpse on the NPC when spawned. Set automatically if Infinite Children is set.
  • 32: Infinite Children - Spawner has no limit on the number of NPCs it can spawn.
  • 128: Don't Spawn While Visible - NPCs will not spawn if the player can currently see the entity origin.

Keyvalues[edit | edit source]

Num. of NPCs (MaxNPCCount) <integer>
Maximum number of NPCs this spawner can create. Does not apply if Infinite Children is set.
Max Live NPCs (MaxLiveChildren) <integer>
Maximum number of spawned NPCs that can be alive at once.
Frequency (SpawnFrequency) <float>
How quickly, in seconds, new NPCs can be spawned.
Ignore Entity (Not in FGD) (IgnoreEntity) <target_destination>
Entity to not count as solid when checking if the NPC can fit in the spot it's trying to spawn at.
Start Disabled (StartDisabled) <boolean>
Stay inactive until Enabled. (In the enabled state, the entity will begin to spawn as many entities as it's allowed to.
Hull Check Mode (HullCheckMode) <choices> (available in all games since Asw.png)
How to check if the NPC can fit where it's trying to spawn.
  • 0: Default - Human-sized hull
  • 1: No hull check - NPC doesn't have to fit.

Inputs[edit | edit source]

Spawn
Spawns a single NPC.
SetMaxChildren <integer>
Sets Num. of NPCs.
AddMaxChildren <integer>
Adds this much to Num. of NPCs.
SetMaxLiveChildren <integer>
Sets Max Live NPCs.
SetSpawnFrequency <float>
Sets Frequency.
Enable
Makes the entity active.
Disable
Makes the entity inactive.
Toggle
If on, turn off. If off, turn on.

Outputs[edit | edit source]

OnSpawnNPC
Fires when an NPC is spawned.
OnAllSpawned
Fires when the spawner has spawned every NPC it's allowed to by Num. of NPCs.
OnAllLiveChildrenDead
Fires when none of the existing spawned NPCs are alive anymore.
OnAllSpawnedDead
Fires when all the NPCs that are allowed to spawn have died.