Module Set

Manage sets of units and groups.

#Set class

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

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

This list will grow over time. Planned developments are to include filters and iterators. Additional filters will be added around Zone#ZONEs, Radiuses, Active players, ... More iterators will be implemented in the near future ...

Administers the Initial Sets of the Mission Templates as defined within the Mission Editor.

SET construction methods:

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

  • SET.New: Creates a new SET object.

SET filter criteria:

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

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

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

SET iterators:

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

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


Global(s)

SET

Type SET

SET.ClassName
SET.Database
SET:Flush()

Flushes the current SET contents in the log ...

SET:ForEach(IteratorFunction, arg, Set)

Interate the SET and call an interator function for the given set, providing the Object for each element within the set and optional parameters.

SET:IsIncludeObject(Object)

Decides whether to include the Object

SET:New(Database)

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

SET.Set
SET:_Add(ObjectName, Object)

Adds a Object based on the Object Name.

SET:_EventOnBirth(Event)

Handles the OnBirth event for the Set.

SET:_EventOnDeadOrCrash(Event)

Handles the OnDead or OnCrash event for alive units set.

SET:_FilterStart()

Starts the filtering for the defined collection.

SET:_Find(ObjectName)

Finds an Object based on the Object Name.

Global(s)

#SET SET

Type Set

Type SET

SET class

Field(s)

#string SET.ClassName
SET.Database
SET:Flush()

Flushes the current SET contents in the log ...

(for debug reasons).

Return value

#string: A string with the names of the objects.

SET:ForEach(IteratorFunction, arg, Set)

Interate the SET and call an interator function for the given set, providing the Object for each element within the set and optional parameters.

Parameters

  • #function IteratorFunction : The function that will be called when there is an alive player in the SET.

  • arg :

  • Set :

Return value

#SET: self

SET:IsIncludeObject(Object)

Decides whether to include the Object

Parameter

  • #table Object :

Return value

#SET: self

SET:New(Database)

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

Parameter

  • Database :

Return value

#SET:

Usage:

-- Define a new SET Object. This DBObject will contain a reference to all Group and Unit Templates defined within the ME and the DCSRTE.
DBObject = SET:New()
SET.Set
SET:_Add(ObjectName, Object)

Adds a Object based on the Object Name.

Parameters

  • #string ObjectName :

  • #table Object :

Return value

#table: The added Object.

SET:_EventOnBirth(Event)

Handles the OnBirth event for the Set.

Parameter

SET:_EventOnDeadOrCrash(Event)

Handles the OnDead or OnCrash event for alive units set.

Parameter

SET:_FilterStart()

Starts the filtering for the defined collection.

Return value

#SET: self

SET:_Find(ObjectName)

Finds an Object based on the Object Name.

Parameter

  • #string ObjectName :

Return value

#table: The Object found.