Can't get conditional equipment available!
Posted: Sat Apr 23, 2011 10:26 am
I want the equipment to only be available in Galaxy 8...and then only at certain systems. (And maybe only at main system stations...and 1 other special station: "owt2oGHS".) I also want both the equipment available for sale on starting from a savegame.
But try as I might, my code is full of fail.
Here's its equipment.plist file:Here's the parts of its .js file I think are important:I get the messages "Checking for shop..." and "In Galaxy 8." when appropriate. But the "Adding equipment" messages I don't seem to get.
Going forwards with a totally different OXP, I'd like to make equipment only repairable at certain places. I figure I can just "give" the equipment to the player at the end of a mission using a .js script command...like this:
player.ship.awardEquipment("EQ_NAVAL_ENERGY_UNIT");
But making that normally-unavailable-for-sale equipment repairable regardless of how you acquire it (such as buying a ship already with it) seems oddly hard to do.
But try as I might, my code is full of fail.
Here's its equipment.plist file:
Code: Select all
(
(
99, 10000, "One way ticket to Oresrati",
"EQ_ONEWAYTICKET_TO_ORESRATI",
"This equipment allows auto jump to Isolated system Oresrati in Galaxy 8. Don't forget to buy a Galactic Hyperdrive otherwise you will not be able to travel to any other system. :)",
{
"available_to_all" = 1;
conditions =
(
"galaxy_number equal 7"
);
"requires_equipment" = "EQ_ADVANCED_NAVIGATIONAL_ARRAY", "EQ_GAL_DRIVE", "EQ_WORMHOLE_SCANNER";
"script" = "owt2o_autoJumper.js";
}
),
)
Code: Select all
this.startUp = function() {
this.tryAddingShop();
}
this.shipWillLaunchFromStation = function () {
this.tryAddingShop();
};
this.shipExitedWitchspace = function() {
this.tryAddingShop();
}
this.tryAddingShop = function () {
player.commsMessage("Checking for shop...",6);
if(galaxyNumber == 7) {
player.commsMessage("In Galaxy 8.",6);
if(system.ID == 9 || system.ID == 88 || system.ID == 118 || system.ID == 121 || system.ID == 162) {
EquipmentInfo.infoForKey("EQ_ONEWAYTICKET_TO_ORESRATI").effectiveTechLevel = 1;
player.commsMessage("Adding equipment at places around bottom left!",6);
} else {
EquipmentInfo.infoForKey("EQ_ONEWAYTICKET_TO_ORESRATI").effectiveTechLevel = 12;
player.commsMessage("Adding equipment at TL13-15 places!",6);
}
if(system.ID == 162 && system.countShipsWithRole("owt2oGHS") < 1) {
system.addShips("owt2oGHS",1);
player.commsMessage("Adding shop!",6);
}
}
}
Going forwards with a totally different OXP, I'd like to make equipment only repairable at certain places. I figure I can just "give" the equipment to the player at the end of a mission using a .js script command...like this:
player.ship.awardEquipment("EQ_NAVAL_ENERGY_UNIT");
But making that normally-unavailable-for-sale equipment repairable regardless of how you acquire it (such as buying a ship already with it) seems oddly hard to do.