Back to Index Page generated: Dec 20, 2024, 7:22:09 AM

Expansion Stealth

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description A small mission set in Galaxy 3 to showcase the new scanner features and the possibility for stealth ships. A small mission set in Galaxy 3 to showcase the new scanner features and the possibility for stealth ships.
Identifier oolite.oxp.Thargoid.Stealth oolite.oxp.Thargoid.Stealth
Title Stealth Stealth
Category Missions Missions
Author Thargoid Thargoid
Version 1.05 1.05
Tags missions, ships missions, ships
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Stealth_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/c/cb/Stealth_1.05.oxz n/a
License Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme file Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme file
File Size n/a
Upload date 1610873473

Documentation

Also read http://wiki.alioth.net/index.php/Stealth

Stealth 1.05 Readme & License.txt

Stealth OXP by Thargoid.

This is a little mission OXP set in Galaxy 3, designed to showcase what can be done in Oolite with scanner lollipop colours and the creation of stealth ships which do not appear (in this case programmed to only be visible when they are attacking prey). 

A squadron of six experimental stealth Barracuda fighters have been stolen by a pirate gang and are preying on innocent traders. The navy needs someone to take care of business and take them out, and your name's in the frame.

To kick off the mission, fly to the main station in the Beenbeor system.

Requirements -

This OXP is scripted for Oolite v1.76 or later, and will not run on any earlier versions of the game. 

The mission is set in Galaxy 3, and requires the player to have at least 512 kills to their name. If these conditions are met then the mission will be offered on docking, after which time reminder instructions are provided in mission screens with pointers via the manifest (F5-F5) screen.

--------------------------------------------------------------

License:

This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with the following clauses:

* Whilst you are free (and encouraged) to re-use any of the scripting, models or texturing in this OXP, the usage must be distinct from that within this OXP. Unique identifiers such as (but not limited to) unique shipdata.plist entity keys, mission variables, script names (this.name), equipment identity strings (EQ_), description list arrays and entity roles must not be re-used without prior agreement. Basically if it's unique or would identify or overwrite anything in the original OXP, then you may not re-use it (for obvious compatibility reasons).
* rebundling of this OXP within another distribution is permitted as long as it is unchanged. The following derivates however are permitted and except from the above:
	* the conversion of files between XML and openStep.
	* the merging of files with other files of the same type from other OXPs.
* The license information (either as this file or merged into a larger one) must be included in the OXP.
* Even though it is not compulsory, if you are re-using any sizable or recognisable piece of this OXP, please let me know :)

--------------------------------------------------------------

Instructions:

Unzip the file, and then move the folder "Stealth 1.05.oxp" to the AddOns directory of your Oolite installation. Then start the game up and the ships should be added. 

Version history:

13/06/2010 - Version 1.00, Initial release.
02/11/2010 - Version 1.01, bugfix correcting missing script element which spawns the base!
13/02/2011 - Version 1.02, removal of upper limit, to allow running with 1.75
02/03/2011 - Version 1.03, added a couple of missing break; commands to the script.js
14/07/2011 - Version 1.04, tweaked script to make sure pirate base is added if player saves and reloads in mission system.
26/03/2013 - Version 1.05, some script and message adjustments to make the objectives a bit clearer, and to notify that the mission will fail if the target system is left once the mission is active and the hunt underway.

--------------------------------------------------------------

Acknowledgements:

With thanks to another_commander for the implementation of the scanner functions in 1.74, and a nod to Frame for his discussions on stealth ships on the forum. Also thanks to bjasspa for the missing break's heads-up.

Thanks also to Mauiby de Fug for the bug report on the save/reload issue, and Stewart for the constructive write-up on v1.04 which lead to v1.05

Equipment

This expansion declares no equipment.

Ships

Name
Stealth Barracuda (Stolen)
Asteroid
Homing Mine (Inactive)

Models

This expansion declares no models.

Scripts

Path
Config/script.js
this.name					= "stealth_missionScript";
this.author					= "Thargoid";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Mission script for Stealth OXP.";
this.version				= "1.05";

