Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Excerpt

Add

...

most objects within an area of the map to a group.

...

.

...

Also, some specific types of droid won't be added to the group:

...

This is really useful because it means you can find the location of a commander/transporter then calculate an area around them, grab all droids in that area and assign them to a commander or embark them on a transport, etc.

Availability

Warzone 3.1 Beta 1 and above.

.

 

Syntax

Code Block
theme

...

RDark
languagejavascript
linenumberstrue
groupAddArea(group, x1, y1, x2, y2);

Parameters

ParameterTypeMandatoryDescriptionGame version
groupNumber(tick)

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
x1Number(tick)The x co-ordinate of the top-left corner3.1 Beta 1
y1Number(tick)The y co-ordinate of the top-left corner3.1 Beta 1
x2Number(tick)The x co-ordinate of the bottom-right corner3.1 Beta 1
y2Number(tick)The y co-ordinate of the bottom-right corner3.1 Beta 1

Return value

ValueTypeDescriptionGame version
undefinedUndefinedThe droids, if any, were added to the group3.1 Beta 1
<error>ErrorEither 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
theme

...

RDark
languagejavascript
title

...

Add all droids within 20 tiles of my base to a group...
linenumberstrue

...

var basePos = startPositions[playerData[me].position];
 
var 

...

baseGroup = newGroup();

...

See Also

...

 
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
classbox
Availability
Status
colourGreen
title3.1 b1+

Requires:

  • Warzone 3.1 Beta 1 or above
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Include Page
.jslinks-groups
.jslinks-groups