Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Add most objects within an area of the map to a group... |
Warning |
---|
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
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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:
This means that you can locate a commander or transport, and then grab all droids around it and assign them to the commander or embark them on a transport.
Example
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
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) ); |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Include Page | ||||
---|---|---|---|---|
|