I already made have SectorGen file that generates all of my starting systems and sets up factions.
package data.scripts.world;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.RepLevel;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.SectorGeneratorPlugin;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.impl.campaign.CoreCampaignPluginImpl;
import com.fs.starfarer.api.impl.campaign.CoreScript;
import com.fs.starfarer.api.impl.campaign.events.CoreEventProbabilityManager;
import com.fs.starfarer.api.impl.campaign.fleets.BountyPirateFleetManager;
import com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetManager;
import com.fs.starfarer.api.impl.campaign.fleets.LuddicPathFleetManager;
import com.fs.starfarer.api.impl.campaign.fleets.MercFleetManager;
import com.fs.starfarer.api.impl.campaign.fleets.PirateFleetManager;
import com.fs.starfarer.api.impl.campaign.ids.Factions;
import com.fs.starfarer.api.impl.campaign.ids.Terrain;
import com.fs.starfarer.api.util.Misc;
import data.hullmods.HeavyArmor;
import data.scripts.world.corvus.Corvus;
import data.scripts.world.EMPTY.*;
import data.scripts.world.ISA.*;
import data.scripts.world.RSF.*;
import data.scripts.world.UIN.*;
import data.scripts.world.XLE.*;
import data.scripts.world.FFS.*;
import data.scripts.world.VNS.*;
public class SectorGen implements SectorGeneratorPlugin {
public void generate(SectorAPI sector) {
//ClassLoader cl = Global.getSettings().getScriptClassLoader();
StarSystemAPI system = sector.createStarSystem("Corvus");
//system.getLocation().set(16000 - 8000, 9000 - 10000);
system.setBackgroundTextureFilename("graphics/backgrounds/background4.jpg");
//sector.setCurrentLocation(system);
sector.setRespawnLocation(system);
sector.getRespawnCoordinates().set(-2500, -3500);
initFactionRelationships(sector);
//RSF colonies
new Barnard().generate(sector);
new Vega().generate(sector);
new Lomonosov().generate(sector);
new Gagarin().generate(sector);
new Shelezyaka().generate(sector);
//ISA colonies
new Grant().generate(sector);
new Shington().generate(sector);
new Darloth().generate(sector);
new Argos().generate(sector);
//XLE colonies
new Nexus().generate(sector);
new Uomoz().generate(sector);
new Procyon().generate(sector);
//UIN colonies
new Centronom().generate(sector);
new Gianopolis().generate(sector);
new Achiles().generate(sector);
//FFS colonies
new Tart().generate(sector);
new Adra().generate(sector);
new Kores().generate(sector);
new Impalo().generate(sector);
//VNS colonies
new Vaynar().generate(sector);
new GammaDraconis().generate(sector);
//EMPTY
new Thule().generate(sector);
new Zero().generate(sector);
new Valhalla().generate(sector);
LocationAPI hyper = Global.getSector().getHyperspace();
//SectorEntityToken zinLabel = hyper.addCustomEntity("zin_label_id", null, "warfront_label", null);
SectorEntityToken abyssLabel = hyper.addCustomEntity("opabyss_label_id", null, "rocks_label", null);
SectorEntityToken telmunLabel = hyper.addCustomEntity("telmun_label_id", null, "ai_label", null);
SectorEntityToken cathedralLabel = hyper.addCustomEntity("cathedral_label_id", null, "aliens_label", null);
//SectorEntityToken coreLabel = hyper.addCustomEntity("core_label_id", null, "nomansland_label", null);
//zinLabel.setFixedLocation(7500, 0);
abyssLabel.setFixedLocation(-18000, 5000);
telmunLabel.setFixedLocation(-18000, 18000);
cathedralLabel.setFixedLocation(18000, -18000);
//coreLabel.setFixedLocation(-12000, -12000);
SectorEntityToken deep_hyperspace = Misc.addNebulaFromPNG("data/campaign/terrain/hyperspace_map.png",
//SectorEntityToken deep_hyperspace = Misc.addNebulaFromPNG("data/campaign/terrain/hyperspace_map_filled.png",
0, 0, // center of nebula
Global.getSector().getHyperspace(), // location to add to
"terrain", "deep_hyperspace", // "nebula_blue", // texture to use, uses xxx_map for map
4, 4, Terrain.HYPERSPACE, null); // number of cells in texture
// PirateSpawnPoint pirateSpawn = new PirateSpawnPoint(sector, sector.getHyperspace(), 1, 15, system.getHyperspaceAnchor());
// system.addSpawnPoint(pirateSpawn);
// for (int i = 0; i < 2; i++) {
// pirateSpawn.spawnFleet();
// }
// need to do this after hyperspace terrain exists
//SectorProcGen.generate();
// this is done through settings.json, "plugins"->"newGameSectorProcGen"
sector.registerPlugin(new CoreCampaignPluginImpl());
sector.addScript(new CoreScript());
sector.addScript(new CoreEventProbabilityManager());
sector.addScript(new EconomyFleetManager());
sector.addScript(new MercFleetManager());
sector.addScript(new PirateFleetManager());
sector.addScript(new BountyPirateFleetManager());
}
public static void initFactionRelationships(SectorAPI sector) {
// forget why this is necessary - workaround for some JANINO issue, I think
Class c = HeavyArmor.class;
FactionAPI RSF = sector.getFaction("RSF");
FactionAPI ISA = sector.getFaction("ISA");
FactionAPI UIN = sector.getFaction("UIN");
FactionAPI XLE = sector.getFaction("XLE");
FactionAPI FFS = sector.getFaction("FFS");
FactionAPI VNS = sector.getFaction("VNS");
FactionAPI pirates = sector.getFaction("pirates");
FactionAPI WDW = sector.getFaction("WDW");
FactionAPI MAR = sector.getFaction("MAR");
FactionAPI ROCK = sector.getFaction("ROCK");
FactionAPI AI = sector.getFaction("AI");
FactionAPI ALIEN = sector.getFaction("ALIENS");
FactionAPI player = sector.getFaction("player");
FactionAPI independent = sector.getFaction("independent");
RSF.setRelationship(ISA.getId(), RepLevel.VENGEFUL);
RSF.setRelationship(XLE.getId(), RepLevel.COOPERATIVE);
RSF.setRelationship(UIN.getId(), RepLevel.NEUTRAL);
RSF.setRelationship(FFS.getId(), RepLevel.SUSPICIOUS);
ISA.setRelationship(UIN.getId(), RepLevel.COOPERATIVE);
ISA.setRelationship(XLE.getId(), RepLevel.NEUTRAL);
ISA.setRelationship(FFS.getId(), RepLevel.SUSPICIOUS);
VNS.setRelationship(ISA.getId(), RepLevel.NEUTRAL);
VNS.setRelationship(RSF.getId(), RepLevel.NEUTRAL);
VNS.setRelationship(XLE.getId(), RepLevel.HOSTILE);
VNS.setRelationship(UIN.getId(), RepLevel.SUSPICIOUS);
VNS.setRelationship(FFS.getId(), RepLevel.SUSPICIOUS);
XLE.setRelationship(UIN.getId(), RepLevel.FAVORABLE);
XLE.setRelationship(FFS.getId(), RepLevel.VENGEFUL);
XLE.setRelationship(VNS.getId(), RepLevel.HOSTILE);
independent.setRelationship(FFS.getId(), RepLevel.HOSTILE);
UIN.setRelationship(FFS.getId(), RepLevel.VENGEFUL);
pirates.setRelationship(player.getId(), RepLevel.HOSTILE);
pirates.setRelationship(independent.getId(), RepLevel.VENGEFUL);
pirates.setRelationship(RSF.getId(), RepLevel.HOSTILE);
pirates.setRelationship(ISA.getId(), RepLevel.HOSTILE);
pirates.setRelationship(XLE.getId(), RepLevel.HOSTILE);
pirates.setRelationship(UIN.getId(), RepLevel.HOSTILE);
pirates.setRelationship(FFS.getId(), RepLevel.FAVORABLE);
pirates.setRelationship(WDW.getId(), RepLevel.FAVORABLE);
pirates.setRelationship(MAR.getId(), RepLevel.FAVORABLE);
pirates.setRelationship(VNS.getId(), RepLevel.HOSTILE);
WDW.setRelationship(player.getId(), RepLevel.HOSTILE);
WDW.setRelationship(independent.getId(), RepLevel.VENGEFUL);
WDW.setRelationship(ISA.getId(), RepLevel.VENGEFUL);
WDW.setRelationship(UIN.getId(), RepLevel.VENGEFUL);
WDW.setRelationship(RSF.getId(), RepLevel.HOSTILE);
WDW.setRelationship(XLE.getId(), RepLevel.HOSTILE);
WDW.setRelationship(MAR.getId(), RepLevel.FAVORABLE);
WDW.setRelationship(FFS.getId(), RepLevel.FAVORABLE);
WDW.setRelationship(VNS.getId(), RepLevel.HOSTILE);
MAR.setRelationship(player.getId(), RepLevel.HOSTILE);
MAR.setRelationship(independent.getId(), RepLevel.VENGEFUL);
MAR.setRelationship(ISA.getId(), RepLevel.VENGEFUL);
MAR.setRelationship(UIN.getId(), RepLevel.HOSTILE);
MAR.setRelationship(RSF.getId(), RepLevel.VENGEFUL);
MAR.setRelationship(XLE.getId(), RepLevel.HOSTILE);
MAR.setRelationship(FFS.getId(), RepLevel.FAVORABLE);
MAR.setRelationship(VNS.getId(), RepLevel.HOSTILE);
ROCK.setRelationship(player.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(RSF.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(ISA.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(XLE.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(UIN.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(FFS.getId(), RepLevel.SUSPICIOUS);
ROCK.setRelationship(AI.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(ALIEN.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(independent.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(pirates.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(WDW.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(MAR.getId(), RepLevel.VENGEFUL);
ROCK.setRelationship(VNS.getId(), RepLevel.VENGEFUL);
AI.setRelationship(player.getId(), RepLevel.VENGEFUL);
AI.setRelationship(RSF.getId(), RepLevel.VENGEFUL);
AI.setRelationship(ISA.getId(), RepLevel.VENGEFUL);
AI.setRelationship(XLE.getId(), RepLevel.VENGEFUL);
AI.setRelationship(UIN.getId(), RepLevel.VENGEFUL);
AI.setRelationship(FFS.getId(), RepLevel.VENGEFUL);
AI.setRelationship(ALIEN.getId(), RepLevel.VENGEFUL);
AI.setRelationship(independent.getId(), RepLevel.VENGEFUL);
AI.setRelationship(pirates.getId(), RepLevel.VENGEFUL);
AI.setRelationship(WDW.getId(), RepLevel.VENGEFUL);
AI.setRelationship(MAR.getId(), RepLevel.VENGEFUL);
AI.setRelationship(VNS.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(player.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(RSF.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(ISA.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(XLE.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(UIN.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(FFS.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(WDW.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(independent.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(pirates.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(MAR.getId(), RepLevel.VENGEFUL);
ALIEN.setRelationship(VNS.getId(), RepLevel.VENGEFUL);
}
}
But starting a new game doesn't work. Game loads. Mission work. New campaign does not.