Home API Manuals About Forum
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

GetPathArray3D

Calculates a 3D path from a start point to a destination point, taking Z-levels into account. Returns the path as an array of points.

AccuracyXY — horizontal approaching accuracy: 0 = exactly to the destination.

AccuracyZ — vertical approaching accuracy: 0 = exact Z match.

Run — affects stamina-based pathfinding calculations.

Рассчитывает 3D-путь от начальной точки до конечной с учётом уровней Z. Возвращает путь в виде массива точек.

AccuracyXY — горизонтальная точность приближения: 0 = точно в точку назначения.

AccuracyZ — вертикальная точность приближения: 0 = точное совпадение по Z.

Run — влияет на расчёты пути с учётом расхода выносливости.

DWS

function GetPathArray3D(StartX: Word; StartY: Word; StartZ: ShortInt;
  FinishX: Word; FinishY: Word; FinishZ: ShortInt; WorldNum: Byte;
  AccuracyXY: Integer; AccuracyZ: Integer; Run: Boolean): TPathArray;

DWS overload (legacy, returns count):

function GetPathArray3D(StartX: Word; StartY: Word; StartZ: ShortInt;
  FinishX: Word; FinishY: Word; FinishZ: ShortInt; WorldNum: Byte;
  AccuracyXY: Integer; AccuracyZ: Integer; Run: Boolean;
  var PathArray: TPathArray): Integer;

Pascal Script

function GetPathArray3D(StartX: Word; StartY: Word; StartZ: ShortInt;
  FinishX: Word; FinishY: Word; FinishZ: ShortInt; WorldNum: Byte;
  AccuracyXY: Integer; AccuracyZ: Integer; Run: Boolean;
  var PathArray: TPathArray): Integer;

Type definitions:

TMyPoint = packed record
  X: Word;
  Y: Word;
  Z: ShortInt;
end;

// Pascal Script
TPathArray = array[0..999] of TMyPoint;

// DWS
TPathArray = TArray<TMyPoint>;

Notes:

  • In Pascal Script, TPathArray is a fixed-size array of 1000 elements.
  • In DWS, TPathArray is a dynamic array (TArray<TMyPoint>).

Python

def GetPathArray3D(StartX: int, StartY: int, StartZ: int, FinishX: int, FinishY: int,
                   FinishZ: int, WorldNum: int, AccuracyXY: int, AccuracyZ: int,
                   Run: bool) -> list[WorldPoint]: ...

Pascal Example

var
  Path: TPathArray;
  i, Count: Integer;
begin
  Count := GetPathArray3D(1000, 1000, 0, 1010, 1010, 0, WorldNum, 0, 0, False, Path);
  AddToSystemJournal('Path length: ' + IntToStr(Count));

  for i := 0 to Count - 1 do
    AddToSystemJournal(
      'Step ' + IntToStr(i) + ': X=' + IntToStr(Path[i].X) +
      ' Y=' + IntToStr(Path[i].Y) +
      ' Z=' + IntToStr(Path[i].Z)
    );
end.

Python Example

path = GetPathArray3D(1000, 1000, 0, 1010, 1010, 0, WorldNum(), 0, 0, False)
AddToSystemJournal(f'Path length: {len(path)}')

for i, p in enumerate(path):
    AddToSystemJournal(f'Step {i}: X={p.X} Y={p.Y} Z={p.Z}')

See Also

GetPathArray, MoveXYZ, IsWorldCellPassable