(info) Other great resources: Official JS API docs, Scripting Forum

groupSize()

Find out how many droids there are in a specific group...

 

Syntax

var size = groupSize(groupID);

Parameters

ParameterTypeMandatoryDescriptionGame version
groupIDNumber(tick)

The ID of the droid group.

This ID is generated when you create a new group using newGroup().

3.1 Beta 1

Return value

ValueTypeDescriptionGame verison
<size>NumberThe number of droids in the group.

3.1 Beta 1

Buggy in 3.1.0

<error>ErrorThe group did not exist.3.1 Beta 1

Notes

In Warzone 3.1.0 release, there is a bug that can cause groupSize(group) to return a value of enumGroup(group).length+1.

Read important notes about changes to groups in Warzone 3.2.

Example

Output number of droids in a group
var myGroup = newGroup();
 
function eventDroidBuilt(droid, structure) {
  groupAddDroid(myGroup,droid);
 
  // output size of group to console
  console(groupSize(myGroup));
 
  // using groupSize() is much faster than doing this:
  console(enumGroup(myGroup).length); // same thing, but much slower
}

 

 

In Warzone 3.2, a new groupSizes[] global array allows iteration though groups and sizes.
Availability 3.1 B1+

Requires:

  • Warzone 3.1 Beta 1 and above.
  • Buggy in 3.1.0 (see notes section)
Contents

Jump to:

Scripting: Groups

Related Objects:

 Create them:

  • newGroup() – create a new group
  • WZ 3.2+ – add to a group that doesn't exist yet
  • labels.ini – group map-placed objects

Add things to them:

Remove things from them:

  • Put them in some other group

Count objects in them:

List them:

Retrieve their objects:

Monitor them:

Remove them:

  • not currently possible