Other great resources: Official JS API docs, Scripting Forum

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

Get a list of game objects within a specific area of the map...

 

Syntax

The function has 3 different syntax options...
// syntax #1: specify co-ordinates of area
var results = enumArea( x1, y1, x2, y2[, filter[, seen]] );
 
// syntax #2: reference an AREA object by it's label
var results = enumArea( label[, filter[, seen]] );
 
// syntax #3: pass in an actual AREA object
var results = enumArea( areaObj[, filter[, seen]] );

Parameters

SyntaxParameter(s)TypeMandatoryNotesGame Version
#1x1, y1,
x2, y2
Numbers(tick)The co-ordinates of the top left corner (x1, y1) and bottom right corner (x2, y2) of the area to search.3.2
#2labelString(tick)The name of a label associated with an AREA object.3.2
#3areaObjArea object(tick)An Area object or something that has x, y, x2, y2 properties.3.2
Allfilter

Number

Constant

(error)

Optionally filter the list to a specific player (specify their player ID) or group of players (specify the Player Scope constant).

Player scopes supported:

  • ALLIESSend a chat message to your allies.
  • ALL_PLAYERSSend a chat message to all players.
  • ENEMIESFilter enumeration to enemy objects.

Default: ALL_PLAYERS

3.2
AllseenBoolean(error)

Should the list be filtered by objects I can see?

  • true – yes, filter to visible objects
  • false – no, return all objects

Default: true

3.2

Return values

ValueTypeNotesGame Version
<results>Array of Game objects

An array of objects matching the specified criteria.

Use the .type property of the objects in the array to determine what they are.

3.2
[]Empty ArrayIf no objects are found, an empty array is returned.3.2
<error>ErrorInvalid parameters specified, label not found or areaObj invalid.3.2

Notes

The results will include Feature objects unless you filter to ENEMIES or ALLIES.

Example

// Get a list of visible enemies within specified co-ordinates
var results = enumArea( 2, 3, 57, 42, ENEMIES );
 
// get a list of anything visible in a AREA labelled as "BASE_PERIMETER"
var results = enumArea( "BASE_PERIMETER" );
 
// get a list of all enemies within an area defined by an area object
var results = enumArea( {x:2, y:3, x2:57, y2:42, type:AREA}, ENEMIES, false );
Availability 3.2+

Requires:

  • Warzone 3.2 or above
Contents

Jump to:

See also

Related articles:

 

  • No labels