Overview
Find out if a specific droid can reach a specific location (from the droid's current location).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: 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.
Availability
Warzone 3.1 Beta 1 and above.
Syntax
var returnValue = droidCanReach(droid,x,y);
Parameters
Parameter | Type | Mandatory | Description | 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 | Description | 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 |
Example
if (droidCanReach(droid,x,y)) { // do stuff }
See also
- distBetweenTwoPoints() – calculate straight-line distance between two points on the map