• Reference
  • LUA API
  • Classes
  • Unit Group

Unit group

Unit Group allows you to put multiple units in a group for uniform processing.

Functions

pick_unit_in_unit_group_to_perform_action

Iterate through the units in a unit group to perform an action.

unit_group:pick_unit_in_unit_group_to_perform_action()

select_unit_by_unit_group

Select units by unit group.

unit_group:select_unit_by_unit_group()

add_unit

Add a unit.

Parameter

VariableTypeDescription
unitunitUnit.
unit_group:add_unit(unit)

remove_unit

Remove a unit.

Parameter

VariableTypeDescription
unitunitUnit.
unit_group:remove_unit(unit)

remove_unit_type

Remove unit type.

Parameter

VariableTypeDescription
unit_idintegerUnit type ID.
unit_group:remove_unit_type(unit_id)

integer_random_units_from_unit_group

Random integer units from a unit group

Return

TypeDescription
unit_groupRandom integer units.
unit_group:integer_random_units_from_unit_group(count)

number_of_units_in_unit_group

Get the number of units in a unit group.

Return

TypeDescription
integerNumber of units.
unit_group:number_of_units_in_unit_group()

get_number_of_units_of_specified_type_in_unit_group

Number of unit types in a unit group.

Return

TypeDescription
integerNumber of unit types.
unit_group:get_number_of_units_of_specified_type_in_unit_group(unit_id)

get_the_first_unit_in_a_unit_group

Get the first unit in a unit group.

Return

TypeDescription
unitFirst unit in a unit group.
unit_group:get_the_first_unit_in_a_unit_group()

get_random_unit_from_unit_group

Get a random unit from a unit group.

Return

TypeDescription
unitA random unit from a unit group.
unit_group:get_random_unit_from_unit_group()

get_last_unit_in_unit_group

Get the last unit in a unit group.

Return

TypeDescription
unitA random unit in the unit group.
unit_group:get_last_unit_in_unit_group()

get_number_of_units_in_specified_state_in_unit_group

The number of units in a state in a unit group.

Return

TypeDescription
integer
unit_group:get_number_of_units_in_specified_state_in_unit_group()

filter_unit_in_area

Filter all units in the range.

Parameters

Return

TypeDescription
unit_groupAll units in range.
unit_group.filter_unit_in_area(point, shape, owner_player, visible_player, invisible_player, not_in_unit_group, has_tag,

unit_of_a_specified_unit_type

Unit of a specified unit type.

Parameter

VariableTypeDescription
unit_idintegerUnit type ID.

Return

TypeDescription
unit_groupUnit group.
unit_group.unit_of_a_specified_unit_type(unit_id)