[Server Hosting] How to create AI Patrols - salutesh/DayZ-Expansion-Scripts GitHub Wiki
Overview of most recent changes
Expansion 1.9.50 (2025-12-22)
- Added
CanSpawnInContaminatedAreaJump To(#CanSpawnInContaminatedArea) - Added two new waypoint behaviors
LOOP_OR_ALTERNATEandROAMING_LOCALJump To(#Behaviour)
Expansion 1.9.50 (2025-12-22)
- Added
DefaultStanceJump To(#DefaultStance) - Added
DefaultLookAngleJump To(#DefaultLookAngle) - Added
MaxFlankingDistanceJump To(#MaxFlankingDistance) - Added
EnableFlankingOutsideCombatJump To(#EnableFlankingOutsideCombat)
Expansion 1.9.41 (2025-10-10)
- Added
LootDropOnDeathJump To(#LootDropOnDeath)
Expansion 1.9.34 (2025-08-22)
- Merged
ObjectPatrolsintoPatrols
Expansion 1.9.23 (2025-05-14)
- Added
LoadBalancingCategoryJump To(#LoadBalancingCategory) andFormationScaleJump To(#FormationScale)
Expansion 1.9.14 (2025-02-12)
- Added extended description for new
LootingBehaviour"options Jump To(#LootingBehaviour)
Expansion 1.9.0 (2024-07-25)
- Added
Persistoption Jump To(#Persist) - Added new possible value
"RANDOM"forFactionoption Jump To(#Faction) - Added new possible value
"ROAMING"forBehaviouroption Jump To(#Behaviour) - Changed
UnlimitedReloadto a bitmask to allow different behavior per target type Jump To(#UnlimitedReload)
1) Finding AIPatrolSettings.json
Inside your mpmissions/dayzoffline.mapname/expansion/settings/ you will find the AIPatrolSettings.json
2) Adding a new Patrol
The easiest way to create a new patrol is using the in-game AI menu. Set yourself as admin in AISettings.json, spawn a few companion AI, use CTRL+click to set waypoints, and select "Export Patrol" from the AI menu. You can then edit the exported file to your liking and copy the patrol into AIPatrolSettings.json.
Name
Allows you to give a name for each patrol so you know what is what. It is also used as the group name in logs.
Persist
If Name is given and unique, alive patrol members will be saved when despawning (also at server restarts) and restored with all their gear at the last position when respawning. Note this is only supported if ObjectClassName is not set.
Faction
This setting allows you to specify what faction this patrol will be in.
When an AI encounters another AI with a different faction, then if either faction considers the other as hostile, combat will ensue. Peaceful encounters will only happen if both factions see each other as neutral.
Note that any AI that is attacked will turn hostile even if it originally considered the attacker's faction as neutral.
You can currently choose between these factions:
West-> Considered hostile by any faction exceptCivilianand otherWestEast-> Considered hostile by any faction exceptCivilianand otherEastRaiders-> Considered hostile by everyone, including other Raiders (unless they are part of the same group)Mercenaries-> Considered hostile by any faction except otherMercenariesCivilian-> Considered neutral by any factionPassive-> Completely passive, will not react to other entities and be ignored by other factions.Guards-> Always neutral toward other guards, neutral toward other AI and players as long as they don't raise their weaponInvincibleGuards-> Like guards, but can't be killed.Shamans-> Considered hostile by everyone except otherShamans, won't attack or be attacked by Zs and animalsObservers-> Will only look at other entities, but not engage in combat.InvincibleObservers-> Like observers, but can't be killed.YeetBrigade-> Same as guard faction but won't pick up weapons and has insanely strong melee (one-shots bears with their fists) that send their victim flying. More of a showcase for faction abilities than something you should actually use.InvincibleYeetBrigade-> Like YeetBrigade, but can't be killed.Brawlers-> Seen as hostile by any faction exceptCivilianand otherBrawlers. Very strong melee (not as strong asYeetBrigade) that can one-shot Infected with fists.RANDOM-> Chooses one of the above factions that are not invincible, observer or passive and don't have special melee abilities.
Formation
Formation of the group. Valid values Column, InvColumn, File, InvFile, Vee, InvVee, Wall, Star, StarDot, Circle, CircleDot or RANDOM.
FormationScale
How far apart the individual formation positions are.
For formations that are on a grid (like Vee, InvVee, Wall, Column and InvColumn), the value determines the side length of the grid in meters.
For formations that are not on a grid (like Star, StarDot, Circle and CircleDot), the value roughly determines the distance between the positions (in case of star-based formations, the inner positions, with distances between outer positions scaled accordingly).
Default: -1.0 = use value from top of AIPatrolSettings.json (fall back to AISettings.json if also -1)
FormationLooseness
How loose the formation is, i.e. how close each AI tries to stay to their respective position in the formation. In meters.
Examples:
- 0 = will try to follow formation exactly
- 0.5 = loose formation
- 1.0 = very loose formation
Loadout
The name of your loadout.json containing the weapons, outfit and gear they will carry with them. For example "HumanLoadout"
Units
If you want specific AI to spawn, enter the eAI classnames here, else leave empty. Note that it will pick classnames randomly from the list UNLESS you set NumberOfAI (see below) to EXACTLY the number of classnames you enter here (in which case it will spawn the exact set you entered).
Example:
"Units": [
"eAI_SurvivorF_Eva",
"eAI_SurvivorM_Mirek",
"eAI_SurvivorF_Judy",
"eAI_SurvivorM_Guo"
],
NumberOfAI
How many AI will be in this patrol.
If you set this setting to a negative number, the system will spawn a random amount of AI between 1 and the specified number with the sign removed.
For example -6 will tell the game to spawn between 1 and 6 AI.
Behaviour
Desired behaviour of your patrol.
- HALT -> The patrol won't move unless in combat and then return to the waypoint.
- ONCE -> The patrol will follow the waypoints from start to finish, then stop.
- LOOP -> The patrol will follow the waypoints from start to finish, then return to start and repeat. Should only be used if the last waypoint is close to the first waypoint, as the AI will just go in a more or less straight line from finish back to start.
- ALTERNATE -> The patrol will follow the waypoints from start to finish, then from finish to start and repeat
- LOOP_OR_ALTERNATE -> Will pick LOOP if start and end waypoints are close together, else ALTERNATE.
- HALT_OR_ALTERNATE -> The patrol will spawn with a random behaviour of either HALT or ALTERNATE
- HALT_OR_LOOP -> The patrol will spawn with a random behaviour of either HALT or LOOP
- ROAMING -> Only the starting waypoint will be used, then the AI will go off and pick destination locations on its own.
- ROAMING_LOCAL -> Only the starting waypoint will be used, then the AI will go off and roam buildings at nearest location indefinitely if there are more than three.
LootingBehaviour
Desired AI looting behavior.
Options can be combined like so:
"LootingBehaviour": "WEAPONS | BANDAGES | CLOTHING_HIPS | CLOTHING_BACK_SMALL | UPGRADE",
Available options:
WEAPONS_FIREARMS
WEAPONS_LAUNCHERS
WEAPONS_MELEE
WEAPONS //! Same as WEAPONS_FIREARMS | WEAPONS_LAUNCHERS | WEAPONS_MELEE
BANDAGES
CLOTHING_ARMBAND
CLOTHING_BACK_LARGE
CLOTHING_BACK_MEDIUM
CLOTHING_BACK_SMALL
CLOTHING_BACK //! Same as all CLOTHING_BACK_* options combined
CLOTHING_BODY
CLOTHING_EYEWEAR
CLOTHING_FEET
CLOTHING_GLOVES
CLOTHING_HEADGEAR
CLOTHING_HIPS
CLOTHING_LEGS
CLOTHING_MASK
CLOTHING_MELEE
CLOTHING_SHOULDER
CLOTHING_VEST
CLOTHING //! Same as all the other CLOTHING_* options combined
//! (except CLOTHING_SIMILAR and CLOTHING_IDENTICAL)
CLOTHING_IDENTICAL //! Will only loot identical clothing to the one the AI is currently wearing
CLOTHING_SIMILAR //! Will only loot similar clothing to the one the AI is currently wearing
//! (i.e. same type, different color)
FOOD //! Food procurement including hunting and animal skinning
UPGRADE //! If the AI already has a weapon or clothing in slot,
//! should it be allowed to upgrade?
DEFAULT //! Same as WEAPONS_FIREARMS | WEAPONS_LAUNCHERS | WEAPONS_MELEE
ALL //! Same as WEAPONS | BANDAGES | CLOTHING | UPGRADE
NONE
Speed
Maximum speed allowed for the AI when not in combat.
STATIC-> The patrol won't move.WALKJOGSPRINTRANDOM-> will give a result between STATIC and SPRINTRANDOM_NONSTATIC-> will give a result between WALK and SPRINT
UnderThreatSpeed
Maximum speed allowed for the AI when in combat.
STATIC-> The patrol won't move.WALKJOGSPRINTRANDOM-> will give a result between STATIC and SPRINTRANDOM_NONSTATIC-> will give a result between WALK and SPRINT
DefaultStance
Default stance the AI will take when not under fire and not melee fighting.
STANDING(default)CROUCHEDPRONE
DefaultLookAngle
Default horizontal look angle in degrees when not looking at a target and not moving. Only used when waypoint behavior is set to HALT. 0.0 = north, 90 = west, -90 = east +-180 = south, any value in between is possible.
If ObjectClassName is set, this angle is relative to the respective object's yaw angle.
CanBeLooted
If set to 1, AI can be looted once dead. If set to 0, they cannot be looted.
LootDropOnDeath
If set to a JSON filename in <serverprofile>\ExapnsionMod\AI\LootDrops, will spawn this loot when AI dies. You can look at the Example.json that is automatically generated to see how the file contents need to be laid out (format is similar to loadouts).
UnlimitedReload
Bitmask. If set to any non-zero value (see below), AI will be able to reload infinitely if they have a spare mag or ammo in their inventory (mags will refill automagically).
- 0 -> Off
- 1 -> All targets
- 2 -> Animals
- 4 -> Infected
- 8 -> Players
- 16 -> Vehicles
Values other than 1 can be added together to combine them. E.g. a value of 6 means only allow unlimited reload if current AI target is an animal or Infected.
SniperProneDistanceThreshold
Minimum distance in meters before an AI holding a bolt action rifle will go prone to engage a target. If the target is closer, AI won't go prone. Setting to 0 disables prone completely.
AccuracyMin
Minimum accuracy of this patrol (0.0-1.0)
- If set to -1 will use the AccuracyMin setting used on the top of the config file.
AccuracyMax
Maximum accuracy of this patrol (0.0-1.0)
- If set to -1 will use the AccuracyMax setting used on the top of the config file.
ThreatDistanceLimit
Distance in meters when the target will start be considered a potential threat
- If set to -1 will use the setting used on the top of the config file.
NoiseInvestigationDistanceLimit
Float. Max distance in meters that AI will search for noise sources. -1 = use value from top of AIPatrolSettings.json (fall back to AISettings.json if also -1)
MaxFlankingDistance
Float. Max distance to enemy in meters that AI will try to flank the enemy (default 200). -1 = use value from top of AIPatrolSettings.json (fall back to AISettings.json if also -1)
EnableFlankingOutsideCombat
Int. Enable flanking outside combat. Note that this will give AI a sort of "sixth sense" about enemies, but not necessarily their exact position when there is no line of sight. 0 = disabled, 1 = enabled, -1 = use value from top of AIPatrolSettings.json (fall back to AISettings.json if also -1)
DamageMultiplier
Damage multiplier for damage dealt by the AI (default 1.0 = no change). Base damage they deal will be multiplied by this value.
- If set to -1 will use the setting used on the top of the config file.
DamageReceivedMultiplier
Damage multiplier for damage the AI receive (default 1.0 = no change). Base damage they receive will be multiplied by this value.
- If set to -1 will use the setting used on the top of the config file.
HeadshotResistance
Default 0.0 = no change. Any value above 0 will disable the brain damage zone (disables instakill when brain is hit). 1.0 = AI will not receive damage from headshots.
CanSpawnInContaminatedArea
Bool. Whether or not this patrol can spawn in contaminated areas.
CanBeTriggeredByAI
Bool. Whether or not this patrol can be triggered by other AI or only actual players.
MinDistRadius
The required minimum distance from a player to spawn. If a player is closer than MinDistRadius meters, then the patrol won't spawn
- If set to -1 will use the MinDistRadius setting used on the top of the config file.
MaxDistRadius
The required maxium distance from a player to spawn. If a player is further away than MaxDistRadius meters, then the patrol won't spawn
- If set to -1 will use the MinDistRadius setting used on the top of the config file.
DespawnRadius
The required distance from a player to despawn. If a player is closer than DespawnRadius meters, then the patrol won't despawn.
- If set to -1 will use the DespawnRadius setting used on the top of the config file.
MinSpreadRadius/MaxSpreadRadius
This setting allows you to make each of your waypoints randomized in a radius defined by min/max spread. If you want your waypoints to be accurate, keep this setting at 0.
Chance
Spawn chance for this patrol as a value between 0.0 (0%) and 1.0 (100%).
DespawnTime
How long will it take for the patrol to despawn if no players are in MaxDistRadius.
- If set to -1 will use the DespawnTime setting used on the top of the config file.
RespawnTime
How long until this patrol can respawn?
- If set to -1 they won't respawn
- If set to -2 will use the RespawnTime setting used on the top of the config file.
LoadBalancingCategory
This allows you to assign a category for load balancing, to determine how many patrols of this type can be active depending on player count, with great amount of customizability. See AI Load Balancing
ObjectClassName
A classname of a building you want AI to spawn on (e.g. heli or police wrecks, police stations, etc).
By default, only objects inheriting from BuildingBase/House are supported, but if you use DayZ-Expansion-Missions, then also the individual airdrop container classnames can be used.
Other objects can be supported by modding (the object type needs to be registered using eAIRegisterDynamicPatrolSpawner and have a eAIDynamicPatrolSpawner instance assigned. How this needs to be initialized depends on the type of object, see BuildingBase.c in DayZ-Expansion-Scripts and ExpansionAirdropContainerBase.c in DayZ-Expansion-Scripts as examples)
WaypointInterpolation
If any interpolation should be used on the given waypoints to smooth out the path at turns. Valid values CatmullRom, NaturalCubic, UniformCubic or empty string (no interpolation).
To illustrate the difference using four waypoints arranged in a zig-zag pattern, look at the following image (image is more exaggerated than the result you will get, as we have an angle threshold of 5 degrees and a distance threshold of 4.5 meters to limit the number of generated points):

UseRandomWaypointAsStartPoint
(only used if ObjectClassName is empty)
If set to 1, use a random waypoint as spawn point (else use the 1st waypoint)
Waypoints
A list of positions the patrols will have to go to. Normally, these positions are world coordinates, but if ObjectClassName is set, these positions are relative to the respective object's position (hint: as an admin, to get a waypoint relative to any specific object, use an admin tool with ESP functionality, e.g. COT or VPP, place the object in question and make sure its orientation is 0 0 0, place your player where you want the waypoint to be, and then subtract the object's position from the player's position to get the relative coordinates).