Skip to content

ArmA 3 Zones (Triggers)

Scrim edited this page Apr 25, 2022 · 4 revisions

Admiral 0.8 still allows for triggers to be used in lieu of modules if you so require.

Install

  • Copy the admiral/ folder to the mission's root directory.
  • Insert #include "admiral\admiral.h" line into the description.ext file.

Zones

A zone is an object that spawns groups of infantry, technicals and armour. There are different types of zones, each trying to solve different problems.

Configuration

A zone is configured with an array of config entries. An entry consists of a name and a value. Different zone types require different entries.

  • Example of entries: [["name", "zone1"], ["type", "patrol"], ["pool", [3,1,0]]]

Config Entries

name
  • Reqired: No
  • Types: All
  • Value: Valid global variable name
  • Description: Similar to a trigger's name, the zone will be available as a global variable with the given name. For example given the ["name", "patrol1"] entry, you will be able to reference the zone with patrol1 global variable.
type
  • Reqired: Yes
  • Types: All
  • Value: cqc, patrol, camp
  • Default: None
  • Description: Sets the type of the zone.
position
  • Reqired: Yes
  • Types: All
  • Value: Valid position
  • Default: None
  • Description: Sets the center position of the zone, similiar to a trigger's position.
area
  • Reqired: Yes
  • Types: All
  • Value: Valid trigger area
  • Default: None
  • Description: Sets the shape and size of the zone, similiar to a trigger.
enabled
  • Reqired: No
  • Types: All
  • Value: true, false
  • Default: true
  • Description: Does nothing for now.
unitTemplate
  • Reqired: No
  • Types: All
  • Value: One of the available unit templates;
  • Default: Based on zone type either adm_camp_defaultUnitTemplate, adm_patrol_defaultUnitTemplateor adm_cqc_defaultUnitTemplate
  • Description: Sets the unit template used by the zone.
pool
  • Reqired: Yes
  • Types: All
  • Value: [<infantry groups>, <technical groups>, <armour groups>] for camp and patrol, <infantry units> for cqc
  • Default: None
  • Description: Sets the number of spawned groups by type for a camp or patrol zone, or sets the maximum number of units spawned by a cqc zone.
zoneTemplate
  • Reqired: No
  • Types: All
  • Value: One of the available zone templates;
  • Default: Based on zone type either adm_camp_defaultZoneTemplate, adm_patrol_defaultZoneTemplateor adm_cqc_defaultzoneTemplate
  • Description: Sets the zone template used by the zone.
campType
  • Reqired: Yes
  • Types: camp
  • Value: ondemand, periodic, random
  • Default: None
  • Description: Sets the type of the camp zone.
wave
  • Reqired: Yes
  • Types: camp
  • Value: [<infantry groups>, <technical groups>, <armour groups>]
  • Default: None
  • Description: Sets the number of groups spawned by a camp in a wave.
campDelay
  • Reqired: No
  • Types: camp
  • Value: Number in seconds
  • Default: 10
  • Description: A camp has to check if it can spawn a wave periodically. campDelay sets the delay in seconds between two checks. Setting this value too low can cause performance issues.
campDelay
  • Reqired: No
  • Types: periodic camp, random camp
  • Value: [<infantry groups>, <technical groups>, <armour groups>]
  • Default: 10
  • Description: A camp has to check if it can spawn a wave periodically. campDelay sets the delay in seconds between two checks. Setting this value too low can cause performance issues.
Name Value Type Requeired Description

campDelay||camp|| groupDelay||preiodic,random|| spawnChance||random|| minHeight|Number|cqc|No|The minimum height

Using zones

Currently there are 3 types of zones, CQC for urban environments, Camps for reinforcements/wave attacks and Patrol for patrolling a given area.

CQC

Used for urban combat. AI will spawn inside buildings and react to player presence. By default CQC AI is forced to look and fire at the closest enemy, if their line of sight is not blocked. This functionality significantly increases the reaction time of the AI, but can be turned off. The spawned infantry should stay at their spawn position, but they may move around. Spawned units are configured in the unit template file, while their skills are set in the zone template file. Only infantry can be spawned with the CQC zones.

CQC uses building positions, to place units inside buildings. These are defined as part of the building model. If the creator of the model didn't define any positions, CQC can't spawn any units inside that building. Buildings can be blacklisted in the settings file by adding the class name to the adm_cqc_buildingBlacklist array.

