Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.31

Description

Description:Returns the center position of the nearest cost field, of the given cost.

Syntax

Syntax:nearestCostPosition [position, costtypes, radius, unit]
Parameters:
  • position: Position-2 - Position from which the search starts.
  • costtypes: Array of String - Cost types to search for. Can be:
    • "Avoid"
    • "AvoidBush"
    • "AvoidTree"
    • "Normal"
    • "Road"
    • "RoadForced"
    • "Space"
    • "SpaceBush"
    • "SpaceHardBush"
    • "SpaceRoad"
    • "SpaceTree"
    • "Water".
  • radius: Number - Maximum radius to check around position
  • unit: Object - If specified, restricted areas of this unit are also considered (optional).
Return Value:Position-2 - Nearest position found. If no qualified position is found, an empty array is returned.

Examples

Examples:
nearestCostPosition [getpos person1, ["Normal", "Space"], 20, person2] // Looks for nearest fields with costs of "Normal" or "Space" 20 meters around unit person1, and takes also restricted areas of unit person2 into account.

Additional Information

See also: cost, assignAsRestrictedArea
Multiplayer: 
Problems: 

Notes