Repository navigation
4. AI Spawning System
Available from v1.0.8+, BS KeyRoom can spawn AI defenders the moment a door is activated. The system supports vanilla DayZ zombies and animals as well as Expansion AI soldiers with custom loadouts and factions — everything configurable per door, either from the JSON file or entirely from the in-game Admin Menu.
💡 Since the Admin Menu received its dedicated AI tab, you no longer need to touch JSON at all to set up AI defenders. See 4.4. Configuring AI from the Admin Menu.
- 4.1. How AI Spawning Works
- 4.2. AI Entry Parameters
- 4.3. Expansion AI — The Pipe Format
- 4.4. Configuring AI from the Admin Menu (Recommended)
- 4.5. Expansion Factions
- 4.6. JSON Examples
- 4.7. Deprecated Fields
- 4.8. Troubleshooting
When a player successfully uses a keycard and the door opens:
- The system reads the door's
aiToSpawnOnOpenlist together withmin_ai_to_spawn/max_ai_to_spawn. - If
min_ai_to_spawnormax_ai_to_spawnis-1, every AI defined in the list spawns. - Otherwise, a random count between min and max is rolled, and that many entries are picked at random from the list, without repeats — each defined AI can spawn at most once per door event.
- The selected AI entities are spawned at their defined world positions and orientations.
- AI do not respawn once killed — they only spawn again the next time the door is unlocked with a keycard.
- When the door's restock timer ends and it closes again, any surviving AI are despawned automatically.
ℹ️ AI entries do not have a
spawnChanceweight — selection among entries is uniform. If you want a certain guard to appear more often, the practical trick is to define it (or near-identical copies of it) multiple times in the list.
Each object inside aiToSpawnOnOpen supports these fields:
| Parameter | Type | Default | Description |
|---|---|---|---|
referenceName |
String | "AI_Spawn" |
Unique name for this entry, used in logs and shown in the Admin Menu's AI list. |
className |
String | "ZmbM_PatrolNormal_Autumn" |
Entity classname to spawn. For vanilla zombies/animals use the classname alone. For Expansion AI use the pipe format — see 4.3. |
position |
Array | [0, 0, 0] |
World coordinates [X, Y, Z]. |
orientation |
Array | [0, 0, 0] |
Rotation [Yaw, Pitch, Roll]. |
These live at the top level of the door config, next to aiToSpawnOnOpen:
| Parameter | Type | Default | Description |
|---|---|---|---|
min_ai_to_spawn |
Int | -1 |
Minimum number of entries picked from the list per door event. -1 = always spawn all defined AI. |
max_ai_to_spawn |
Int | -1 |
Maximum number of entries picked from the list per door event. -1 = always spawn all defined AI. |
💡 With
min_ai_to_spawn: 1andmax_ai_to_spawn: 3on a list of 6 guards, each door opening spawns a random squad of 1–3 out of those 6 — every raid feels different. If the rolled count exceeds the number of defined entries, it is clamped automatically.
For Expansion AI soldiers, the className field uses a pipe-separated format that encodes the class, loadout, and faction all in one string:
"className": "AI_Class|LoadoutFile|FactionName"
| Part | Description |
|---|---|
AI_Class |
The base entity class (e.g. eAI_SurvivorM_Mirek, eAI_SurvivorF_Eva). |
LoadoutFile |
Name of the loadout JSON in $profile:ExpansionMod\Loadouts\ (e.g. BanditLoadout). |
FactionName |
Name of the Expansion AI faction (e.g. Mercenaries, Raiders, Guards). If omitted, the faction defaults to Guards. |
Example:
"className": "eAI_SurvivorM_Mirek|BanditLoadout|Mercenaries"
⚠️ All three parts go on the sameclassNameline, separated by|. There are no separate working fields for loadout or faction — see 4.7. Deprecated Fields.
⚠️ Expansion AI requires the DayZ-Expansion-AI mod loaded on your server. If the mod is not present, the pipe format is ignored and the entity will fail to spawn correctly. See 10. Expansion Integration.
💡 You only need to type this pipe string by hand if you edit JSON files directly. The Admin Menu composes it for you — see the next section.
The Admin Menu's AI tab now covers the entire AI workflow — no JSON editing required. Open the menu (default K, admins only — see 8. Admin Menu Guide), select your door, and switch to the AI tab.
Click the class picker to browse spawnable entities. It provides:
- Category tabs: ZOMBIES, ANIMALS, and HUMANS-AI to filter the class list.
- A search field to filter by name.
- A live 3D preview of the selected entity, so you can confirm you picked the right zombie skin or survivor model before saving.
Ticking the "Expansion AI Bot" checkbox reveals two extra fields:
| Field |
... Picker Behavior |
|---|---|
| Loadout | Lists loadout files live from the server's $profile:ExpansionMod\Loadouts folder — you always pick from loadouts that actually exist on your server. |
| Faction | Lists all Expansion factions (see 4.5). Modded/custom faction names can also be typed in as free text. |
The menu then composes the Class|Loadout|Faction pipe string automatically and stores it in className. Manual pipe typing is no longer needed — it remains documented above only for people who prefer editing JSON files directly.
Clicking Set Position for an AI entry activates the placement hologram: a humanoid ghost marker appears in the world and follows your aim, letting you place the guard exactly where you want it (and facing the right way) instead of copy-pasting coordinates. Confirm to write the position and orientation into the entry.
💡 Don't forget to set
min_ai_to_spawn/max_ai_to_spawnin the AI tab as well, then save the door config from the menu.
The faction controls group coordination and which entities the AI treats as allies or enemies. The built-in Expansion factions are:
Brawlers |
Civilian |
East |
Guards |
Infected |
Lunatics |
Mercenaries |
Observers |
Passive |
Raiders |
Shamans |
West |
YeetBrigade |
ℹ️ Factions added by other mods are accepted as free text — type the faction name exactly as the mod defines it.
All bots spawned for the same door event are automatically placed in one shared group with one faction, so they coordinate as a single squad. The group's faction is taken from the first Expansion bot spawned for that door.
"aiToSpawnOnOpen": [
{
"referenceName": "Guard_1",
"className": "ZmbM_PatrolNormal_Autumn",
"position": [
1320.5,
290.0,
9285.0
],
"orientation": [
0.0,
0.0,
0.0
]
},
{
"referenceName": "Guard_2",
"className": "ZmbF_JournalistNormal_White",
"position": [
1325.0,
290.0,
9290.0
],
"orientation": [
90.0,
0.0,
0.0
]
}
],
"min_ai_to_spawn": -1,
"max_ai_to_spawn": -1Both zombies spawn on every door opening (-1 = spawn all).
"aiToSpawnOnOpen": [
{
"referenceName": "Elite_Commander",
"className": "eAI_SurvivorM_Mirek|Guards_Tier3|Raiders",
"position": [
1322.0,
290.5,
9287.0
],
"orientation": [
0.0,
0.0,
0.0
]
},
{
"referenceName": "Silent_Sniper",
"className": "eAI_SurvivorF_Eva|Sniper_Loadout|Mercenaries",
"position": [
1330.0,
295.0,
9288.0
],
"orientation": [
45.0,
0.0,
0.0
]
}
],
"min_ai_to_spawn": 1,
"max_ai_to_spawn": 2Each door opening spawns 1–2 of the two defined bots, picked at random. Both end up in the same group so they fight as a unit.
"aiToSpawnOnOpen": [
{
"referenceName": "Zombie_Grunt",
"className": "ZmbM_PatrolNormal_Autumn",
"position": [
1318.0,
290.0,
9283.0
],
"orientation": [
0.0,
0.0,
0.0
]
},
{
"referenceName": "Expansion_Guard",
"className": "eAI_SurvivorM_Mirek|HumanLoadout|Mercenaries",
"position": [
1322.0,
290.0,
9287.0
],
"orientation": [
180.0,
0.0,
0.0
]
},
{
"referenceName": "Bear_Surprise",
"className": "Animal_UrsusArctos",
"position": [
1326.0,
290.0,
9292.0
],
"orientation": [
90.0,
0.0,
0.0
]
}
],
"min_ai_to_spawn": 1,
"max_ai_to_spawn": 2Older versions of the config class exposed per-entry Expansion fields. These still exist in the data structure for backwards compatibility, but they are ignored by the spawner — the pipe format in className is the only working mechanism:
| Field | Status |
|---|---|
isExpansionBot |
❌ Deprecated — ignored. |
expansionFaction |
❌ Deprecated — ignored. Use the third pipe segment instead. |
expansionLoadout |
❌ Deprecated — ignored. Use the second pipe segment instead. |
expansionUnlimitedAmmo |
❌ Deprecated — ignored. |
expansionCanBeLooted |
❌ Deprecated — ignored. |
⚠️ If your bots spawn without their loadout or faction and your config uses these fields, that's why — move the values into theClass|Loadout|Factionpipe string (or simply re-save the entry from the Admin Menu's AI tab).
| Symptom | Cause / Fix |
|---|---|
| Bots spawn naked | The loadout file is missing or misnamed in $profile:ExpansionMod\Loadouts. The loadout name in the pipe string must match an existing file in that folder. Use the Admin Menu's ... loadout picker to select only from files that really exist. See 11. FAQ & Troubleshooting. |
| Expansion bot doesn't spawn at all | DayZ-Expansion-AI is not loaded on the server. See 10. Expansion Integration. |
| Bots ignore the loadout/faction I set | You used the deprecated struct fields — see 4.7. |
| Fewer AI spawn than expected |
min_ai_to_spawn / max_ai_to_spawn limits how many entries are picked per event. Set both to -1 to always spawn everything. |
Configure vehicle rewards → 5. Vehicle Spawning System
Related pages: 2. Door Configuration · 8. Admin Menu Guide · 10. Expansion Integration
Getting Started
Configuration
- 2. Door Configuration
- 3. Advanced Loot System
- 4. AI Spawning System
- 5. Vehicle Spawning System
- 6. Keys & Keycards
- 7. Main Settings
In-Game Tools
Integrations & Help