AI Spawner - broma-arma/BromA-A3-Framework-Mark3 GitHub Wiki

To make use of AI Spawner, copy the base config to mission\objectives\ai_spawner.sqf.

Base Config

[0, // config version, don't change
	[], // Spawner Settings
	[], // Waypoint Settings
	[], // Group Types
	[], // AI Skills
	[ // Spawners
		[ // Defend Spawner
			"defend", // type
			"Defend Spawner", // id
			side_b_side, // side
			"CSAT", // loadout
			"DEFAULT", // spawner settings
			zone_1, // zone trigger
			5, // delay each wave
			[ // Groups: [Group Type, Count, Waypoint Settings, Waypoint Count]
				["Squad", 2, "SAFE", 10],
				["LIGHT", 2, "SAFE", 5]
			],
			[[ // Camps: [position, group type, spawn count, spawn delay, distance to inactivate if players near]
				[camp_1, "Squad", 5, 5, 200]
			]],
			[ // conditions, 1- start  2- end
				{(true)},
				{(false)}
			]
		],
		[ // Attack Spawner
			"attack", // type
			"Attack Spawner", // id
			side_b_side, // side
			"CSAT", // loadout
			"DEFAULT", // spawner settings
			zone_1, // attack position
			5, // delay each wave
			[ // Groups, 1- Group Type, 2- count, 3- Waypoint Settings, 4- Waypoint Count
				["HEAVY", 3, "ATTACK"]
			],
			[
				[ // spawn positions
					"inf_spawn_1",
					"inf_spawn_2"
				]
			],
			[ // conditions, 1- start condition, 2- end condition
				{(true)},
				{(false)}
			],
			[{}, {}, {}, {}] // events 1 - start, 2 - end, 3 - each wave, 4 - waypoint on complete event
		],
		[ // Stalk Spawner
			"stalk", // type
			"Stalk Spawner", // id
			side_b_side, // side
			"CSAT", // loadout
			"DEFAULT", // spawner settings
			group player, // group to be stalked
			5, // delay each wave
			[ // Groups, [Group Type, Count, Waypoint Settings]
				["Team", 1, "ATTACK_NOLAMBS"]
			],
			[
				1500 // maximum distance where stalking group will be deleted if no player are around
			],
			[ // conditions, 1- start condition, 2- end condition
				{(true)},
				{(false)}
			],
			[{}, {}, {}, {}] // events 1 - start, 2 - end, 3 - each wave, 4 - waypoint on complete event
		]
	]
]

Spawner Settings

A key/value pair of spawner settings, ["key", Settings].

Settings [ARRAY]

  1. minimum distance from players to delete AI, when spawner is deleted. [NUMBER]
    -1 to never delete
    0 to instant delete

  2. minimum distance from players to allow spawning [NUMBER]

  3. disable LAMBS [BOOLEAN]

  4. disable suppresion and autocombat and make ai keep moving charge position [BOOLEAN]

  5. Unit cache distances [ARRAY/BOOLEAN]
    false to disable caching

    1. Not in a vehicle [NUMBER/BOOLEAN]
      false to disable caching
    2. In a vehicle [BOOLEAN]
      false to disable caching
  6. AI Skills setting [STRING]

Framework Settings

The framework includes the following settings:

["DEFAULT", [100, 100, false, false, [500, 2000], "DEFAULT"]],
["ATTACK", [20, 100, false, true, false, "DEFAULT"]],
["ATTACK_NOLAMBS", [20, 100, true, true, false, "DEFAULT"]]

Waypoint Settings

A key/value pair of waypoint settings, ["key", Settings].

