Okay now I got nodes set up but it still doesn't work. The object that is supossed to move stays on one waypoint and can't find the node to go to.
Function WP_Setup(Amount)
Global TotalWP as integer = Amount
Global Dim Waypoint(TotalWP) as Waypoint
Global Dim WPDist(TotalWP,TotalWP)
Global Dim WPCon(TotalWP,4)
Global Priority as integer
Global WPSolution as integer = 0
Endfunction
Function WP_MakeWaypoint(Waypoint,Xpos#,Ypos#,Zpos#)
Waypoint(Waypoint).WPNum=Waypoint
Waypoint(Waypoint).X=Xpos#
Waypoint(Waypoint).Y=Ypos#
Waypoint(Waypoint).Z=Zpos#
Waypoint(Waypoint).Order=1
ENDFUNCTION
Function WP_ConnectWaypoints(WP1,WP2)
Node=1
While WPCon(WP1,Node)>0
inc Node
ENDWHILE
WPCon(WP1,Node)=WP2
Node=1
While WPCon(WP2,Node)>0
inc Node
ENDWHILE
WPCon(WP2,Node)=WP1
ENDFUNCTION
Function WP_MoveObjToObj(obj,obj2,Speed#)
For Waypoint = 1 to TotalWP
Waypoint(Waypoint).O_WPX=Abs(Object Position X(obj)-Waypoint(Waypoint).X)
Waypoint(Waypoint).O_WPY=Abs(Object Position Y(obj)-Waypoint(Waypoint).Y)
Waypoint(Waypoint).O_WPZ=Abs(Object Position Z(obj)-Waypoint(Waypoint).Z)
Waypoint(Waypoint).O2_WPX=Abs(Object Position X(obj2)-Waypoint(Waypoint).X)
Waypoint(Waypoint).O2_WPY=Abs(Object Position Y(obj2)-Waypoint(Waypoint).Y)
Waypoint(Waypoint).O2_WPZ=Abs(Object Position Z(obj2)-Waypoint(Waypoint).Z)
Waypoint(Waypoint).O_WPDist=sqrt((Waypoint(Waypoint).O_WPX^2)+(Waypoint(Waypoint).O_WPZ^2))
Waypoint(Waypoint).O2_WPDist=sqrt((Waypoint(Waypoint).O2_WPX^2)+(Waypoint(Waypoint).O2_WPZ^2))
Waypoint(Waypoint).DistTotal=Waypoint(Waypoint).O_WPDist+Waypoint(Waypoint).O2_WpDist
If Waypoint(Waypoint).O_WPDist<0.1 then AtPosition=1 else AtPosition=0
Next Waypoint
If AtPosition=1 then Priority=Node_Dest()
Point object obj,Waypoint(Priority).X,Waypoint(Priority).Y,Waypoint(Priority).Z
move object obj,speed#
ENDFUNCTION
Function Waypoint_Pos()
dim Dist(TotalWP+1)
dim DistOrg(TotalWP+1)
For WP = 1 to TotalWP
Dist(WP)=Waypoint(WP).O_WPDist
DistOrg(WP)=Waypoint(WP).O_WPDist
Next WP
For Redo=1 to TotalWP+(TotalWP-1)
For WP=1 to TotalWP
If (WP+1)<TotalWP+1
If Dist(WP)>Dist(WP+1)
Temp=Dist(WP+1)
Dist(WP+1)=Dist(WP)
Dist(WP)=Temp
endif
endif
NEXT WP
NEXT Redo
For WP = 1 to TotalWP
if DistOrg(WP)=Dist(1) then WPPos=WP
Next WP
WaypointToObjectPos=WPPos
endfunction WaypointToObjectPos
Function Node_Dest()
WP=Waypoint_Pos()
dim Dist(5)
dim DistOrg(5)
For Node = 1 to 4
If WPCon(WP,Node)>0
Dist(Node)=Waypoint(WPCon(WP,Node)).O2_WPDist
DistOrg(Node)=Dist(Node)
endif
Next Node
For Redo=1 to 7
For Node=1 to 4
If (Node+1)<5
If Dist(Node)>Dist(Node+1)
Temp=Dist(Node+1)
Dist(Node+1)=Dist(Node)
Dist(Node)=Temp
endif
endif
NEXT Node
NEXT Redo
If Dist(1)=0
Dist(1)=Dist(2)
If Dist(2)=0
Dist(1)=Dist(3)
If Dist(3)=0
Dist(1)=Dist(4)
endif
endif
ENDIF
For Node = 1 to 4
if DistOrg(Node)=Dist(1) then NodeDest=Node
Next Node
NodeToObjectDest=WPCon(Waypoint_Pos(),NodeDest)
endfunction NodeToObjectDest
If it hasn't exploded yet, I haven't touched it.