Versions Compared

Key

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

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

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
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

Code Block
themeRDark
languagejavascript
linenumberstrue
if ( droidCanReach(droid, x, y) ) {
  // do stuff
}
Div
classbox
Availability
Status
colourGreen
title3.1 b1+

Requires:

  • Warzone 3.1 Beta 1 and above.
Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles: