SC2Mapster.com Wiki

UnitGroupUnit

unit UnitGroupUnit(unitgroup g, int index)

nth unit from the unit group.

Parameters

unitgroup g

The group.

int index

nth unit of the group. Starting at 1.

Return value

unit -

  • 1 - Count: nth unit of the group.
  • 0 or out of bounds: null

Examples

Example: UnitGroupCopy2
unitgroup UnitGroupCopy2(unitgroup old_group) {
  unitgroup new_group;
  int count;

  // Fill this group with the units of the group u
  count = UnitGroupCount(old_group, c_unitCountAll);
  while (count > 0) {
    UnitGroupAdd(new_group, UnitGroupUnit(old_group, count));
    count -= 1;
  }

  return new_group;
}

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Mar 15, 2010
Last updated
Mar 18, 2010

Authors