Gots another question about capital ships.
It's possible I know to have a ship be visible at all nav points. Discovered this on accident, forget some bit of code and you can always see your home carrier no matter which nav you are at.
Question is:
How do I set this for an enemy capital ship at say, Nav 4? So you can always see the carrier you launched from, and you can always see the "target" for example, that you are heading for.
Seems to me it'd be interesting for larger supposed fleet-to-fleet battles, or at least more anticipating to have it done that way.
Mission is:
Nav 1: Home Carriers, no enemy
Nav 2: Enemy Fighter Patrol
Nav 3: Enemy capital ships/Enemy fighters
Nav 4: Return home
GOAL: Eliminate Capital ships at Nav 3
The idea is to play a fighter pilot in a simple squad escorting some bombers. Haven't worked it all out yet. Code below:
((NOTE: Hellcat/Longbow models off of CIC SO ships database, Fralthi "barrowed" from UE ships...will return it when done.))
// Sim Mission 1 - Victory Test
mission s0;
#AddToSearchPath ("$wcso$"); // SO path
#AddToSearchPath("$wcso$\language\"); // SO /language path
#sector: "a.sec"; //sector file
#include wcp;
#include consts; //wcppas constants list
#include comms; //comms files
#include pilots; //pilots list
#include ships; //ships list
#strings spacefli;
#strings targetid;
#SetOutputPath ("$wcso$\mission\");
object Nav1(Navpoint) //navpoint
x: 500; // x coord
y: 200; // y coord
z: 1000; // z coord
main: M_NAV1; // navpoint main function
name: Spacefli["Nav 1"]; // points to a string on spacefli.eng
navdata: 1, 30000; // nav id, diameter
end;
object Nav2(Navpoint)
x: -1000;
y: 0;
z: 62000;
main: M_NAV2;
name: Spacefli["Nav 1"];
navdata: 2, 30000;
end;
object Nav3(Navpoint)
x: 80000;
y: 40000;
z: -62000;
main: M_NAV3;
name: Spacefli["Nav 2"];
navdata: 3, 30000;
end;
object Nav4(Navpoint)
x: 80000;
y: -20000;
z: -62000;
main: M_NAV4;
name: Spacefli["Nav 3"];
navdata: 4, 30000;
end;
object Wingman_1(Ship) //wingman
obj: hellcat; //wingman ship
x: 1400; // x coord
y: 1800; // y coord
z: 5000; // z coord
main: M_Wingman; // wingman main function
targstr: targetid["Alpha 2"]; // points to a string in targetid.eng
pilot: Pilot_Veil; // pilot
end; // end object function
object Wingman_2(Ship)
obj: hellcat;
x: 1400;
y: 1700;
z: 5000;
main: M_Wingman;
targstr: targetid["Alpha 3"];
pilot: Pilot_Foxtrot;
end;
object Wingman_3(Ship)
obj: hellcat;
x: 1400;
y: 1600;
z: 5000;
main: M_Wingman;
targstr: targetid["Alpha 4"];
pilot: Pilot_Maestro;
end;
object Wingman_11(Ship)
obj: hellcat;
x: 1400;
y: 1600;
z: 5000;
main: M_Wingman;
targstr: targetid["Bravo 1"];
pilot: Pilot_Maestro;
end;
object Wingman_4(Ship)
obj: hellcat;
x: 1400;
y: 1600;
z: 5000;
main: M_Wingman;
targstr: targetid["Bravo 2"];
pilot: Pilot_Maestro;
end;
object Wingman_7(Ship)
obj: longbow;
x: 1400;
y: 1600;
z: 5000;
main: M_Wingman;
targstr: targetid["Charlie 1"];
pilot: Pilot_Maestro;
end;
object Wingman_8(Ship)
obj: longbow;
x: 1400;
y: 1600;
z: 5000;
main: M_Wingman;
targstr: targetid["Charlie 2"];
pilot: Pilot_Maestro;
end;
object Wingman_9(Ship)
obj: longbow;
x: 1400;
y: 1600;
z: 5000;
main: M_Wingman;
targstr: targetid["Charlie 3"];
pilot: Pilot_Maestro;
end;
object Wingman_10(Ship)
obj: longbow;
x: 1400;
y: 1600;
z: 5000;
main: M_Wingman;
targstr: targetid["Charlie 4"];
pilot: Pilot_Maestro;
end;
object Diligent(CapShip)
obj: "midway";
x: 1800;
y: 600;
z: 1200;
main: M_Carriers;
pilot: PILOT_Confed;
targstr: targetid["TCS Adelaide"];
end;
object Diligent2(CapShip)
obj: "midway";
x: 400;
y: 600;
z: 1200;
main: M_Carriers;
pilot: PILOT_Confed;
targstr: targetid["TCS Adelaide"];
end;
object kfleet(CapShip)
obj: "fralthi";
x: 3000;
y: 600;
z: 1200;
main: M_Kfleet;
pilot: PILOT_Confed;
targstr: targetid["K'ha'haf"];
end;
object kfleet2(CapShip)
obj: "fralthi";
x: 2000;
y: 600;
z: 1200;
main: M_Kfleet;
pilot: PILOT_Confed;
targstr: targetid["K'ha'haf"];
end;
object kfleet3(CapShip)
obj: "fralthi";
x: 1000;
y: 600;
z: 1200;
main: M_Kfleet;
pilot: PILOT_Confed;
targstr: targetid["K'ha'haf"];
end;
object Player(Player) // player function, indispensable
obj: panther; // player ship
x: 300; // x coord
y: 400; // y coord
z: 1200; // z coord
main: M_Player; // player main function
pilot: Pilot_Casey1; // pilot
end; // end object function
// ********** BEGIN Spwaning Routines for Alien **********
function M_SpawnNearObjectAlien(shipId, count, obj); forward;
var
m_AliveAliens,
m_DeadAliens;
function S_Alien;
begin
SF_SetObjectFlag(OF_alignment,
ALIGN_ALIEN);
SF_BindToActionSphere(0);
SF_ActivateSelf(0);
m_AliveAliens := m_AliveAliens + 1;
while (1) do
AI_WaitSeconds(1);
end;
function S_AlienDeath;
begin
m_DeadAliens := m_DeadAliens + 1;
end;
function M_SpawnAlien(shipId, count, x, y, z);
var
ox, oy, oz;
begin
while(count > 0) do begin
ox := x + SYS_Random(600) - 300;
oy := y + SYS_Random(600) - 300;
oz := z + SYS_Random(600) - 300;
NAV_CreateShip(2, PILOT_Confed, 0, @S_Alien, @S_AlienDeath, ox, oy, oz);
AI_WaitMilliseconds(275);
count := count - 1;
end;
end;
function M_SpawnNearObjectAlien(shipId,
count, obj);
var
x, y, z,
ox, oy, oz;
begin
x := SF_GetXObj(Player);
y := SF_GetYObj(Player);
z := SF_GetZObj(Player);
while(count > 0) do begin
ox := x + SYS_Random(600) + 500;
oy := y + SYS_Random(600) + 500;
oz := z + SYS_Random(600) + 500;
NAV_CreateShip(shipId, PILOT_Alien1, 0, @S_Alien, @S_AlienDeath, ox, oy, oz);
AI_WaitMilliseconds(275);
count := count - 1;
end;
end;
function M_CountAliens;
begin
Result := m_AliveAliens - m_DeadAliens;
end;
function M_WaitUntilDeadAlien;
begin
until(m_DeadAliens = m_AliveAliens) do
AI_WaitSeconds(1);
end;
// *********** END Spwaning Routines for Alien ***********
function M_NAV1; // nav1 main function
var
setup = true;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf; // if player within nav1 sphere, activate it
AI_WaitSeconds(1);
NAV_SetPlayerNav(2); // set new autopilot coords
while(NAV_WithinSphere(Player)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf; //deactivate navpoint
end;
AI_WaitSeconds(1);
end;
end;
function M_NAV2;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf;
NAV_SetPlayerNav(3);
while(NAV_WithinSphere(Player)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
end;
function M_NAV3;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf;
AI_WaitSeconds(1);
M_SpawnNearObjectAlien(SHIP_Dralthi, 3, Player);
NAV_SetPlayerNav(4);
while(NAV_WithinSphere(Player)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
end;
function M_NAV4;
begin
while(1) do begin
if (NAV_WithinSphere(Player)) then begin
NAV_ActivateSelf;
AI_WaitSeconds(4);
SF_SetMissionSuccess; // set the mission as a success
AI_WaitSeconds(4);
SF_Exit; // end the mission
while(NAV_WithinSphere(Player)) do begin
AI_WaitSeconds(1);
end;
NAV_DeactivateSelf;
end;
AI_WaitSeconds(1);
end;
end;
function M_Wingman; //wingman main function
begin
SF_SetObjectFlag(OF_Alignment, ALIGN_CONFED);
//ship alignment (neutral, confed, alien, or evil-kilrathi)
AI_WaitSeconds(1);
SF_BindToActionSphere(0);
//navpoints where the player will appear (0=all)
SF_ActivateSelf(0);
AI_AddToWing(Player); // wing
while(1) do AI_WaitSeconds(1);
end;
function M_Carriers; //wingman main function
begin
SF_SetObjectFlag(OF_Alignment, ALIGN_CONFED);
//ship alignment (neutral, confed, alien, or evil-kilrathi)
AI_WaitSeconds(1);
SF_ActivateSelf(0);
while(1) do AI_WaitSeconds(1);
end;
function M_Kfleet; //wingman main function
begin
SF_SetObjectFlag(OF_Alignment, ALIGN_ALIEN);
//ship alignment (neutral, confed, alien, or evil-kilrathi)
AI_WaitSeconds(1);
SF_ActivateSelf(0);
while(1) do AI_WaitSeconds(1);
end;
function M_Player; //player main function
begin
SF_SetObjectFlag(OF_Alignment, ALIGN_CONFED); //alignment
SF_BindToActionSphere(0); // navpoint it will appear,always 0 (0=all)
SF_ActivateSelf(2); // automatic activate the object
while(1) do AI_WaitSeconds(1);
end;
function MAIN; // game main function
begin
MS_RunGameflow(0); // start gameflow
MS_RunSpaceflight(0); // start engine
end;