Difference between revisions of "MIST getPathLength"

From DCS World Wiki - Hoggitworld.com
(Created page with "{{Mission Scripting |fName= mist.getPathLength| |vNum = Mist 4.5 |desc= Returns the distance of a given table of paths. If the optional cutoff distance is passed the functi...")
 
(No difference)

Latest revision as of 06:34, 2 November 2020


mist.getPathLength

Added with: Mist 4.5
Description
Returns the distance of a given table of paths. If the optional cutoff distance is passed the function will immediately return with the index nearest to where that distance is reached.

By default distance is calculated by "2d" distance, if the optional variable for topo is passed then 3d distance will be accounted for.

Syntax
number mist.getPathLength(table path , number cutoff ,boolean topo )
Valid Input Values:
{[1] = {x = 2300, y = 234526}, [2] = {x = 2300, y = -2352},[3] = {x = 35235, y = -564156},[4] = {x = 54, y = 48456456}, }
Return value:
number
Return example:
Usage Examples:
The following example uses land.finPathOnroads to get a path that a ground AI group could take between two points.
           local rPath = land.findPathOnRoads('roads', spawnPoint.x, spawnPoint.y, roadEnd.x, roadEnd.y)
           local length = mist.getPathLength(rPath)
Notes:
Related Functions
makeUnitTable, getRandPointInCircle, getRandomPointInZone, getRandomPointInPoly, isTerrainValid, terrainHeightDiff, getUnitsInZones, getUnitsInMovingZones, pointInPolygon, getUnitsInPolygon, getDeadMapObjsInZones, getDeadMapObjsInPolygonZone, getUnitsLOS, random, randomizeNumTable, getAvgPoint, getQFE, getWindBearingAndVel, getPathLength, getPathInSegments, getPointAtDistanceOnPath, projectPoint, getGroupsByAttribute, , getUnitsByAttribute, mapValue,

Scripting Engine

MIST Root Page