GetPathLength (deprecated)

Category: Landscape
Since engine version: 4.9.1.0 GWE

Description

Searches for a path from start point to end point using the pathfinding algorithm as used by clonks and returns the length of the found path. Returns 0 if no path was found.

Syntax

int GetPathLength (int iFromX, int iFromY, int iToX, int iToY);

Parameters

iFromX:
X coordinate of the starting position
iFromY:
Y coordinate of the starting position
iToX:
X coordinate of the end position
iToY:
Y coordinate of the end position

Remark

This function exists in order to preserve compatibility to older game content. You should use GetPath in newer scripts.

Example

var iDist = GetPathLength(GetX(), GetY(), GetX(FindBase(GetOwner())), GetY(FindBase(GetOwner())));
Determines the distance from an object to its closest friendly base
See also: GetPath
PeterW, April 2002