Skip to content

[Server Hosting] How to create AI Crash Patrols

LieutenantMaster edited this page Mar 4, 2023 · 5 revisions

1) Finding AIPatrolSettings.json

Inside your mpmissions/dayzoffline.mapname/expansion/settings/ you will find the AIPatrolSettings.json

2) Adding a new Patrol

Each patrol will have the follow config:

{
    "Faction": "West",
    "Formation": "",
    "LoadoutFile": "",
    "NumberOfAI": -3,
    "Behaviour": "HALT_OR_ALTERNATE",
    "Speed": "WALK",
    "UnderThreatSpeed": "SPRINT",
    "CanBeLooted": 1,
    "UnlimitedReload": 0,
    "AccuracyMin": -1.0,
    "AccuracyMax": -1.0,
    "ThreatDistanceLimit": -1.0,
    "DamageMultiplier": -1.0,
    "MinDistRadius": -2.0,
    "MaxDistRadius": -2.0,
    "DespawnRadius": -2.200000047683716,
    "MinSpreadRadius": 5.0,
    "MaxSpreadRadius": 20.0,
    "Chance": 1.0,
    "WaypointInterpolation": "",
    "DespawnTime": -1.0,
    "RespawnTime": -2.0,
    "ClassName": "Wreck_UH1Y"
} <=== without a comma if it's the last waypoint

Faction

This setting allows you to specify what faction this patrol will be in. You can currently choose between these factions:

  • West -> Friendly toward Civilian and West
  • East -> Friendly toward Civilian and East
  • Raiders -> Hostile toward everyone, including other Raiders (unless they are part of the same group)
  • Mercenaries -> Hostile toward everyone except other Mercenaries
  • Civilian -> Friendly toward any faction that is not hostile to them (so by default, West, East, Civilian, Passive and Guards)
  • Passive -> Always friendly toward others until attacked
  • Guards -> Always friendly toward other guards, friendly toward other AI and players as long as they don't raise their weapon
  • Shamans -> Friendly towards other shamans, won't attack or be attacked by Zs and animals

Formation

Formation of the group. Valid values Column, File, Vee, Wall or RANDOM.

LoadoutFile

The name of your loadout.json containing the weapons, outfit and gear they will carry with them. For example "HumanLoadout"

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
  • 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
  • HALT_OR_ALTERNATE -> The patrol will spawn with a random behaviour of either ALTERNATE or HALT

Speed

Maximum speed allowed for the AI when not in combat.

  • STATIC
  • WALK
  • JOG
  • SPRINT
  • RANDOM -> will give a result between STATIC and SPRINT
  • RANDOM_NONSTATIC -> will give a result between WALK and SPRINT

UnderThreatSpeed

Maximum speed allowed for the AI when in combat.

  • STATIC
  • WALK
  • JOG
  • SPRINT
  • RANDOM -> will give a result between STATIC and SPRINT
  • RANDOM_NONSTATIC -> will give a result between WALK and SPRINT

CanBeLooted

If set to 1, AI can be looted once dead. If set to 0, they cannot be looted (the item in their hand can still be taken as it will drop to the ground)

UnlimitedReload

If set to 1, AI will be able to reload infinitely if they have a spare mag or ammo in their inventory (mags will refill automagically).

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.

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 -2 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 -2 will use the MinDistRadius 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%).

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):

Curve interpolation

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.

Classname

The scripted Object to spawn onto


This is how it should look like once configured

"ObjectPatrols": [
    {
        "Faction": "West",
        "Formation": "",
        "LoadoutFile": "",
        "NumberOfAI": -3,
        "Behaviour": "HALT_OR_ALTERNATE",
        "Speed": "WALK",
        "UnderThreatSpeed": "SPRINT",
        "CanBeLooted": 1,
        "UnlimitedReload": 0,
        "AccuracyMin": -1.0,
        "AccuracyMax": -1.0,
        "ThreatDistanceLimit": -1.0,
        "DamageMultiplier": -1.0,
        "MinDistRadius": -2.0,
        "MaxDistRadius": -2.0,
        "DespawnRadius": -2.200000047683716,
        "MinSpreadRadius": 5.0,
        "MaxSpreadRadius": 20.0,
        "Chance": 1.0,
        "WaypointInterpolation": "",
        "DespawnTime": -1.0,
        "RespawnTime": -2.0,
        "ClassName": "Wreck_UH1Y"
    },
    {
        "Faction": "East",
        "Formation": "",
        "LoadoutFile": "",
        "NumberOfAI": -3,
        "Behaviour": "HALT_OR_ALTERNATE",
        "Speed": "WALK",
        "UnderThreatSpeed": "SPRINT",
        "CanBeLooted": 1,
        "UnlimitedReload": 0,
        "AccuracyMin": -1.0,
        "AccuracyMax": -1.0,
        "ThreatDistanceLimit": -1.0,
        "DamageMultiplier": -1.0,
        "MinDistRadius": -2.0,
        "MaxDistRadius": -2.0,
        "DespawnRadius": -2.200000047683716,
        "MinSpreadRadius": 5.0,
        "MaxSpreadRadius": 20.0,
        "Chance": 1.0,
        "WaypointInterpolation": "",
        "DespawnTime": -1.0,
        "RespawnTime": -2.0,
        "ClassName": "Wreck_Mi8_Crashed"
    },
    {
        "Faction": "East",
        "Formation": "",
        "LoadoutFile": "PoliceLoadout",
        "NumberOfAI": -3,
        "Behaviour": "HALT_OR_ALTERNATE",
        "Speed": "WALK",
        "UnderThreatSpeed": "SPRINT",
        "CanBeLooted": 1,
        "UnlimitedReload": 0,
        "AccuracyMin": -1.0,
        "AccuracyMax": -1.0,
        "ThreatDistanceLimit": -1.0,
        "DamageMultiplier": -1.0,
        "MinDistRadius": -2.0,
        "MaxDistRadius": -2.0,
        "DespawnRadius": -2.200000047683716,
        "MinSpreadRadius": 5.0,
        "MaxSpreadRadius": 20.0,
        "Chance": 1.0,
        "WaypointInterpolation": "",
        "DespawnTime": -1.0,
        "RespawnTime": -2.0,
        "ClassName": "Land_Wreck_sed01_aban1_police"
    }
]
Clone this wiki locally