Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Overview

Excerpt

Find out if a specific droid can reach a specific location

...

from

...

it's current location

...

.

...

Image Removed

...

.

...

.

...

 

...

Availability

Warzone 3.1 Beta 1 and above.

Syntax

Code Block
theme

...

RDark
languagejavascript
linenumberstrue
var returnValue = droidCanReach(droid, x, y);

Image Added

Parameters

ParameterTypeMandatory

...

NotesGame 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

ValueType

...

NotesGame 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
theme

...

RDark
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: