Versions Compared

Key

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

...

Some other functions already include this check - such as pickStructLocation() and orderDroidLoc(). However, it's still useful to do your own checks so you can choose a different target should the initial target be inaccessible.

Note(info) Note: The function ignores player built structures, such as tank traps and walls/gates. The assumption is that you'll blow them up on the way to your destination. (smile)

Availability

Warzone 3.1 Beta 1 and above.

Syntax

Code Block
themeEclipse
languagejavascript
linenumberstrue
var returnValue = droidCanReach(droid,x,y);

...

ParameterTypeMandatoryDescriptionGame 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

ValueTypeDescriptionGame 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

Example

Code Block
themeEclipse
languagejavascript
linenumberstrue
if (droidCanReach(droid,x,y)) {
  // do stuff
}

...