Other great resources: Official JS API docs, Scripting Forum

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Overview

Determine if, based on the script player's current knowledge of the map, whether a specific map location is safe or not.

Because this function is based on knowledge of the map, any enemy droids/structures that are in the fog of war (or otherwise not visible to your sensors - eg. ECM in effect) will not be checked, so use this with care. In other words, what looks like a safe place to your sensors might be a very dangerous place.

Syntax

var returnValue = safeDest(player,x,y);

Parameters

ParameterTypeMandatoryDescription
playerNumber(tick)The id of the player who's safety you care about (usually me)
xNumber(tick)The x co-ordinate of the position on the map to check
yNumber(tick)The y co-ordinate of the position on the map to check

Return value

ValueTypeDescription
trueBooleanThe position appears safe, according to your sensors.
falseBooleanThe position is not safe.
<error>ErrorThe player specified did not exist or the position specified was not on the map.

Example

// assuming "oil" is a feature object representing an oil resource...
if (safeDest(me,oil.x,oil.y)) {
  // build oil derrick
}

See also

 

  • No labels