TODO adm_cqc_buildingCapacity

Configuration

TODO new image

These are the minimal requirements for a trigger to work as a CQC zone:

  • Axes: Must be below 500, otherwise there's a chance that CQC triggers won't initialize properly.
  • Text: Must be cqc, else it won't be recognized as CQC zone.
  • Condition: An SQF expression that can be evaluated to true or false. Activates the zone and start spawning the units. Read about it here.
  • On Act.: Must have the statement [thisTrigger, [["pool", x]]] call adm_api_fnc_initZone;, where:
    • x is the MAXIMUM number of units that can spawn.

These are the additional config entries that you can use to customise the CQC zones further:

  • Minimum height: Minimum height can be specified to force units to only spawn above h metres using entry ["minHeight", h]. If there are no positions above the given height in a building, no units will be spawned there.
  • Unit template: Using entry ["unitTemplate", t] will override the base unit template class with t. More about it here.

Examples:

  • With minimum height: [thisTrigger, [["pool", 20], ["minHeight", 2]]] call adm_api_fnc_initZone;
  • Without minimum height: [thisTrigger, [["pool", 18]]] call adm_api_fnc_initZone;
  • With unit template: [thisTrigger, [["pool", 20], ["unitTemplate", "USMC_Woodland"]]] call adm_api_fnc_initZone;

Patrol

Used for patrolling an area. AI will follow randomly generated waypoints in the zone area and react to enemy presence. Additionally AI will react to enemy based on their numbers and composition with behavior system. Infantry, technicals and armour can be spawned by the zones. Spawned units are configured in the unit template file.

To help frequent use cases, Patrol zones can be "moved" to a given position, or can "follow" a given object.

Configuration

Basic patrol configuration

These are the minimal requirements for a trigger to work as a Patrol zone:

  • Text: Must be patrol, else it won't be recognized as Patrol zone.
  • Condition: An SQF expression that can be evaluated to true or false. Activates the zone and start spawning the units. Read about it here.
  • On Act.: Must have the statement [thisTrigger, [["pool", [x,y,z]]]] call adm_api_fnc_initZone;, where:
    • x, y, z are the number of infantry, technical and armour groups that will be spawned.

These are the additional config entries that you can use to customise the CQC zones further:

  • Unit template: Using entry ["unitTemplate", t] will override the base unit template class with t. More about it here.

Examples:

  • Infantry only: [thisTrigger, [["pool", [10, 0, 0]]]] call adm_api_fnc_initZone;
  • A bit of everything: [thisTrigger, [["pool", [3, 2, 1]]]] call adm_api_fnc_initZone;
  • With unit template: [thisTrigger, [["pool", [0, 0, 1]], ["unitTemplate", "RU_Woodland"]]] call adm_api_fnc_initZone;

Move

Calling the function [_zone, _position, _triggerArea] call adm_api_fnc_moveZone will move the zone to _position. _triggerArea will change the shape and size of the zone, but can be omitted. The trigger area format is the same as triggerArea used for editor triggers. Moving the zone will create new waypoints for the zone's groups at the new position. If you want a zone to follow a player/unit, use "follow" instead of moving the zone manually, becasue follow is more efficient.

Example:

  • Move zone to player: Given you have the zone named move_zone, [move_zone, position player] call adm_api_fnc_moveZone
  • Move zone to concrete position with triggerArea: Given you have the zone named square_zone, the position at [100.5, 214.1, 1] and you want a 500 metres square, [square_zone, [100.5, 214.1, 1], [500, 500, 0, true]] call adm_api_fnc_moveZone

Follow

Calling the function [_zone,_object,_delay,_triggerArea] call adm_api_fnc_followZone will make the zone follow the given _object. _delay is the time elapsed between zone position updates (Keep delay as high as possible). _triggerArea will change the shape and size of the zone, but can be omitted. The trigger area format is the same as triggerArea used for editor triggers. The zone's groups will follow the _object.

To stop a zone from following an object use [_zone] call adm_api_fnc_stopFollowZone.

Example:

  • Make zone follow player every 2 minutes: Given you have the zone named follow_zone, [follow_zone, player, 180] call adm_api_fnc_followZone
  • Make zone follow a vehicle every minute with triggerArea: Given you have the zone named vehicle_zone, the vehicle names 'follow_me' and you want a 400 metres circle, [square_zone, follow_me, 60, [200, 200, 0, false]] call adm_api_fnc_moveZone
  • Stop follow zone: Given you have the zone named stop_me_zone, [stop_me_zone] call adm_patrol_fnc_stopFollowZone

