droidCanReach()

(info) Other great resources: Official JS API docs, Scripting Forum

droidCanReach()

Find out if a specific droid can reach a specific location from it's current location...

 

Syntax

var returnValue = droidCanReach(droid, x, y);

Parameters

Parameter

Type

Mandatory

Notes

Game version

Parameter

Type

Mandatory

Notes

Game version

droid

Droid object

An object representing the droid that will be travelling to x,y

3.1 Beta 1

x

Number

The x co-ordinate of the destination

3.1 Beta 1

y

Number

The y co-ordinate of the destination

3.1 Beta 1

Return value

Value

Type

Notes

Game version

Value

Type

Notes

Game version

true

Boolean

From its current location, the droid can reach x,y

3.1 Beta 1

false

Boolean

The droid is unable to reach x,y from its current position

3.1 Beta 1

<error>

Error

Invalid parameters or droid not found.

3.1 Beta 1

Notes

Some other functions already include this check – such as pickStructLocation() and orderDroidLoc().

The function ignores player built structures (tank traps, walls, etc) and features (trees, skyscrapers, etc). The assumption is that you'll blow them up on the way to your destination.

In Warzone 3.1 RC3 and earlier, droids will not automatically shoot at obstacles that block their route. In Warzone 3.1.0 and above, they will shot at blocking obstacles.

Example

if ( droidCanReach(droid, x, y) ) { // do stuff }