- procedure MoveNPCtoWaypoint(NPC_ID : Integer);
- var Rotation, Hypotenuse,Ankathete, Gegenkathete, sinus : double;
- begin
- GegenKathete := NPC.PositionX[NPC_ID] - Patrols.PositionX;
- Ankathete := NPC.PositionZ[NPC_ID] - Patrols.PositionZ;
- if GegenKathete < 0 then GegenKathete := GegenKathete *-1;
- if Ankathete < 0 then Ankathete := Ankathete *-1;
- Hypotenuse := sqrt((Ankathete*Ankathete) + (Gegenkathete*Gegenkathete));
- sinus := Gegenkathete/Hypotenuse;
- //Rotation :=
- if NPC.Rotation[NPC_ID] <> Rotation then NPC.Rotation[NPC_ID] := NPC.Rotation[NPC_ID] + 0.1
- else begin
- NPC.PositionX[NPC_ID] := NPC.PositionX[NPC_ID] - (sin(degtorad(NPC.Rotation[NPC_ID])) * timefactor);
- NPC.PositionZ[NPC_ID] := NPC.PositionZ[NPC_ID] - (cos(degtorad(NPC.Rotation[NPC_ID])) * timefactor);
- end;
- end;