Camps

Used for spawning multiple waves of AI. There are three types of camps, periodic, ondemand and random. Camps have waypoints that spawned groups will randomly choose from and follow. When a group reaches the end of the waypoints it will start patrolling the area. Additionally AI will react to enemy based on their numbers and composition with behavior system. Infantry, technicals and armour can be spawned by the zones. Spawned units are configured in the unit template file.

Configuration

These are the minimal requirements for a trigger to work as a Camp zone, but each camp type can have additional requirements:

Basic path configuration

Every camp zone must have at least one "path". A "path" is a game logic placed inside the camp's trigger area and has at least 1 waypoint. By default "paths" allow infantry, technicals and armour groups to use them, but can be limited by group type:

  • Initialization: this setVariable ["usedBy", [x,y,z]];, where:
    • x, y, z set if infantry, technicals and armour can take this path. true for allowing and false for disallowing path usage.

Basic camp configuration

  • Text: Must be camp, else it won't be recognized as Camp zone.
  • Condition: An SQF expression that can be evaluated to true or false. Activates the zone and start spawning the units. Read about it here.
  • On Act.: Must have the statement [thisTrigger, [["type", t],["pool", [px,py,pz]],["wave", [wx,wy,wz]]]] call adm_api_fnc_initZone;, where:
    • t is the camp type and must be either periodic, ondemand or random.
    • px, py, pz are the number of infantry, technical and armour groups that will be spawned. If you want infinite number of groups use [-1, -1, -1] (Infinite number of groups are NOT recommended for Periodic and Random camps).

Periodic

Waves spawn after given time has elapsed.

  • On Act.: [thisTrigger, [["type", "periodic"],["pool", [px,py,pz]],["wave", [wx,wy,wz]], ["groupDelay", [gx,gy,gz]]]] call adm_api_fnc_initZone;
    • gx, gy, gz are the delays between waves. Group delays are multiples of 10 seconds (the default camp delay). For example group delays [6, 10, 12] mean, 60/100/120 seconds delay between infantry/technical/armour waves.

Examples:

  • Infantry only with 1 minute delay: [thisTrigger, [["type", "periodic"],["pool", [10,0,0]],["wave", [2,0,0]], ["groupDelay", [6,0,0]]]] call adm_api_fnc_initZone;
  • A bit of everything: [thisTrigger, [["type", "periodic"],["pool", [8,4,2]],["wave", [1,1,1]], ["groupDelay", [6,12,18]]]] call adm_api_fnc_initZone;

Ondemand

Zone tries to spawn a wave and check for dead groups at every x seconds, where x is the camp delay (default 10 seconds). Wave size determines the number of groups to be alive at any time. If a group dies, the zone will respawn that group from the pool at the next camp update.

Ondemand doesn't require additional configuration.

Examples:

  • Steady supply of infantry and technicals, till end of mission: [thisTrigger, [["type", "ondemand"],["pool", [-1,-1,0]],["wave", [4,1,0]]]] call adm_api_fnc_initZone;

Random

Zone tries to spawn a wave at every x seconds, where x is the camp delay (default 10 seconds). The chance of groups and the number of groups spawned are random. If a group type can spawn, the number of actual groups spawned is randomized between 0 and the wave size.

  • On Act.: [thisTrigger, [["type", "random"],["pool", [px,py,pz]],["wave", [wx,wy,wz]],["campDelay", cd], ["spawnChance", [sx,sy,sz]]]] call adm_api_fnc_initZone;
    • sx, sy, sz are the chances of infantry, technical and armour groups spawning given in percentage.

Examples:

  • Random bit of everything, infantry 75%, techincals 40%, armour 10% chance [thisTrigger, [["type", "random"],["pool", [5,2,2]],["wave", [2,1,1]], ["spawnChance", [75,40,10]]]] call adm_api_fnc_initZone;

Disable

Calling the function [_zone] call adm_api_fnc_disableCamp will disable the camp zone. This will stop the spawning of waves. Currently there is no way to enable a camp after it has been disabled.

Example:

  • Disable camp: Given you have the zone named disable_me_camp, [disable_me_camp] call adm_api_fnc_disableCamp