o = MapNpc(y, x).y * (MAX_MAPX + 1) + MapNpc(y, x).x
d = GetPlayerY(Target) * (MAX_MAPX + 1) + GetPlayerX(Target)
For I = 0 To NV
Marked(I) = 0
PathLine(I) = -1
Path(I) = -1
Next I
For I = 0 To NV
VY = Int(I / (MAX_MAPX + 1))
VX = I Mod (MAX_MAPX + 1)
If VX >= 0 And VX < MAX_MAPX Then Mat(I, I + 1) = 1
If VX > 0 And VX <= MAX_MAPX Then Mat(I, I - 1) = 1
If VY >= 0 And VY < MAX_MAPY Then Mat(I, I + MAX_MAPX + 1) = 1
If VY > 0 And VY <= MAX_MAPY Then Mat(I, I - MAX_MAPX - 1) = 1
Next I