(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

ParameterTypeMandatoryNotesGame version
droidDroid object(tick)An object representing the droid that will be travelling to x,y3.1 Beta 1
xNumber(tick)The x co-ordinate of the destination3.1 Beta 1
yNumber(tick)The y co-ordinate of the destination3.1 Beta 1

Return value

ValueTypeNotesGame version
trueBooleanFrom its current location, the droid can reach x,y3.1 Beta 1
falseBooleanThe droid is unable to reach x,y from its current position3.1 Beta 1
<error>ErrorInvalid 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
}
Availability 3.1 B1+

Requires:

  • Warzone 3.1 Beta 1 and above.
Contents

Jump to:

See also

Related articles: