Other great resources: Official JS API docs, Scripting Forum
groupAddArea()
- Aubergine
In need of technical review - looks like some stuff has changed in WZ 3.2.
Also, looks like the x,y params were world coords instead of tile coords in 3.1.0 and earlier.
Syntax
groupAddArea(group, x1, y1, x2, y2);
Parameters
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
group | Number | The ID of the group to add the objects to. If any of the objects are already in a group, they will be moved to this group and removed from their old group. | 3.1 Beta 1 | |
x1 | Number | The x co-ordinate of the top-left corner | 3.1 Beta 1 | |
y1 | Number | The y co-ordinate of the top-left corner | 3.1 Beta 1 | |
x2 | Number | The x co-ordinate of the bottom-right corner | 3.1 Beta 1 | |
y2 | Number | The y co-ordinate of the bottom-right corner | 3.1 Beta 1 |
Return value
Value | Type | Description | Game version |
---|---|---|---|
undefined | Undefined | The droids, if any, were added to the group | 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
This function will only add droids owned by the player your script is associated with ('me') to the group. (not sure if this is still true on WZ 3.2)
There are some types of droid which will not be added:
Example
var basePos = startPositions[playerData[me].position]; var baseGroup = newGroup(); groupAddArea( baseGroup, Math.max(basePos.x-20, 0), Math.max(basePos.y-20, 0), Math.min(basePos.x+20, mapWidth), math.min(basePos.y+20, mapHeight) );
Availability 3.1 B1+
Requires:
- Warzone 3.1 Beta 1 or above
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