All resources in GameMaker Studio 2 have a unique identifying number, and the path_index is a read-only variable that holds the index value for a given path resource. If the instance has no path assigned, the variable will be set to -1.
path_index;
integer (Path ID)
if path_index = -1
{
path_start(pth_enemy3, 4,
path_action_reverse, 0);
}
The above code checks to see if a path has been assigned to the instance, and if not it starts a new path (assigning it to the path_index at the same time).