Well. I guess it crashed on you so try this end code. Also // out object nav2. Changed the code, this should work.
//objective mobj_Defend
//hidden: false;
//type: MOBJ_Primary;
//text: 1;
//status: MOBJ_Incomplete;
//counter: false;
//end;
function M_Nav1;
var
setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Alpha1)) then begin
Nav_ActivateSelf;
SF_ActivateObject(Midway, 0);
SF_ActivateObject(Destoryer, 1);
SF_ActivateObject(Cruiser, 0);
while(1) do begin
AI_WaitSeconds(1);
until(m_AliveEnemies = 0) do
begin
AI_WaitSeconds(1);
end;
M_FSpawn(17,3,0,0,-134);
M_FSpawn(20,3,0,0,-120);
M_Spawn(2,15,2100,640,233);
M_Spawn(30,8,6650,640,233);
M_Spawn(11,6,6600,640,233);
setup := false;
end;
end;
//if(M_WaitUntilDead)
//then
//SF_ObjectiveSetComplete(mobj_defend);
//SF_SetMissionSuccess;
//SF_Exit;
//end;
//end;
//end;
while(NAV_WithinSphere(Alpha1)) do begin
NAV_SetPlayerNav(2);
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
function M_Nav2;
var
setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Alpha1)) then begin
Nav_ActivateSelf;
M_Spawn(2,17,12000,1000,2330);
M_Spawn(30,10,11000,1200,2333);
end;
while(NAV_WithinSphere(Alpha1)) do begin
NAV_SetPlayerNav(1);
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
function MAIN;
begin
MS_RunSpaceFlight(0);
end;