Hello to everyone!
This is my first post, so I would like to apologise for any mistakes that I might do since I am not a native speaker.
Since I discovered Oolite I have done some tinkering myself and I have even gone so far as to make a couple of oxps for my personal use.
However I have absolutely no knowledge of programming so what I have done is study other oxps and copy and modify parts that I need, through a painful proses of trial and error, until it works.
If anyone that has any knowledge of programming would like to see them and maybe get interested in adopting and or improving or commenting on them I would be very happy to post them here.
However I am concerned about the copyright issues since everybody that has ever written an oxp might recognise a piece of his code in there and I think I have lost track of who I need to ask for permission from.
Now for the tweaking part of the topic,
**Warning some code that I post might look very stupid or ugly or pointless, but it is what I managed to make work. I have no programming knowlege**
Inspired by far planets from Norby, I tinkered the additional planets oxp to increase the distance of all planets and moons to give a feeling of a larger system, but the planets are still quite reachable with the torus to sun oxp.
the only problem is that the planetary compass for some reason that I can not understand does not display any planet or moon any more
although the naming seams to work the beacon doesn't
In script.js file line 146 I changed the value from 2.5 to 12
In line 211 changed value from 5 to 25
In line 212 changed value from 2.5 to 18
I think it looks quite good but you must have your stars moved further away like with sensible sun, otherwise it is a little weird that the sun is so close but the planets are so far.
To me is the middle ground between realism, and oolitism for my system.
I only wish I could solve the planetary compass think, and maybe find some way for some of the planets to be behind the sun to simulate orbits.
I tried to understand how the positioning works in this oxp but it is waaay beyond my reach
An other major tinkering that I made is in the ironhide oxp, so that:
a) when you get hit by lasers while your energy is low for some other reason, the energy doesn't automagically become full.
if it is below 1/3 of the max energy, it becomes 1/3 otherwise just adds the damage back to your energy. (I did this 1/3 thing because for very low energy sometimes you could die by a hit even though your ironhide was full!)
b) you get no equipment damage as long as the armour is still there. (I know many will disagree but I hate it when every nick gets my advanced targeting or my injectors out. it spoils my fan!
)
so my script.js file is :
Code: Select all
this.startUp = function()
{
if(!missionVariables.ironHide_percentage) { missionVariables.ironHide_percentage = 0;}
if(!missionVariables.ironHide_milFlag) { missionVariables.ironHide_milFlag = 0; }
if(!missionVariables.ironHide_strength) {
if(missionVariables.ironHide_milFlag == 0) { missionVariables.ironHide_strength = 200; }
else { missionVariables.ironHide_strength = 400; }
}
if(missionVariables.ironHide_percentage > 0 && player.ship.equipmentStatus("EQ_ARMOUR_PLATE") !== "EQUIPMENT_OK")
{
player.ship.removeEquipment("EQ_ARMOUR_PLATE");
player.ship.awardEquipment("EQ_ARMOUR_PLATE");
}
// below are how much to charge per percentage of armour to be repaired, depending on cost price of full new set
this.ironHideFactor = EquipmentInfo.infoForKey("EQ_IRONHIDE").price / 1000;
}
this.shipDockedWithStation = function(station)
{
this.ironHideFactor = EquipmentInfo.infoForKey("EQ_IRONHIDE").price / 1000;
}
this.shipTakingDamage = function(amount, fromEntity, damageType)
{
if(amount && amount > 0 && player.ship.equipmentStatus("EQ_IRONHIDE") === "EQUIPMENT_OK" && missionVariables.ironHide_percentage <= 0)
{ // if the armour is destroyed by damage
player.ship.removeEquipment("EQ_IRONHIDE");
player.ship.removeEquipment("EQ_ARMOUR_PLATE");
missionVariables.ironHide_percentage = 0;
missionVariables.ironHide_milFlag = 0;
player.consoleMessage("IronHide armour has been destroyed!", 6);
mission.setInstructionsKey(null);
}
if(amount && amount > 0 && player.ship.energy < player.ship.maxEnergy)
{ // if we have energy damage
this.shield = missionVariables.ironHide_strength * (missionVariables.ironHide_percentage / 100);
if(amount < this.shield)
{
if(player.ship.energy < (player.ship.maxEnergy / 3))
{player.ship.energy = (player.ship.maxEnergy / 3);}
else
{
player.ship.energy += (amount);
}
missionVariables.ironHide_percentage -= Math.floor(100 * (amount / missionVariables.ironHide_strength));
}
else
{
player.ship.energy += this.shield;
missionVariables.ironHide_percentage = 0;
}
}
}
this.guiScreenWillChange = function(to, from)
{
if(to === "GUI_SCREEN_MANIFEST")
{
if(player.ship.equipmentStatus("EQ_IRONHIDE") === "EQUIPMENT_OK")
{ mission.setInstructionsKey("ironHide_short"); }
else
{ mission.setInstructionsKey(null); }
}
}
this.playerBoughtEquipment = function(equipment)
{
switch(equipment)
{
case("EQ_IRONHIDE"):
{
missionVariables.ironHide_percentage = 100;
missionVariables.ironHide_strength = EquipmentInfo.infoForKey(equipment).scriptInfo.ironHideStrength;
player.ship.awardEquipment("EQ_ARMOUR_PLATE");
return;
break;
}
case("EQ_IRONHIDE_MIL"):
{
missionVariables.ironHide_milFlag = 1;
missionVariables.ironHide_strength = EquipmentInfo.infoForKey(equipment).scriptInfo.ironHideStrength;
player.ship.removeEquipment("EQ_IRONHIDE_MIL");
return;
break;
}
case("EQ_IRONHIDE_REPAIR"):
{
missionVariables.ironHide_cost = (100 - missionVariables.ironHide_percentage) * this.ironHideFactor;
if(missionVariables.ironHide_mil == 1)
{
missionVariables.ironHide_cost *= 1.5;
}
player.ship.removeEquipment("EQ_IRONHIDE_REPAIR");
player.ship.removeEquipment("EQ_ARMOUR_PLATE");
player.ship.awardEquipment("EQ_ARMOUR_PLATE");
if(player.credits < missionVariables.ironHide_cost)
{
mission.runScreen({title: "Too Expensive", messageKey:"ironHide_tooExpensive"});
}
else
{
mission.runScreen({title: "Armour Repair", messageKey:"ironHide_repair", choicesKey:"ironHide_choices"}, this.choice);
}
return;
break;
}
case("EQ_RENOVATION"):
{
if(player.ship.equipmentStatus("EQ_IRONHIDE") === "EQUIPMENT_UNAVAILABLE" || missionVariables.ironHide_percentage == 100)
{ // if we don't have armour or it's full-strength, no repair needed during renovations
return;
break;
}
if(player.ship.equipmentStatus("EQ_IRONHIDE") === "EQUIPMENT_OK" && missionVariables.ironHide_percentage <100)
{
missionVariables.ironHide_cost = (100 - missionVariables.ironHide_percentage) * this.ironHideFactor;
if(missionVariables.ironHide_milFlag == 1)
{
missionVariables.ironHide_cost *= 1.5;
}
}
if(missionVariables.ironHide_cost > 0 && missionVariables.ironHide_cost < player.credits)
{
mission.runScreen({title: "Armour Repair", messageKey:"ironHide_renovationRepair", choicesKey:"ironHide_renovationChoices"}, this.choice);
}
break;
}
}
}
this.choice = function(choice)
{
switch(choice)
{
case "IRONHIDE_1_ACCEPT":
{
player.credits -= missionVariables.ironHide_cost;
missionVariables.ironHide_percentage = 100;
break;
}
case "IRONHIDE_1_RENOVATION_ACCEPT":
{
player.credits -= missionVariables.ironHide_cost;
missionVariables.ironHide_percentage = 100;
break;
}
case "IRONHIDE_2_REJECT":
{
break;
}
}
}
this.playerBoughtNewShip = this.shipLaunchedEscapePod = function()
{ // reset everything for a new ship, as armour isn't transferrable or covered by insurance
player.ship.removeEquipment("EQ_IRONHIDE");
player.ship.removeEquipment("EQ_ARMOUR_PLATE");
missionVariables.ironHide_percentage = 0;
missionVariables.ironHide_milFlag = 0;
mission.setInstructionsKey(null);
}
this.equipmentDamaged = function(equipment)
{// as it doesn't make sense for the armour to be inoperable-damaged
if(equipment === "EQ_IRONHIDE")
{
player.ship.setEquipmentStatus("EQ_IRONHIDE","EQUIPMENT_OK");
}
}
this.equipmentDamaged = function(equipment)
{// as there are more plates left
if(equipment === "EQ_ARMOUR_PLATE")
{
player.ship.setEquipmentStatus("EQ_ARMOUR_PLATE","EQUIPMENT_OK");
player.consoleMessage("Armour plating at " + missionVariables.ironHide_percentage + "%",2);
}
}
The equipment.plist is
Code: Select all
(
(
4,
7500,
"IronHide Armour",
"EQ_IRONHIDE",
"Civilian-grade armour.",
{
"available_to_all" = true;
"incompatible_with_equipment" = "EQ_DUMMY";
script_info = { ironHideStrength = 200; };
}
),
(
9,
7500,
"IronHide Armour Military Upgrade",
"EQ_IRONHIDE_MIL",
"Upgrade your IronHide to military specifications - doubles the damage resistance.",
{
"available_to_all" = true;
"requires_equipment" = "EQ_IRONHIDE";
script_info = { ironHideStrength = 400; };
"conditions" =
(
"mission_ironHide_percentage equal 100",
"mission_ironHide_milFlag equal 0"
);
}
),
(
4,
0,
"Quotation for repair of IronHide armour",
"EQ_IRONHIDE_REPAIR",
"Inspection and price quotation for repair to your armour.",
{
"available_to_all" = true;
"requires_equipment" = "EQ_IRONHIDE";
"conditions" =
(
"mission_ironHide_percentage lessthan 100"
);
}
),
(
99,
0,
"Armour Plate",
"EQ_ARMOUR_PLATE",
"Armour plating of the IronHide armour",
{
"available_to_all" = true;
"requires_equipment" = "EQ_IRONHIDE";
"is_visible" = "true";
"damage_probability" = "800.0";
}
)
)
I hope Thargoid will not mind that I posted this.
If anyone objects please tell me to delete this the post.
I have also tinkered the battledamage oxp to be more compatible (in my point of view,) with the ironhide
so that as long as the armour is still strong you get no plate damage.
so the battle_damage_script.js is as follows:
Code: Select all
this.startUp = function ()
{
if (missionVariables.BattleDamage_status !== "DAMAGED")
{
player.ship.awardEquipment ("EQ_HULL_REPAIR"); //Ensures that repair does not appear on F3 screen
missionVariables.BattleDamage_status = "OK";
if(!missionVariables.platingStatus){missionVariables.platingStatus = 0;}
}
if (player.ship.equipmentStatus("EQ_ARMOUR_PLATE") !== "EQUIPMENT_OK")
{
if(missionVariables.platingStatus > 0)
{
player.ship.removeEquipment("EQ_HULL_PLATING");
player.ship.awardEquipment("EQ_HULL_PLATING");
}
else
{
player.ship.removeEquipment("EQ_HULL_PLATING");
}
}
}
this.playerBoughtNewShip = function ()
{
player.ship.awardEquipment ("EQ_HULL_REPAIR"); //Ensures that repair does not appear on F3 screen
missionVariables.BattleDamage_status = "OK";
missionVariables.platingStatus = 5;
player.ship.removeEquipment("EQ_HULL_PLATING");
if (player.ship.equipmentStatus("EQ_ARMOUR_PLATE") !== "EQUIPMENT_OK")
{
if(missionVariables.platingStatus > 0)
{
player.ship.awardEquipment("EQ_HULL_PLATING");
}
}
}
this.shipWillDockWithStation = function (station)
{
if (missionVariables.BattleDamage_status == "DAMAGED")
{
player.addMessageToArrivalReport(expandDescription("[HULL_DAMAGE_MESSAGE]"));
}
else if (missionVariables.BattleDamage_status == "DAMAGED1")
{
missionVariables.BattleDamage_status = "DAMAGED"; // set to damaged
player.addMessageToArrivalReport(expandDescription("[HULL_DAMAGE_MESSAGE_TWO]"));
player.credits -= 25;
}
}
this.shipWillLaunchFromStation = function(station)
{
if (missionVariables.BattleDamage_status == "OK") //Ensures that there are no issues when player launches after un-repaired launch/re-dock/repair/re-launch
{
player.ship.fuelLeakRate = 0;
player.ship.scriptedMisjump = false;
}
if (player.ship.equipmentStatus("EQ_ARMOUR_PLATE") !== "EQUIPMENT_OK")
{
if(missionVariables.platingStatus > 0)
{
player.ship.removeEquipment("EQ_HULL_PLATING");
player.ship.awardEquipment("EQ_HULL_PLATING");
}
else
{
player.ship.removeEquipment("EQ_HULL_PLATING");
}
}
}
this.shipLaunchedFromStation = function(station) // to handle ship launching with damage un-repaired
{
if (missionVariables.BattleDamage_status == "DAMAGED" && (Math.random() <= 0.50))
{
this.station = station;
this.station.commsMessage("Commander, your ship appears to be badly damaged. Take care!"),player.ship;
missionVariables.BattleDamage_status = "DAMAGED"; // set to damaged
}
else if (missionVariables.BattleDamage_status == "DAMAGED" && (Math.random() > 0.50))
{
player.ship.fuelLeakRate = 0.5;
player.consoleMessage("WARNING! FUEL LEAK.",5);
this.station = station;
this.station.commsMessage("Commander, your ship is venting fuel due to a hull breach. You must dock for repairs immediately."),player.ship;
player.ship.scriptedMisjump = true;
missionVariables.BattleDamage_status = "DAMAGED1"; // set to damaged1
}
}
this.shipTakingDamage = function(amount)
{
if(amount && amount > 0 && player.ship.equipmentStatus("EQ_ARMOUR_PLATE") !== "EQUIPMENT_OK")
{
if(missionVariables.platingStatus > 0 && player.ship.equipmentStatus("EQ_HULL_PLATING") !== "EQUIPMENT_OK")
{
player.ship.awardEquipment("EQ_HULL_PLATING");
}
}
if(amount === 0 || player.ship.equipmentStatus("EQ_ARMOUR_PLATE") === "EQUIPMENT_OK") return;
else if (missionVariables.BattleDamage_status == "DAMAGED")
{
player.consoleMessage("Hull taking further damage.",5);
}
else
{
player.ship.removeEquipment("EQ_HULL_REPAIR"); //remove 'repair' to allow 'repair' to be applied again. This should happen before any risk of damage to 'repair'
missionVariables.BattleDamage_status = "DAMAGED"; // set to damaged
player.consoleMessage("WARNING! HULL DAMAGE",10);
}
}
this.playerBoughtEquipment = function(equipment)
{
if (equipment == "EQ_HULL_REPAIR")
{
clock.addSeconds ("35000");
missionVariables.BattleDamage_status = "OK"; // set to OK
missionVariables.platingStatus = 5;
player.ship.removeEquipment("EQ_HULL_PLATING");
if (player.ship.equipmentStatus("EQ_ARMOUR_PLATE") !== "EQUIPMENT_OK")
{
if(missionVariables.platingStatus > 0)
{
player.ship.awardEquipment("EQ_HULL_PLATING");
}
}
}
if (equipment == "EQ_RENOVATION")
{
player.ship.awardEquipment("EQ_HULL_REPAIR");
missionVariables.BattleDamage_status = "OK"; // set to OK
missionVariables.platingStatus = 5;
player.ship.removeEquipment("EQ_HULL_PLATING");
if (player.ship.equipmentStatus("EQ_ARMOUR_PLATE") !== "EQUIPMENT_OK")
{
if(missionVariables.platingStatus > 0)
{
player.ship.awardEquipment("EQ_HULL_PLATING");
}
}
}
}
this.shipLaunchedEscapePod = function(escapepod) // resets everything after ejecting so new ship is undamaged
{
missionVariables.BattleDamage_status = "OK"; //set to OK
player.ship.awardEquipment ("EQ_HULL_REPAIR"); //Ensures that repair does not appear on F3 screen
missionVariables.platingStatus = 5;
player.ship.removeEquipment("EQ_HULL_PLATING");
if (player.ship.equipmentStatus("EQ_ARMOUR_PLATE") !== "EQUIPMENT_OK")
{
if(missionVariables.platingStatus > 0)
{
player.ship.awardEquipment("EQ_HULL_PLATING");
}
}
}
this.equipmentDamaged = function(equipment)
{
if(equipment === "EQ_HULL_PLATING")
{
if(missionVariables.platingStatus > 0)
{
player.ship.setEquipmentStatus("EQ_HULL_PLATING","EQUIPMENT_OK");
missionVariables.platingStatus -=1;
}
else
{
player.ship.removeEquipment("EQ_HULL_PLATING");
}
}
}
and the equipment.plist is as follows:
Code: Select all
(
/* adapted from core plist for Battle Damage OXP */
(
6, 1000, "Maintenance Overhaul",
"EQ_RENOVATION",
"Covers dry docking fees, shield and scoop system de-ionization, systems tune-up, new oil and filters, check and refurbishment of entire hull including replating of damaged hull sections, repainting and detailed valeting.",
{
available_to_all = true;
}
),
(
0, 750, "Emergency Hull Repairs",
"EQ_HULL_REPAIR",
"Basic emergency replating of damaged hull sections to maintain structural integrity and airtightness.",
{
"incompatible_with_equipment" = "EQ_HULL_REPAIR";
available_to_all = true;
"visible" = no; // not listed on the F5F5 screen.
}
),
(
99, 0, "Hull Plating",
"EQ_HULL_PLATING",
"Hull plating good",
{
"incompatible_with_equipment" = "EQ_ARMOUR_PLATE";
"available_to_all" = "true";
"visible" = "yes";
"damage_probability" = "800.0";
}
)
)
now when your ship gets a beating first you get armour damage, then you get plating damage with all the consequences and lastly your equipment and cargo start getting blasted. missiles and collisions should do damage as before (I think)
my dream would be to make an oxp that separates the energy from the survival of the ship, and when the armour and plating gets breached multiple equipment get damaged , fires start resulting in cabin temp rising, and various bad things randomly start to happen until your ship goes boom or maybe an ecm blast ignites your leaking tank and you become a spectacle system wide
But as I said enough times already I am not a coder
thank you for your time!