this.startUp = function()
	{
	// mission has already been rejected or completed, clean up and remove active script parts
	if(missionVariables.stealth_mission == "CASE_CLOSED") 
		{
		this.cleanUp();
		return;
		}
	 
	//initialise mission variables
	if(!missionVariables.stealth_mission) // mission general status
		{ missionVariables.stealth_mission = "OFFER"; }

	if(!missionVariables.stealth_barraCount) // how many barracuda's launched
		{ missionVariables.stealth_barraCount = 0; }
		
	if(!missionVariables.stealth_barraKills) // and how many killed by the player
		{ missionVariables.stealth_barraKills = 0; }
	}
	
this.cleanUp = function() // get rid of active script elements if no longer needed.
		{
		delete this.startUp;
		delete this.playerEnteredNewGalaxy;
		delete this.missionScreenOpportunity;
		delete this.choice;
		mission.setInstructionsKey(null);
		return;
		}

this.missionScreenOpportunity = function()
	{	
	// next check if we have any conditions preventing the offering or continuing of the mission
	if(!player.ship.docked // we're in space
			|| player.score < 512 // need to be dangerous rank to begin
			|| galaxyNumber != 2 // we're not in G3
			|| !player.ship.dockedStation.isMainStation // if we're not at the main station
			) 
		{ return; }
	
	if(system.ID === 131) // if we're at Lequena
		{
		if(player.ship.docked && player.ship.dockedStation.isMainStation && missionVariables.stealth_mission === "GO_GET_EM" && this.dockHint === "NO")
			{
			this.dockHint = "YES";
			mission.runScreen({title: "Anyone seen old Jeeq?", messageKey:"stealth_hint"});
			return;
			}
		}
	
	if(system.ID === 116) // if we're at Beenboer
		{
		switch(missionVariables.stealth_mission)
			{
			case "OFFER": // make the initial offer
				{
				mission.runScreen({title: "Catch the Barracuda", messageKey:"stealth_initialOffer", choicesKey:"stealth_choices"}, this.choice);
				break;
				}
			case "REJECTED": // player said no
				{
				missionVariables.stealth_mission = "CASE_CLOSED";
				mission.setInstructionsKey(null);
				mission.runScreen({title: "Ah well...", messageKey:"stealth_rejected"});
				break;
				}
			case "ACCEPTED": // player said yes
				{
				missionVariables.stealth_mission = "GO_GET_EM";
				mission.setInstructionsKey("stealth_missionShort");
				mission.markSystem(131);
				mission.runScreen({title: "Final briefing", messageKey:"stealth_accepted"});
				break;
				}
			case "BASE_DESTROYED": // mission over - base destroyed
				{
				missionVariables.stealth_mission = "CASE_CLOSED";
				mission.setInstructionsKey(null);
				mission.unmarkSystem(116);
				switch(missionVariables.stealth_barraKills)
					{
					case(6):
						{
						mission.runScreen({title: "Mission accomplished", messageKey:"stealth_allBarraDestroyed"});
						player.credits += 2000;
						break;
						}
					case(5):
					case(4):
					case(3):
						{
						missionVariables.stealth_award = missionVariables.stealth_barraKills * 250;
						mission.runScreen({title: "Mission debriefing", messageKey:"stealth_someBarraDestroyed"});
						player.credits += missionVariables.stealth_award;
						break;
						}
					case(2):
					case(1):
						{
						mission.runScreen({title: "Mission debriefing", messageKey:"stealth_fewBarraDestroyed"});
						break;
						}					
					case(0):
						{
						mission.runScreen({title: "Mission debriefing", messageKey:"stealth_noBarraDestroyed"});
						break;
						}
					}
				break;	
				}
			case "BASE_INTACT": // mission over - base intact
				{
				missionVariables.stealth_mission = "CASE_CLOSED";
				mission.setInstructionsKey(null);
				mission.unmarkSystem(116);
				switch(missionVariables.stealth_barraKills)
					{
					case(6):
						{
						mission.runScreen({title: "Mission debriefing", messageKey:"stealth_allBarraIntact"});
						player.credits += 1000;
						break;
						}
					case(5):
					case(4):
					case(3):
						{
						missionVariables.stealth_award = missionVariables.stealth_barraKills * 100;
						mission.runScreen({title: "Mission debriefing", messageKey:"stealth_someBarraIntact"});
						player.credits += missionVariables.stealth_award;
						break;
						}
					case(2):
					case(1):
						{
						mission.runScreen({title: "Mission debriefing", messageKey:"stealth_fewBarraIntact"});
						break;
						}					
					case(0):
						{
						mission.runScreen({title: "Mission failed", messageKey:"stealth_noBarraIntact"});
						break;
						}	
					}
				break;	
				}
			}
		return;	
		}
	}
	
