Module UnitSet

Create and manage a set of units.

#UNITSET class

Mission designers can use the UNITSET class to build sets of units belonging to certain:

  • Coalitions
  • Categories
  • Countries
  • Unit types
  • Starting with certain prefix strings.

UNITSET construction methods:

Create a new UNITSET object with the UNITSET.New method:

UNITSET filter criteria:

You can set filter criteria to define the set of units within the UNITSET. Filter criteria are defined by:

Once the filter criteria have been set for the UNITSET, you can start filtering using:

Planned filter criteria within development are (so these are not yet available):

UNITSET iterators:

Once the filters have been defined and the UNITSET has been built, you can iterate the UNITSET with the available iterator methods. The iterator methods will walk the UNITSET set, and call for each element within the set a function that you provide. The following iterator methods are currently available within the UNITSET:

Planned iterators methods in development are (so these are not yet available):

Global(s)

UNITSET

Type UNITSET

UNITSET:AddInDatabase(Event)

Handles the Database to check on an event (birth) that the Object was added in the Database.

UNITSET.ClassName
UNITSET.Filter
UNITSET:FilterCategories(Categories)

Builds a set of units out of categories.

UNITSET:FilterCoalitions(Coalitions)

Builds a set of units of coalitions.

UNITSET:FilterCountries(Countries)

Builds a set of units of defined countries.

UNITSET.FilterMeta
UNITSET:FilterPrefixes(Prefixes)

Builds a set of units of defined unit prefixes.

UNITSET:FilterStart()

Starts the filtering.

UNITSET:FilterTypes(Types)

Builds a set of units of defined unit types.

UNITSET:FindInDatabase(Event)

Handles the Database to check on any event that Object exists in the Database.

UNITSET:FindUnit(UnitName)

Finds a Unit based on the Unit Name.

UNITSET:ForEachUnit(IteratorFunction, ...)

Interate the UNITSET and call an interator function for each alive UNIT, providing the UNIT and optional parameters.

UNITSET:IsIncludeObject(MUnit)
UNITSET:New()

Creates a new UNITSET object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

UNITSET.Units

Global(s)

#UNITSET UNITSET

Type UnitSet

Type UNITSET

UNITSET class

Field(s)

UNITSET:AddInDatabase(Event)

Handles the Database to check on an event (birth) that the Object was added in the Database.

This is required, because sometimes the _DATABASE birth event gets called later than the SET birth event!

Parameter

Return values

  1. #string: The name of the UNIT

  2. #table: The UNIT

#string UNITSET.ClassName
UNITSET.Filter
UNITSET:FilterCategories(Categories)

Builds a set of units out of categories.

Possible current categories are plane, helicopter, ground, ship.

Parameter

  • #string Categories : Can take the following values: "plane", "helicopter", "ground", "ship".

Return value

#UNITSET: self

UNITSET:FilterCoalitions(Coalitions)

Builds a set of units of coalitions.

Possible current coalitions are red, blue and neutral.

Parameter

  • #string Coalitions : Can take the following values: "red", "blue", "neutral".

Return value

#UNITSET: self

UNITSET:FilterCountries(Countries)

Builds a set of units of defined countries.

Possible current countries are those known within DCS world.

Parameter

  • #string Countries : Can take those country strings known within DCS world.

Return value

#UNITSET: self

UNITSET.FilterMeta
UNITSET:FilterPrefixes(Prefixes)

Builds a set of units of defined unit prefixes.

All the units starting with the given prefixes will be included within the set.

Parameter

  • #string Prefixes : The prefix of which the unit name starts with.

Return value

#UNITSET: self

UNITSET:FilterStart()

Starts the filtering.

Return value

#UNITSET: self

UNITSET:FilterTypes(Types)

Builds a set of units of defined unit types.

Possible current types are those types known within DCS world.

Parameter

  • #string Types : Can take those type strings known within DCS world.

Return value

#UNITSET: self

UNITSET:FindInDatabase(Event)

Handles the Database to check on any event that Object exists in the Database.

This is required, because sometimes the _DATABASE event gets called later than the SET event or vise versa!

Parameter

Return values

  1. #string: The name of the UNIT

  2. #table: The UNIT

UNITSET:FindUnit(UnitName)

Finds a Unit based on the Unit Name.

Parameter

  • #string UnitName :

Return value

Unit#UNIT: The found Unit.

UNITSET:ForEachUnit(IteratorFunction, ...)

Interate the UNITSET and call an interator function for each alive UNIT, providing the UNIT and optional parameters.

Parameters

  • #function IteratorFunction : The function that will be called when there is an alive UNIT in the UNITSET. The function needs to accept a UNIT parameter.

  • ... :

Return value

#UNITSET: self

UNITSET:IsIncludeObject(MUnit)

Parameter

Return value

#UNITSET: self

UNITSET:New()

Creates a new UNITSET object, building a set of units belonging to a coalitions, categories, countries, types or with defined prefix names.

Return value

#UNITSET:

Usage:

-- Define a new UNITSET Object. This DBObject will contain a reference to all alive Units.
DBObject = UNITSET:New()
UNITSET.Units