coalition#

coalition provides functions for querying and manipulating coalitions, (sides) and the groups, static objects, and airbases that belong to them.

Functions#

coalition.addGroup(countryId, groupCategory, groupData)#

Dynamically spawns a new group belonging to countryId, of the given groupCategory (e.g. airplane, ground, ship), using the supplied group data table.

Note

Groups spawned dynamically via this function do not run through the Mission Editor’s late-activation/trigger pipeline; verify trigger and AI tasking interactions behave as expected for dynamically added groups in your DCS version.

Parameters:
  • countryId (number) – Country the group should belong to.

  • groupCategory (number) – Group category (see Group.Category).

  • groupData (table) – Group definition table, matching the Mission Editor’s group data structure.

Returns:

The newly created group.

Return type:

Group

coalition.addStaticObject(countryId, staticData)#

Dynamically spawns a new static object belonging to countryId.

Parameters:
  • countryId (number) – Country the static object should belong to.

  • staticData (table) – Static object definition table.

Returns:

The newly created static object.

Return type:

StaticObject

coalition.getGroups(coalitionId, groupCategory)#

Returns a table of groups belonging to the given coalition, optionally filtered by category.

Parameters:
  • coalitionId (number) – Coalition to query (see coalition.side).

  • groupCategory (number) – Optional category filter.

Returns:

Matching groups.

Return type:

table

coalition.getStaticObjects(coalitionId)#

Returns a table of static objects belonging to the given coalition.

Parameters:

coalitionId (number) – Coalition to query (see coalition.side).

Returns:

Matching static objects.

Return type:

table

coalition.getAirbases(coalitionId)#

Returns a table of airbases belonging to the given coalition.

Parameters:

coalitionId (number) – Coalition to query (see coalition.side).

Returns:

Matching airbases.

Return type:

table

coalition.getPlayers(coalitionId)#

Returns a table of units currently controlled by human players on the given coalition.

Parameters:

coalitionId (number) – Coalition to query (see coalition.side).

Returns:

Player-controlled units.

Return type:

table

coalition.getCountryCoalition(countryId)#

Returns the coalition ID that the given country belongs to in the current mission.

Parameters:

countryId (number) – Country to look up.

Returns:

Coalition ID.

Return type:

number

coalition.addRefPoint(coalitionId, refPointData)#

Adds a reference point (e.g. for artillery or bombing calculations) for the given coalition.

Parameters:
  • coalitionId (number) – Coalition to add the reference point to.

  • refPointData (table) – Reference point definition table.

coalition.getMainRefPoint(coalitionId)#

Returns the main reference point configured for the given coalition.

Parameters:

coalitionId (number) – Coalition to query.

Returns:

Main reference point table.

Return type:

table

Footnotes#

  • coalitionId values correspond to the coalition.side enumerator (NEUTRAL, RED, BLUE).

  • Objects created via coalition.addGroup/addStaticObject behave the same as objects placed in the Mission Editor once spawned.