SC2Mapster.com Wiki

UnitGroupCount

void UnitGroupAdd(unitgroup g, unit u)

Add the unit to the unit group.

Parameters

unitgroup g

The group to receive the unit.

int mode
  • null: Do nothing
  • A unit: Add the unit to the group

Examples

Example #1: Empty Group
// Create an empty group
unitgroup UnitGroupEmpty() {
  return UnitGroup(null, -1, RegionCircle(null, 0), null, 0);
}
Example #2: Recode Unit Group Copy
unitgroup UnitGroupCopy(unitgroup old_group) {
  unitgroup new_group = UnitGroupEmpty();
  int 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 22, 2010

Authors