Other great resources: Official JS API docs, Scripting Forum
groupAddDroid()
- Aubergine
Owned by Aubergine
Add a droid to an existing group...
Â
Syntax
groupAddDroid(group, droid);
Parameters
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
group | Number | The unique ID of the group. The ID is the return value of the newGroup() function called when creating the group. | 3.1 Beta 1 | |
droid | Droid object | A valid droid object. If it's already in a different group, it will be transferred in to this group. | 3.1 Beta 1 |
Return value
Value | Type | Description | Game version |
---|---|---|---|
undefined | Undefined | The droid was added to the group (or was already in it) | 3.1 Beta 1 |
<error> | Error | Either the group doesn't exist, you don't own the group, or you don't own the droid. | 3.1 Beta 1 |
Notes
Read important notes about changes to groups in Warzone 3.2.
Example
Add a droid to a group
var myGroup = newGroup(); Â function eventDroidBuilt(droid, structure) { groupAddDroid(myGroup,droid); // add shiny new droid to myGroup console(groupSize(myGroup)); }
Availability 3.1 B1→3.2.X
Requires:
- Warzone 3.1 Beta 1 → 3.2.x
- Deprecated by groupAdd(), but still available, in Warzone 3.2
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:
- groupAdd() – add any Game object
- groupAddDroid() – add a Droid object
- groupAddArea() – add Game objects within an area of the map
Remove things from them:
- Put them in some other group
Count objects in them:
- groupSize() – get number of items in a group
- groupSizes[] – iterate group sizes
List them:
- groupSizes[] – elements are group ids
- getObject() – retrieve a group by its label
Retrieve their objects:
- enumGroup() – retrieve objects in a group
Monitor them:
- eventGroupLoss() – triggers when an object is removed from a group
Remove them:
- not currently possible
Â