this.choice = function(choice)
	{
	switch(choice)
		{
		case "STEALTH_1_ACCEPTED":
			{
			missionVariables.stealth_mission = "ACCEPTED";
			break;
			}
		case "STEALTH_2_REJECTED":
			{
			missionVariables.stealth_mission = "REJECTED";
			break;
			}
		}
	}

this.playerEnteredNewGalaxy	= function(galaxyNumber)
	{ // if we jump galaxies whilst mission is running or after rejection
	if(galaxyNumber == 3 && missionVariables.stealth_mission != "OFFER")
		{
		missionVariables.stealth_mission = "CASE_CLOSED";
		this.cleanUp();
		}
	}
	
this.shipWillExitWitchspace = function()
	{
	if(galaxyNumber == 2 && system.ID == 131 && missionVariables.stealth_mission && missionVariables.stealth_mission == "GO_GET_EM" && system.countShipsWithRole("stealth_base") == 0)
		{
		this.location = (Math.random() * 0.5) + 0.25;
		system.addShipsToRoute("stealth_base", 1, this.location, "ws");
		this.dockHint = "NO";
		}
	}
	
this.playerStartedJumpCountdown = function()
	{ 
	if(galaxyNumber == 2 && system.ID == 131 && missionVariables.stealth_mission && missionVariables.stealth_mission == "GO_GET_EM")
		{
		player.commsMessage("If we leave now there will not be sufficient time to return before the Barracuda base is evacuated - the mission will be lost!");
		delete this.playerStartedJumpCountdown;
		}
	}	
	
this.shipWillLaunchFromStation = function()
	{
	this.shipWillExitWitchspace();
	delete this.shipWillLaunchFromStation;
	}
Scripts/stealth_barracuda.js
this.name			= "stealth_barracuda";
this.author			= "Thargoid";
this.copyright		= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description	= "Script for stealth ship appearing and vanishing";
this.version		= "1.05";

this.shipSpawned = function ()
	{
	if (player.score > 512) { this.ship.awardEquipment("EQ_SHIELD_BOOSTER"); }
	if (player.score > 2560) { this.ship.awardEquipment("EQ_SHIELD_ENHANCER"); }
	missionVariables.stealth_barraCount += 1;
	}

this.stealthMode = function(state)
	{
	if(state && state == "off")
		{
		this.ship.scannerDisplayColor1 = "redColor";
		this.ship.scannerDisplayColor2 = "redColor";
		}
	else
		{
		this.ship.scannerDisplayColor1 = [0,0,0,0];
		}
	}

this.shipDied = function(who, why)
	{ missionVariables.stealth_barraKills += 1; }
Scripts/stealth_base.js
this.name			= "stealth_base";
this.author			= "Thargoid";
this.copyright		= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description	= "Script for stealth base";
this.version		= "1.05";

var stealth_stealthGroup = new ShipGroup();

this.shipSpawned = function()
	{
	stealth_stealthGroup.leader = this.ship;
	this.ship.scannerDisplayColor1 = "whiteColor";
	this.ship.scannerDisplayColor2 = "grayColor";
	system.addShips("asteroid", 30, this.ship.position, 25600); // add the asteroid field
	system.addShips("stealth_mine", 10, this.ship.position, 20000); // and the mines hidden in it
	this.watchTimer = new Timer(this, this.checkPlayer, 0, 1);
	}

