Ambient Combat Manager - Functions – Arma 2

From Bohemia Interactive Community
Jump to navigation Jump to search
m (→‎Intensity: Adjusted maximum value (courtesy of Kosmok from Discord, https://discord.com/channels/105462288051380224/105465701543723008/1302616280276140105))
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:ArmA_2:_Editing|Ambient Combat Manager - Functions]]
{{TOC|side}}
This page describes all pre-defined functions available to manipulate the settings of an [[Ambient Combat Manager]] (ACM).


== Introduction ==
This page describes all pre-defined functions available to manipulate the settings of an [[Ambient_Combat_Manager|Ambient Combat Manager]] (ACM).


== Intensity ==
== Intensity ==
Not all missions require heavy enemy / friendly presence. The ACM's intensity controls how many patrols can be active at a given time and how frequently patrols are spawned. The intensity can be controlled by using the following function call:
Not all missions require heavy enemy / friendly presence. The ACM's intensity controls how many patrols can be active at a given time and how frequently patrols are spawned. The intensity can be controlled by using the following function call:


  [<intensity | Scalar>, <ACM reference | Object>] call BIS_ACM_setIntensityFunc;
<sqf>[intensity, module] call BIS_ACM_setIntensityFunc;</sqf>
 
* ''intensity'': a Scalar between 0.0 and 1.0. 1.0 is the maximum intensity and 0.0 will in effect pause the ACM.
* ''ACM reference'': a reference to the ACM object itself, or a reference to any unit in the group the ACM is synchronized to.


* ''intensity'': [[Number]] - a [[Number]] between 0.0 and 2.0. 2.0 is the maximum intensity and 0.0 will in effect pause the ACM.
* ''module'': [[Object]] - a reference to the ACM module itself, or a reference to any unit in the group the ACM is synchronized to.


'''Example:'''
'''Example:'''
Line 17: Line 16:
Sets frequency and number of patrols (values 0-1). BIS_ACM is module name.
Sets frequency and number of patrols (values 0-1). BIS_ACM is module name.


  [1, BIS_ACM] call BIS_ACM_setIntensityFunc;
<sqf>[1, BIS_ACM] call BIS_ACM_setIntensityFunc;</sqf>


== Spawning distances ==
== Spawning distances ==
It is possible to control the minimum and maximum distance from the group leader at which enemies will be spawned. Be careful not to spawn too close, since it will be obvious to human players.  
It is possible to control the minimum and maximum distance from the group leader at which enemies will be spawned. Be careful not to spawn too close, since it will be obvious to human players.  


  [<ACM reference | Object>, <minimum | Scalar>, <maximum | Scalar>] call BIS_ACM_setSpawnDistanceFunc;
<sqf>[module, minimum, maximum] call BIS_ACM_setSpawnDistanceFunc;</sqf>
 
* ''minimum'': [[Number]] - 0..1
* ''maximum'': [[Number]] - 0..1
* ''module'': [[Object]]


* Distances with the value -1 will leave the distance as it was.
* Distances with the value -1 will leave the distance as it was.
Line 28: Line 32:
* The default values are 500 meters (minimum) and 1000 meters (maximum).
* The default values are 500 meters (minimum) and 1000 meters (maximum).
* Air patrols are currently excluded from these distances, since they generally require a much large area and they are not spawned on the ground.
* Air patrols are currently excluded from these distances, since they generally require a much large area and they are not spawned on the ground.


'''Example:'''
'''Example:'''
Line 34: Line 37:
Min & Max spawn distances included. BIS_ACM is module name.
Min & Max spawn distances included. BIS_ACM is module name.


  [BIS_ACM, 100, 500] call BIS_ACM_setSpawnDistanceFunc;
<sqf>[BIS_ACM, 100, 500] call BIS_ACM_setSpawnDistanceFunc;</sqf>
 


== Skill range ==
== Skill range ==
You can control the skill levels of spawned units by defining a range from which a random value is selected for each unit. If you want a very specific value, simply make a range with both minimum and maximum set to that value.
You can control the skill levels of spawned units by defining a range from which a random value is selected for each unit. If you want a very specific value, simply make a range with both minimum and maximum set to that value.


  [<minimum | Scalar>, <maximum | Scalar>, <ACM reference | Object>] call BIS_ACM_setSkillFunc;