Settings [ARRAY]

  1. Radius. Default 0. [NUMBER]

  2. Search Radius (only for attack). Default -1, same as radius. [NUMBER]

  3. Switches the unit behaviour when the waypoint becomes active. Default "UNCHANGED". [STRING]
    Options: "UNCHANGED", "CARELESS", "SAFE", "AWARE", "COMBAT", "STEALTH"
    Force the behavior of a waypoint, disables AUTOCOMBAT, by prefixing the behaviour with "FORCE_", for example "FORCE_COMBAT".

  4. Changes a group's combat mode when the waypoint becomes active. Default "NO CHANGE". [STRING]
    Options: "NO CHANGE", "BLUE", "GREEN", "WHITE", "YELLOW", "RED".

  5. Switches the group formation when the waypoint becomes active. Default "NO CHANGE". [STRING]
    Options: "NO CHANGE", "COLUMN", "STAG COLUMN", "WEDGE", "ECH LEFT", "ECH RIGHT", "VEE", "LINE", "FILE", "DIAMOND".

  6. Switches the group speed mode when the waypoint becomes active. Default "UNCHANGED". [STRING]
    Options: "UNCHANGED", "LIMITED", "NORMAL", "FULL".

  7. Statement expression executed when a waypoint is done. Default "". [STRING]

  8. Defines the time between condition satisfaction and waypoint finish (randomly from min to max, with an average value mid). Default [0, 0, 0]. [ARRAY]

    1. Min [NUMBER]
    2. Mid [NUMBER]
    3. Max [NUMBER]
  9. Completion radius of the waypoint (unit/vehicle's 'precision' will override if larger). Default 0. [NUMBER]

Framework Settings

The framework includes the following settings:

["DEFAULT", [25, 50, "SAFE", "YELLOW", "FILE", "LIMITED", "", [0, 0, 0]]],
["SAFE", [25, 50, "SAFE", "YELLOW", "FILE", "LIMITED", "", [0, 0, 0]]],
["AWARE", [50, 100, "AWARE", "RED", "WEDGE", "FULL", "", [0, 0, 0]]],
["DANGER", [50, 100, "COMBAT", "RED", "WEDGE", "FULL", "", [0, 0, 0]]]

Group Types

A key/value pair of group types, ["key", Types].

Types [ARRAY]

  1. Classname(s) of unit or vehicle [STRING/ARRAY]
    "%1" will be replaced with "B", "O", "I", or "C", according to the spawner's side.
    The following are replaced by the relevant faction vehicles: "AA_VEHICLES", "ATTACK_HELOS", "ATTACK_PLANES", "HEAVY_VEHICLES", "LIGHT_VEHICLES", "MEDIUM_VEHICLES", "MOBILE_ARTILLERY", "TRANSPORT_HELOS", "TRANSPORT_PLANES", "TRANSPORT_TRUCKS", "STATIC_DEFENSE", "BOATS", "UAV", "UGV", "SUPPORT", "SUBMARINES", "MRAP_VEHICLES".
    A random type can be specified by using a sub-array. For example, ["%1_Soldier_TL_F", ["%1_Soldier_LAT_F", "%1_Soldier_F", "%1_Soldier_AR_F"]] would result in 2 men, one being a Team Leader and the other being a Light AT, Rifleman, or Autorifleman.

Framework Settings

The framework includes the following settings:

["DEFAULT", ["%1_Soldier_TL_F", "%1_Soldier_AR_F", "%1_Soldier_LAT_F", "%1_Soldier_F"]],

["Squad", ["%1_Soldier_SL_F", "%1_medic_F", "%1_Soldier_F", "%1_soldier_M_F", "%1_Soldier_TL_F", "%1_Soldier_AR_F", "%1_Soldier_LAT_F", "%1_Soldier_F"]],
["Team", ["%1_Soldier_TL_F", "%1_Soldier_AR_F", "%1_Soldier_LAT_F", "%1_Soldier_F"]],
["Sentry", ["%1_Soldier_TL_F", ["%1_Soldier_LAT_F", "%1_Soldier_F", "%1_Soldier_F", "%1_Soldier_F"]]],

["TRUCK", ["TRANSPORT_TRUCKS"]],
["HELI", ["TRANSPORT_HELOS"]],
["PLANE", ["TRANSPORT_PLANES"]],
["BOAT", ["BOATS"]],
["SUPPORT", ["SUPPORT"]],

["LIGHT", ["LIGHT_VEHICLES"]],
["MEDIUM", ["MEDIUM_VEHICLES"]],
["HEAVY", ["HEAVY_VEHICLES"]],

["AA", ["AA_VEHICLES"]],
["AHELI", ["ATTACK_HELOS"]],
["APLANE", ["ATTACK_PLANES"]],
["ARTILLERY", ["MOBILE_ARTILLERY"]],
["STATIC", ["STATIC_DEFENSE"]],
["UAV", ["UAV"]],
["UGV", ["UGV"]],
["SUBMARINE", ["SUBMARINES"]],
["MRAP", ["MRAP_VEHICLES"]]

AI Skills

A key/value pair of skills, ["key", skills].

Skills [ARRAY]
    0+. AI Skill [ARRAY]
        0. "general", "courage", "aimingAccuracy", "aimingShake", "aimingSpeed", "commanding", "endurance", "spotDistance", "spotTime", or "reloadSpeed" [NUMBER]
        1. value in range 0 to 1 [NUMBER]

Framework Settings

The framework includes the following settings:

["DEFAULT", [["general", 1], ["aimingAccuracy", 0.70], ["aimingShake", 0.75], ["aimingSpeed", 1], ["endurance", 1], ["spotDistance", 0.85], ["spotTime", 1], ["courage", 1], ["reloadSpeed", 1], ["commanding", 1]]]

AI Spawners

Spawners [ARRAY]

  1. Type of spawner to create: "defend", "attack", "stalk" [STRING]
  2. Unique ID [STRING]
  3. Side: BLUFOR, OPFOR, INDEPENDENT, CIVILIAN [SIDE]
  4. Faction, E.g. side_b_faction, "CSAT", "NATO", ... [STRING]
  5. Spawner Settings ID [STRING]
  6. Target [OBJECT/GROUP/MARKER/LOCATION/POSITION/WAYPOINT/ARRAY]
  7. Delay, in seconds, between waves [NUMBER]
  8. Group configs [ARRAY]
        0+. Group config [ARRAY]
            0. Type ID [STRING, defaults to "DEFAULT"]
            1. Count [NUMBER, defaults to 0]
            2. Waypoint Settings ID [STRING, defaults to "DEFAULT"]
            3. Waypoint count [NUMBER, defaults to 2]
  9. Type specific config [ARRAY, defaults to []]
        defend:
            0. Camp configs [ARRAY, defaults to []]
                0+. Camp config [ARRAY]
                    0. position [TRIGGER]
                    1. group type [STRING]
                    2. spawn count [NUMBER, defaults to 2]
                    3. spawn delay [NUMBER, defaults to 5]
                    4. distance to inactivate if players near [NUMBER, defaults to 200]
        attack:
            0. Spawn positions [ARRAY, defaults to []]
                0+. Spawn position [OBJECT/GROUP/MARKER/LOCATION/POSITION/WAYPOINT/ARRAY]
        stalk:
            0. maximum distance where stalking group will be deleted if no player are around [NUMBER, defaults to _settingSafeSpawnDistance * 2]
  10. Conditions [ARRAY, defaults to []]
        0. Start condition [CODE/NUMBER/ARRAY, defaults to { true }]
            CODE: Condition for spawner to start
            NUMBER: Delay, in seconds, before spawner is started
            ARRAY:
                0. Condition for spawner to start [CODE, defaults to { true }]
                1. Delay, in seconds, after condition returns true and before spawner is started [NUMBER, defaults to 0]
        1. Condition for spawner to end [CODE/NUMBER/ARRAY, defaults to { false }]
            CODE: Condition for spawner to end
            NUMBER: Group spawn limit
            ARRAY:
                0. Condition for spawner to end [CODE, defaults to { false }]
                1. Group spawn limit [NUMBER, defaults to -1]
  11. Events [ARRAY, defaults to []]
        0. Before a wave is spawned [CODE, defaults to {}]
        1. After a wave is spawned [CODE, defaults to {}]
        2. After a group is spawned [CODE, defaults to {}]
        3. After a group reaches a waypoint [CODE, defaults to {}]

Full Example

[0, // config version, don't change
	[ // Spawner Settings
		["EXAMPLE", [ // ID
			100, // minimum distance from players to delete AI, when spawner is deleted. -1 to never delete, 0 to instant delete (NUMBER)
			150, // minimum distance from players to allow spawning
			false, // disable LAMBS
			false, // disable suppresion and autocombat and make ai keep moving charge position
			[ // false to disable caching
				650, // infantry cache distance
				1000 // vehicle cache distance
			],
			"REGULAR" // AI Skills setting
		]]
	],

	[ // Waypoint Settings
		["EXAMPLE", [ // ID
			10, // Radius
			150, // Search Radius (only for attack)
			"SAFE", // Behaviour
			"YELLOW", // Combat Mode
			"FILE", // Formation
			"LIMITED", // Speed
			"", // Code
			[0, 0, 0] // Timeout [min, mid, max]
		]],
	],

	[ // Group Types
		// [ID, [Classname of units or array to choose random (for infantry use vanilla units)]]
		// "%1" is replaced with "B", "O", "I", or "C", according to spawner's side
		// The following are replaced by the vehicles in the faction: "AA_VEHICLES", "ATTACK_HELOS", "ATTACK_PLANES", "HEAVY_VEHICLES", "LIGHT_VEHICLES", "MEDIUM_VEHICLES", "MOBILE_ARTILLERY", "TRANSPORT_HELOS", "TRANSPORT_PLANES", "TRANSPORT_TRUCKS", "STATIC_DEFENSE", "BOATS", "UAV", "UGV", "SUPPORT", "SUBMARINES", "MRAP_VEHICLES"
		["EXAMPLE Infantry", ["%1_Soldier_TL_F", "%1_medic_F", ["%1_Soldier_F", "%1_Soldier_LAT_F"], ["%1_Soldier_AR_F", "%1_soldier_M_F"]]],
		["EXAMPLE Vehicles", ["O_MRAP_02_F", "O_G_Offroad_01_F", "O_Quadbike_01_F", "O_Truck_02_transport_F"]],
		["EXAMPLE Faction Vehicles", ["LIGHT_VEHICLES", "MEDIUM_VEHICLES", "HEAVY_VEHICLES"]]
	],

	[ // AI Skills
		["EXAMPLE Skills", [["general", 1], ["aimingAccuracy", 0.70], ["aimingShake", 0.75], ["aimingSpeed", 1], ["endurance", 1], ["spotDistance", 0.85], ["spotTime", 1], ["courage", 1], ["reloadSpeed", 1], ["commanding", 1]]]
	],

	[ // Spawners
		[ // Defend Spawner
			"defend", // type
			"Defend Spawner", // id
			side_b_side, // side
			"CSAT", // loadout
			"DEFAULT", // spawner settings
			zone_1, // zone trigger
			5, // delay each wave
			[ // Groups: [Group Type, Count, Waypoint Settings, Waypoint Count]
				["Infantry Team", 2, "SAFE", 10],
				["Cars", 2, "SAFE", 5]
			],
			[[ // Camps: [position, group type, spawn count, spawn delay, distance to inactivate if players near]
				[camp_1, "Infantry Team", 5, 5, 200]
			]],
			[ // conditions, 1- start  2- end
				{(true)},
				{(false)}
			]
		],
		[ // Attack Spawner
			"attack", // type
			"Attack Spawner", // id
			side_b_side, // side
			"CSAT", // loadout
			"DEFAULT", // spawner settings
			zone_1, // attack position
			5, // delay each wave
			[ // Groups, 1- Group Type, 2- count, 3- Waypoint Settings, 4- Waypoint Count
				["Tanks", 3, "AWARE"]
			],
			[
				[ // spawn positions
					"inf_spawn_1",
					"inf_spawn_2"
				]
			],
			[ // conditions, 1- start condition, 2- end condition
				{(true)},
				{(false)}
			],
			[{}, {}, {}, {}] // events 1 - start, 2 - end, 3 - each wave, 4 - waypoint on complete event
		],
		[ // Stalk Spawner
			"stalk", // type
			"Stalk Spawner", // id
			side_b_side, // side
			"CSAT", // loadout
			"DEFAULT", // spawner settings
			group player, // group to be stalked
			5, // delay each wave
			[ // Groups, [Group Type, Count, Waypoint Settings]
				["Infantry Team", 1, "AWARE"]
			],
			[
				1500 // maximum distance where stalking group will be deleted if no player are around
			],
			[ // conditions, 1- start condition, 2- end condition
				{(true)},
				{(false)}
			],
			[{}, {}, {}, {}] // events 1 - start, 2 - end, 3 - each wave, 4 - waypoint on complete event
		]
	]
]
⚠️ **GitHub.com Fallback** ⚠️