this.checkPlayer = function()	
	{
	if(system.countShipsWithRole("player") == 0)
		{ this.stopWatch(); }
	
	this.distanceToPlayer = this.ship.position.distanceTo(player.ship.position);	
	if(this.distanceToPlayer < 25600)
		{
		this.launchBarra();
		this.launchBarra();
		this.stopWatch();
		}
	}
		
this.playerWillEnterWitchspace = function()
	{
	this.stopWatch();
	if(missionVariables.stealth_mission != "BASE_DESTROYED")
		{ 
		missionVariables.stealth_mission = "BASE_INTACT"; 
		mission.setInstructionsKey("stealth_backToBaseFailure", "stealth_missionScript");
		}
	}

this.stopWatch = function()
	{
	if(this.watchTimer && this.watchTimer.isRunning)
		{	
		this.watchTimer.stop();
		delete this.watchTimer;
		}
	}
	
this.launchBarra = function()
	{
	if(missionVariables.stealth_barraCount < 6)
		{
		this.launchSpot = (this.ship.position.add(this.ship.orientation.vectorForward().multiply(1000)));
		var newShip = system.addShips("stealth_barracuda", 1, this.launchSpot, 100);
		newShip.group = stealth_stealthGroup;
		}
	}

this.shipBeingAttacked = this.shipBeingAttackedByCloaked = function()
	{
	this.launchChance = (this.ship.maxEnergy - this.ship.energy) / this.ship.maxEnergy;
	if(Math.random() < this.launchChance) 
		{ this.launchBarra(); }
	}
	
this.shipEnergyIsLow = function()
	{
	player.commsMessage("Emergency warning to all Barracuda, base systems are going critical!      Take that SOB out before we're toasted!", 6);	
	if(missionVariables.stealth_barraCount < 6)
		{		
		this.launchSpot = (this.ship.position.add(this.ship.orientation.vectorForward().multiply(1000)));
		var newShip = system.addShips("stealth_barracuda", (6 - missionVariables.stealth_barraCount), this.launchSpot, 200);
		newShip.group = stealth_stealthGroup;
		}	
	delete this.shipEnergyIsLow;	
	}
	
this.shipDied = function(who, why)
	{
	this.stopWatch();
	
	if(this.scanTimer && this.scanTimer.isRunning)
		{	
		this.scanTimer.stop();
		delete this.scanTimer;
		}
	
	if(why && why != "removed")
		{
		missionVariables.stealth_mission = "BASE_DESTROYED";
		mission.setInstructionsKey("stealth_backToBaseSuccess", "stealth_missionScript");
		mission.unmarkSystem(131);
		mission.markSystem(116);
		}
	}
	
this.otherShipDocked = function(whom)		
	{	
	if(whom.isPlayer)
		{ // if the player was dumb enough to dock
		mission.runScreen({title: "Bad Move!", messageKey:"stealth_getHim"}, this.damagePlayer);
		}
	}	
	
this.damagePlayer = function()
	{
	player.ship.launch();
	player.ship.takeInternalDamage();
	player.ship.takeInternalDamage();
	player.ship.energy *= (0.5 + (Math.random() * 0.5));
	player.ship.aftShield *= (0.1 + (Math.random() * 0.8));
	player.ship.forwardShield *= (0.1 + (Math.random() * 0.8));
	}	
Scripts/stealth_mine.js
this.name			= "stealth_mine";
this.author			= "Thargoid";
this.copyright		= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description	= "Script for space mine";
this.version		= "1.05";

this.activate = function()
	{
	this.ship.scannerDisplayColor1 = "yellowColor";
	this.ship.scannerDisplayColor2 = "redColor";
	this.ship.displayName = "Homing Mine (Active)";
	}

this.deactivate = function()
	{
	this.ship.scannerDisplayColor1 = "whiteColor";
	this.ship.scannerDisplayColor2 = "whiteColor";
	this.ship.displayName = "Homing Mine (Inactive)";
	}