<sqf>[minimum, maximum, module] call BIS_ACM_setSkillFunc;</sqf>
 
* The skill values should be Scalars between 0.0 and 1.0.


* ''minimum'': [[Number]] - 0..1
* ''maximum'': [[Number]] - 0..1
* ''module'': [[Object]]


'''Example:'''
'''Example:'''
Line 48: Line 54:
Min & Max skill range for spawned units. BIS_ACM is module name.
Min & Max skill range for spawned units. BIS_ACM is module name.


  [0, 0.6, BIS_ACM] call BIS_ACM_setSkillFunc;
<sqf>[0, 0.6, BIS_ACM] call BIS_ACM_setSkillFunc;</sqf>
 


== Ammunition count range ==
== Ammunition count range ==
You may define the ammunition count of spawned units by defining a range from which a random value is selected for each unit.
You may define the ammunition count of spawned units by defining a range from which a random value is selected for each unit.


  [<minimum | Scalar>, <maximum | Scalar>, <ACM reference | Object>] call BIS_ACM_setAmmoFunc;
<sqf>[minimum, maximum, module] call BIS_ACM_setAmmoFunc;</sqf>


* The ammo values should be Scalars between 0.0 and 1.0.
* ''minimum'': [[Number]] - 0..1
* ''maximum'': [[Number]] - 0..1
* ''module'': [[Object]]


'''Example:'''
'''Example:'''
Line 61: Line 71:
Amount of ammo spawned units possess. BIS_ACM is module name.
Amount of ammo spawned units possess. BIS_ACM is module name.


  [0.2, 0.5, BIS_ACM] call BIS_ACM_setAmmoFunc;
<sqf>[0.2, 0.5, BIS_ACM] call BIS_ACM_setAmmoFunc;</sqf>
 


