Allright!
this is my code which seems to work perfectly!! yeeeaaahhh!!!!
--------------------
// Mision 2
mission s1;
#SetOutputPath("$wcso$\mission\");
#include wcp, consts, pilots;
#strings targetid;
#AddToSearchPath ("$wcso$\language");
var aliensalive = 5;
function MAIN;
begin
MS_RunSpaceflight(0);
end;
object Alpha1(Player)
obj: panthrbl;
x: 250;
y: 500;
z: 0;
main: M_Alpha1;
//death: D_Alpha;
pilot: PILOT_Casey1;
end;
function M_Alpha1;
begin
SF_SetObjectFlag (OF_alignment,ALIGN_Confed); //sets the player to confed alligment
SF_ActivateSelf(0);
SF_PlayerSwitchToCam(CamID_cockpit, Alpha1);//Switch to player cockpit
while(1) do begin
AI_WaitSeconds(1);
end;
end;
object Midway(Capship)
obj: Midway;
x: 300;
y: -100;
z: 200;
main: M_Midway;
pilot: PILOT_TCS_Midway;
direction: 0, 0, 0;
targstr: targetid["Midway"];
end;
function M_Midway;
begin
SF_SetObjectFlag (OF_alignment,ALIGN_Confed); //sets the player to confed alligment
//SF_ActivateSelf(0);
AI_WaitUntilActive;
//SF_PlayerSwitchToCam(CamID_cockpit, Alpha1);//Switch to player cockpit
SF_BindToActionSphere(1);
while(1) do begin
AI_WaitSeconds(1);
end;
end;
object Nav1(Navpoint)
x:0;
y:0;
z:0;
main: M_Nav1;
navdata: 1, 1000;
end;
function M_Nav1;
var
setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Alpha1)) then begin
NAV_ActivateSelf;
if (setup) then begin
//**CODE TO BE PERFORMED ON FIRST ONLY TIME IN NAV**
SF_ActivateObject(Midway, 0);
setup := false;
end;
NAV_SetPlayerNav(2);
while(NAV_WithinSphere(Alpha1)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
end;
// NAV 2
function F_Spawn(shipid, count, x, y, z);
var ox,
oy,
oz;
//
// this function spawns "count" ships of type "shipID"
// at coordinates near the ox, oy, oz
//
begin
while(count > 0) do begin
ox := x + SYS_Random(2000) + 1000;
oy := y + SYS_Random(200) + 100;
oz := z + SYS_Random(2000) + 1000;
NAV_CreateShip(shipId, PILOT_Alien1, 0, @M_Spawn, @D_Spawn, ox, oy, oz);
count := count - 1;
end;
end;
function M_Spawn;
begin
SF_SetObjectFlag (OF_alignment,ALIGN_Alien); //sets the player to confed alligment
SF_ActivateSelf(0);
//SF_PlayerSwitchToCam(CamID_cockpit, Alpha1);//Switch to player cockpit
while(1) do begin
AI_WaitSeconds(1);
end;
end;
function D_Spawn;
begin
aliensalive := aliensalive - 1;
end;
function M_WaitUntilDead;
begin
while(aliensalive > 0) do begin
AI_WaitSeconds(1);
end;
end;
object Nav2(Navpoint)
x:50000;
y:50000;
z:0;
main: M_Nav2;
navdata: 2, 5000;
end;
function M_Nav2;
var
setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Alpha1)) then begin
NAV_ActivateSelf;
if (setup) then begin
//**CODE TO BE PERFORMED ON FIRST ONLY TIME IN NAV**
F_Spawn(2, 5, 49000, 51000, 100);
M_WaitUntilDead;
SF_SetMissionSuccess;
AI_WaitSeconds(5);
SF_Exit;
setup := false;
end;
NAV_SetPlayerNav(1);
while(NAV_WithinSphere(Alpha1)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
end;
-------------------------------------------------
Lemme know if there is anything which could be fixed (thought the mission works well).
Hey! If u need a hand at Standoff or UE2 and I can help, let me know!
Oh! and the problem I had with the Midway was that I placed the "SF_ActivateObject(Midway, 0);" line in the Midway's main function instead of the Nav point's one.
THANX A LOT FOR ALL THE HELP!