Page tree

Versions Compared

Key

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



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 from which the search
should start
  • starts.
  • costtypes: Array of String - Cost types to search for

(can be
  • . Can be:
    • "Avoid"
,
    • "AvoidBush"
,
    • "AvoidTree"
,
    • "Normal"
,
    • "Road"
,
    • "RoadForced"
,
    • "Space"
,
    • "SpaceBush"
,
    • "SpaceHardBush"
,
    • "SpaceRoad"
,
    • "SpaceTree"
or
    • "Water"
)
maximum
  • Maximum radius to check around
'
  • position
'
if given
  • If specified, restricted areas of this unit are also considered (optional).
Return Value:Position-2 -
nearest
Nearest position found. If no qualified position is found, an empty array is returned.

Examples

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

Additional Information

See also: cost, assignAsRestrictedArea
Multiplayer: 
Problems: 

Notes