Tutorial / Tools > World
NPC Spawner
Place markers that keep spawning any NPC: how many, how often, weapon and faction. Saved for this map.
What it does
An NPC spawner is a marker that keeps up to a set number of NPCs alive near it. When one dies, a new one is made after the set number of seconds. It can also spawn the whole group at once as waves.
You choose any NPC from the spawn menu, addons included, or any npc_ class. You also set its weapon, faction (friendly, neutral or hostile to players), health and an optional NPC tag.
Spawners are saved per map. After a map cleanup they refill from the start.
Where to find it
Q menu > KGX's Admin Toolbox > World > NPC Spawner.
Admins can use the tool, and players who are given it in Settings > Player Access. Players can only remove, update or switch their own spawners, and cannot use admin-only NPCs. Players are limited by kgxat_limit_spawners (Settings > Limits). The server switches in the panel are for superadmins.
Admins only (v3.6.11.3): this tool sets up the server, so it cannot be given to players; it is greyed out in Settings > Player Access.
Controls
| Key | What it does |
|---|---|
| Left click | Place a spawner where you aim (the NPCs face you) |
| Right click | Remove the aimed spawner and its NPCs |
| Reload | Update the aimed spawner with the current settings |
| E + Reload | Turn the aimed spawner on or off |
Right click and reload act on the nearest spawner within 128 units of where you aim. Updating a spawner starts it over.
The panel
The top line shows the picked NPC and its category.
| Option | What it does | Default |
|---|---|---|
| Search NPCs, e.g. combine, zombie, citizen... | Filters the NPC list. | |
| NPC list (NPC, Category) | Every NPC in the spawn menu. Click one to pick it. | npc_combine_s |
| Use the NPC I am looking at | Picks the NPC you aim at, matching its model when it can. | |
| Weapon | Default for this NPC, None, or any NPC weapon. | Default for this NPC |
| Faction | As the NPC normally is, Friendly to players, Neutral (ignores players) or Hostile to players. | As the NPC normally is |
| How many alive at once | 1-20. | 3 |
| Seconds between spawns | 1-600. | 30 |
| Spawn the whole group at once (waves) | Refill all missing NPCs at once instead of one at a time. | Off |
| Stop after this many in total (0 = never) | 0-200. | 0 |
| Spread around the marker | Random distance from the marker, 0-1024. | 64 |
| Health (0 = normal) | 0-5000. | 0 |
| Only with a player within (0 = always) | Spawn only when a living player is this close, 0-10000. | 0 |
| NPC tag (its NPCs get it) | Letters, digits, _ and -. |
Empty |
| Reset to defaults | Puts the options above back to their defaults. |
A tag makes the NPCs walk the patrol route or guard the post with that tag, and use the tag's profile (AI > Patrol & Guard, AI > NPC AI > NPC tags). The faction is also used by forcefield zones (World > Zones) to decide who may enter.
Server (superadmins)
| Option | What it does | Default |
|---|---|---|
| NPC spawners are on | Turns all NPC spawners on or off (kgxat_spawners). |
On |
| Most NPCs from all spawners | Cap for all spawners together, 1-300. Click Apply the most NPCs to save it. | 60 |
NPC spawners on this map
A list of every spawner with the columns #, Spawner and Distance. Double-click a row to go there. Right-click a row for:
- Go there
- Rename...
- Turn on / Turn off
- Spawn now (start over)
- Remove its NPCs
- Copy position
- Remove
Refresh reloads the list. Remove all NPC spawners on this map... removes every spawner after a confirmation. It cannot be undone.
How to use it
Guard an area with hostile soldiers
- Search "combine" and pick a soldier.
- Set Faction to Hostile to players and How many alive at once to 4.
- Set Seconds between spawns to 30.
- Aim at the floor and left-click. The first NPC appears after about a second.
Run waves only when players are near
- Pick an NPC and tick Spawn the whole group at once (waves).
- Set Only with a player within to, for example, 1500.
- Place the spawner. It refills the whole group only while a player is in range.
Change or pause a spawner
- Change the options, aim at the spawner and press reload.
- To pause it, hold E and press reload. Do it again to turn it back on.
- To clear its NPCs without removing it, right-click its row and pick Remove its NPCs.
Settings and commands
| Setting | What it does | Default | Range |
|---|---|---|---|
kgxat_spawners |
NPC spawners spawn NPCs. | 1 | 0-1 |
kgxat_spawner_max |
Most NPCs alive from all NPC spawners together. | 60 | 1-300 |
kgxat_limit_spawners |
Max NPC spawners for non-admin players (0 = not allowed). | 2 | 0-64 |
Tips and limits
- Spawners are saved in
data/kgx_admin_toolbox/spawners_<map>.json. - The first NPC comes right away. After that, the timer starts once the spawner is no longer full.
- Stop after this many in total counts since the map started. Spawn now (start over) resets the count.
- Removing a spawner also removes the NPCs it made.
- If an NPC cannot be spawned (for example, not installed), the server log notes it once and the spawner retries after at least 30 seconds.
- Logic nodes can turn NPC spawners on or off or make them spawn now.