== Group types ==
== Group types ==
By default the ACM will select group types from ''CfgGroups'', but you may want to use only a number of specific group types. You have the possibility of overriding the group type database with your own database, by using two functions.


  {{codecomment|//You can pass both actual CfgGroups Config entries or class name Strings.}}
By default the ACM will select group types from ''CfgGroups'', but you may want to use only a number of specific group types.
  [<ACM reference | Object>, <types | Array of Configs and / or Strings>] call BIS_ACM_addGroupClassesFunc;
You have the possibility of overriding the group type database with your own database, by using two functions.


  {{codecomment|//Passing an empty types Array will completely disable the custom database and switch back to the default.}}
<sqf>
  [<ACM reference | Object>, <types | Array of Configs and / or Strings>] call BIS_ACM_removeGroupClassesFunc;
// You can pass both actual CfgGroups Config entries or class name Strings.
[module, types] call BIS_ACM_addGroupClassesFunc;
</sqf>
* ''module'': [[Object]]
* ''types'': [[Array]] of [[Config]]s or [[Array]] of [[String]]s
 
<sqf>
// Passing an empty types Array will completely disable the custom database and switch back to the default.
[module, types] call BIS_ACM_removeGroupClassesFunc;
</sqf>


Useable group types: [[Ambient Combat Manager - Group types]]
Useable group types: [[Ambient Combat Manager - Group types]]
'''Example:'''
<sqf>[BIS_ACM, ["RU_InfSquad", "RU_InfSection_AA", "RU_SniperTeam", "RU_MechInfSquad_2"]] call BIS_ACM_addGroupClassesFunc;</sqf>


== Factions ==
== Factions ==
You are able to control which factions are spawned by the ACM.
You are able to control which factions are spawned by the ACM.


  {{codecomment|// ArmA 2 factions: "USMC", "CDF", "RU", "INS", "GUE"}}
// Arma 2 factions: "USMC", "CDF", "RU", "INS", "GUE"
  {{codecomment|// Operation Arrowhead factions: "BIS_US", "BIS_CZ", "BIS_GER", "BIS_TK", "BIS_TK_INS", "BIS_TK_GUE", "BIS_UN", "BIS_TK_CIV", "BIS_CIV_special"}}
// Operation Arrowhead factions: "BIS_US", "BIS_CZ", "BIS_GER", "BIS_TK", "BIS_TK_INS", "BIS_TK_GUE", "BIS_UN", "BIS_TK_CIV", "BIS_CIV_special"
  {{codecomment|// DLC/Reinforcements factions: "BIS_BAF", "PMC_BAF"}}
// DLC/Reinforcements factions: "BIS_BAF", "PMC_BAF", "BIS_CZ"
  [<factions | Array of Strings>, <ACM reference | Object>] call BIS_ACM_setFactionsFunc;
[factions, module] call BIS_ACM_setFactionsFunc;
* ''factions'': [[Array]] of [[String]]s
* ''module: [[Object]]


'''Example:'''
'''Example:'''
Line 86: Line 112:
Factions to be spawned. BIS_ACM is module name.
Factions to be spawned. BIS_ACM is module name.


  [["USMC", "INS", "CDF", "RU", "GUE"], BIS_ACM] call BIS_ACM_setFactionsFunc;
<sqf>[["USMC", "INS", "CDF", "RU", "GUE"], BIS_ACM] call BIS_ACM_setFactionsFunc;</sqf>
 


== Blacklisting areas ==
== Blacklisting areas ==
Certain areas of a map can be blacklisted as areas in which the ACM should not spawn units or place their waypoints (although their travel paths may cross these areas). There are a number of methods to define such areas.
 
Certain areas of a map can be blacklisted as areas in which the ACM should not spawn units or place their waypoints (although their travel paths may cross these areas).
There are a number of methods to define such areas.


=== By markers ===
=== By markers ===
You may place markers with a special naming pattern ''BIS_ACM_X'' (where X has to start at 1 and may not skip any numbers). The areas defined by these markers are automatically blacklisted and the markers deleted.


''needs confirmation'': Please note that the area defined by those markers is ignored. BIS_ACM_1 defines the top left and BIS_ACM_2 the lower right corner of an rectangle, which forms the blacklisted area. BIS_ACM_3 and BIS_ACM_4 and so on behave exactly the same.
You may place markers with a special naming pattern ''BIS_ACM_X'' (where X has to start at 1 and may not skip any numbers).
The areas defined by these markers are automatically blacklisted and the markers deleted.


=== By function ===


=== By function ===
<sqf>
  {{codecomment|//When passing Arrays, these should contain the top-left and bottom-right coordinates.}}
// When passing Arrays, these should contain the top-left and bottom-right coordinates.
  [<ACM reference | Object>, <types | Array of Arrays and / or Markers and / or triggers>] call BIS_ACM_blacklistAreaFunc;
[module, blacklist] call BIS_ACM_blacklistAreaFunc;
 
</sqf>
  // Example 1: Adding a marker area to ACM called "BIS_ACM" with name "marker_1":
 
  [BIS_ACM, [marker_1]] call BIS_ACM_blacklistAreaFunc;
* module: [[Object]]
 
* blacklist: [[Array]] of [[Array]]s ([[Position]]) / [[String]]s (markers) / [[Object]]s (triggers)
  // Example 2: Adding two marker areas to ACM called "BIS_ACM" with names "marker_1" and "marker_2":
 
  [BIS_ACM, [marker_1, marker_2]] call BIS_ACM_blacklistAreaFunc;
'''Examples:'''
 
 
  // Example 3: Add area by markers coordinates:
<sqf>
  [BIS_ACM, [[getMarkerPos "marker_tl1",getMarkerPos "marker_lr1"]] call BIS_ACM_blacklistAreaFunc;  
[BIS_ACM, ["marker_1"]] call BIS_ACM_blacklistAreaFunc;
 
 
  // Example 4: Add two areas by markers coordinates:
// Example 2: Adding two marker areas to ACM called "BIS_ACM" with names "marker_1" and "marker_2":
  [BIS_ACM, [[getMarkerPos "marker_tl1",getMarkerPos "marker_lr1"],[getMarkerPos "marker_tl2",getMarkerPos "marker_lr2"]] call BIS_ACM_blacklistAreaFunc; 
[BIS_ACM, ["marker_1", "marker_2"]] call BIS_ACM_blacklistAreaFunc;
 
</sqf>
  // Example 5: Adding box coordinates to ACM called "BIS_ACM" (tl_x = top left x and so on):
<!--
  [BIS_ACM, [[[tl_x, tl_y, tl_z],[lr_x, lr_y, lr_z]]] call BIS_ACM_blacklistAreaFunc;
''ToDo: working examples for adding coordinates (via getMarkerPos for example)''
 
-->
  // Example 6: Add two areas by box coordinates:
  [BIS_ACM, [[[tl1_x, tl1_y, tl1_z],[lr1_x, lr1_y, lr1_z]],[[tl2_x, tl2_y, tl2_z],[lr2_x, lr2_y, lr2_z]]] call BIS_ACM_blacklistAreaFunc;
 


''Note: The examples need confirmation. Please pay special attention that the examples 1 and 2 (just using the markers defined area) are contrary to what was experienced at the "by Marker" section.


== Patrol types ==
== Patrol types ==
In some missions you may not want to use all patrol types, or use different chances for said patrol types. A custom pool of types and chances can be defined like so:
In some missions you may not want to use all patrol types, or use different chances for said patrol types. A custom pool of types and chances can be defined like so:


  {{codecomment|/*type must be one of "", "ground_patrol", "air_patrol".}}
<sqf>
  {{codecomment|Passing an empty type will reset back to the default pool.}}
/*
  {{codecomment|Weights should normally be between 0 and 1.}}
type must be one of "", "ground_patrol", "air_patrol".
  {{codecomment|A weight of -1 will remove that patrol type from the pool.*/}}
Passing an empty type will reset back to the default pool.
  [<type | String>, <weight / chance | Scalar>, <ACM reference | Object>] call BIS_ACM_setTypeChanceFunc;
Weights should normally be between 0 and 1.
A weight of -1 will remove that patrol type from the pool.
*/
[type, change, module] call BIS_ACM_setTypeChanceFunc;
</sqf>


'''Example:'''
'''Example:'''


Type of patrol. With 0 meaning no chance of appearing, and 1 meaning 100% chance. -1 removes patrol type completely. BIS_ACM is module name.
Type of patrol. With 0 meaning no chance of appearing, and 1 meaning 100% chance. -1 removes patrol type completely. BIS_ACM is module name.
<sqf>
["ground_patrol", 1, BIS_ACM] call BIS_ACM_setTypeChanceFunc;
["air_patrol", 1, BIS_ACM] call BIS_ACM_setTypeChanceFunc;
</sqf>


  ["ground_patrol", 1, BIS_ACM] call BIS_ACM_setTypeChanceFunc;
For further discussion on the ACM: {{Link|https://forums.bohemia.net/forums/topic/72262-ambient-combat-module/|Official Forums thread}}.
  ["air_patrol", 1, BIS_ACM] call BIS_ACM_setTypeChanceFunc;




For further discussion on the ACM: [http://forums.bistudio.com/showthread.php?t=73393].
{{GameCategory|arma2|Editing}}
{{GameCategory|arma2|Editor Modules}}

Latest revision as of 12:15, 4 November 2024

This page describes all pre-defined functions available to manipulate the settings of an Ambient Combat Manager (ACM).


Intensity

Not all missions require heavy enemy / friendly presence. The ACM's intensity controls how many patrols can be active at a given time and how frequently patrols are spawned. The intensity can be controlled by using the following function call:

[intensity, module] call BIS_ACM_setIntensityFunc;

  • intensity: Number - a Number between 0.0 and 2.0. 2.0 is the maximum intensity and 0.0 will in effect pause the ACM.
  • module: Object - a reference to the ACM module itself, or a reference to any unit in the group the ACM is synchronized to.

Example:

Sets frequency and number of patrols (values 0-1). BIS_ACM is module name.

Spawning distances

It is possible to control the minimum and maximum distance from the group leader at which enemies will be spawned. Be careful not to spawn too close, since it will be obvious to human players.

[module, minimum, maximum] call BIS_ACM_setSpawnDistanceFunc;

  • Distances with the value -1 will leave the distance as it was.
  • Distances with a value below -1 will reset to their defaults.
  • The default values are 500 meters (minimum) and 1000 meters (maximum).
  • Air patrols are currently excluded from these distances, since they generally require a much large area and they are not spawned on the ground.

Example:

Min & Max spawn distances included. BIS_ACM is module name.

[BIS_ACM, 100, 500] call BIS_ACM_setSpawnDistanceFunc;


Skill range

You can control the skill levels of spawned units by defining a range from which a random value is selected for each unit. If you want a very specific value, simply make a range with both minimum and maximum set to that value.

[minimum, maximum, module] call BIS_ACM_setSkillFunc;

Example:

Min & Max skill range for spawned units. BIS_ACM is module name.

[0, 0.6, BIS_ACM] call BIS_ACM_setSkillFunc;


Ammunition count range

You may define the ammunition count of spawned units by defining a range from which a random value is selected for each unit.

[minimum, maximum, module] call BIS_ACM_setAmmoFunc;

Example:

Amount of ammo spawned units possess. BIS_ACM is module name.

[0.2, 0.5, BIS_ACM] call BIS_ACM_setAmmoFunc;


Group types

By default the ACM will select group types from CfgGroups, but you may want to use only a number of specific group types. You have the possibility of overriding the group type database with your own database, by using two functions.

// You can pass both actual CfgGroups Config entries or class name Strings. [module, types] call BIS_ACM_addGroupClassesFunc;

// Passing an empty types Array will completely disable the custom database and switch back to the default. [module, types] call BIS_ACM_removeGroupClassesFunc;

Useable group types: Ambient Combat Manager - Group types

Example:

[BIS_ACM, ["RU_InfSquad", "RU_InfSection_AA", "RU_SniperTeam", "RU_MechInfSquad_2"]] call BIS_ACM_addGroupClassesFunc;


Factions

You are able to control which factions are spawned by the ACM.

// Arma 2 factions: "USMC", "CDF", "RU", "INS", "GUE" // Operation Arrowhead factions: "BIS_US", "BIS_CZ", "BIS_GER", "BIS_TK", "BIS_TK_INS", "BIS_TK_GUE", "BIS_UN", "BIS_TK_CIV", "BIS_CIV_special" // DLC/Reinforcements factions: "BIS_BAF", "PMC_BAF", "BIS_CZ" [factions, module] call BIS_ACM_setFactionsFunc;

Example:

Factions to be spawned. BIS_ACM is module name.

[["USMC", "INS", "CDF", "RU", "GUE"], BIS_ACM] call BIS_ACM_setFactionsFunc;


Blacklisting areas

Certain areas of a map can be blacklisted as areas in which the ACM should not spawn units or place their waypoints (although their travel paths may cross these areas). There are a number of methods to define such areas.

By markers

You may place markers with a special naming pattern BIS_ACM_X (where X has to start at 1 and may not skip any numbers). The areas defined by these markers are automatically blacklisted and the markers deleted.

By function

// When passing Arrays, these should contain the top-left and bottom-right coordinates. [module, blacklist] call BIS_ACM_blacklistAreaFunc;

Examples:

[BIS_ACM, ["marker_1"]] call BIS_ACM_blacklistAreaFunc; // Example 2: Adding two marker areas to ACM called "BIS_ACM" with names "marker_1" and "marker_2": [BIS_ACM, ["marker_1", "marker_2"]] call BIS_ACM_blacklistAreaFunc;


Patrol types

In some missions you may not want to use all patrol types, or use different chances for said patrol types. A custom pool of types and chances can be defined like so:

/* type must be one of "", "ground_patrol", "air_patrol". Passing an empty type will reset back to the default pool. Weights should normally be between 0 and 1. A weight of -1 will remove that patrol type from the pool. */ [type, change, module] call BIS_ACM_setTypeChanceFunc;

Example:

Type of patrol. With 0 meaning no chance of appearing, and 1 meaning 100% chance. -1 removes patrol type completely. BIS_ACM is module name.

["ground_patrol", 1, BIS_ACM] call BIS_ACM_setTypeChanceFunc; ["air_patrol", 1, BIS_ACM] call BIS_ACM_setTypeChanceFunc;


For further discussion on the ACM: Official Forums thread.