well i know that is a way to do it ,but i want some changes to it.
1. I just want one type of convoy that carries all resources
2. I dont want random weapons
ehm the lines that add data from corvus etc. are in there just not in the part i pasted (put everything in one file).
thanks anyway i will go through the file again might see something important missing.
maybe it helps saying that it only crashes when i add the line that delivers the resources which might crash because i didnt have the ,script in it.
which might crash because i dont have the exact script in the file which i dont since then it gives me the error unknown type "private". get it
complete file
Spoiler
package data.scripts.world;
import java.awt.Color;
import java.util.List;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.CampaignFleetAPI;
import com.fs.starfarer.api.campaign.CargoAPI;
import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.Script;
import com.fs.starfarer.api.campaign.FleetAssignment;
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.campaign.CargoAPI.CrewXPLevel;
import com.fs.starfarer.api.fleet.FleetMemberType;
import com.fs.starfarer.api.campaign.LocationAPI;
@SuppressWarnings("unchecked")
public class HappyGen extends SectorGen {
public void generate(SectorAPI sector) {
StarSystemAPI system = sector.getStarSystem("Corvus");
SectorEntityToken token = system.createToken(4000, 0);
SectorEntityToken station = system.addOrbitalStation(token, 10, 45, 200, "spacecafe", "happy_drunk");
system.addSpawnPoint(new hpdefenceSpawnPoint(sector, system, 50, 1, token));
token = system.createToken(15000, 15000);
system.addSpawnPoint(new hpconvoySpawnPoint(sector, system, 1, 1, token));
CargoAPI cargo = station.getCargo();
cargo.addCrew(CrewXPLevel.ELITE, 25);
cargo.addCrew(CrewXPLevel.VETERAN, 250);
cargo.addCrew(CrewXPLevel.REGULAR, 500);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_nomad_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_phoenix_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_phoenix_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_scissor_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_scissor_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_scissor_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_scissor_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_piker_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_piker_Hull", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "firefly_wing", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "firefly_wing", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "spike_wing", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "spike_wing", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "spike_wing", null);
cargo.addWeapons("bomb", 25);
cargo.addWeapons("reaper", 12);
cargo.addWeapons("lightac", 25);
cargo.addWeapons("lightmg", 40);
cargo.addWeapons("annihilator", 10);
cargo.addWeapons("taclaser", 10);
cargo.addWeapons("harpoon_single", 12);
cargo.addWeapons("lightmortar", 40);
cargo.addWeapons("miningblaster", 1);
cargo.addWeapons("swarmer", 5);
cargo.addWeapons("mininglaser", 25);
cargo.addWeapons("pdlaser", 25);
cargo.addWeapons("flak", 5);
cargo.addWeapons("shredder", 5);
cargo.addWeapons("annihilatorpod", 1);
cargo.addWeapons("pilum", 2);
cargo.addWeapons("mark9", 2);
cargo.addCrew(CrewXPLevel.GREEN, 500);
cargo.addSupplies(630);
cargo.addFuel(500);
FactionAPI happy_drunk = sector.getFaction("happy_drunk");
happy_drunk.setRelationship("hegemony", 1);
happy_drunk.setRelationship("tritachyon", 0);
happy_drunk.setRelationship("pirates", -1);
happy_drunk.setRelationship("independent", 1);
happy_drunk.setRelationship("player", 1);
}
}
@SuppressWarnings("unchecked")
public class hpdefenceSpawnPoint extends BaseSpawnPoint {
public hpdefenceSpawnPoint(SectorAPI sector, LocationAPI location,
float daysInterval, int maxFleets, SectorEntityToken anchor) {
super(sector, location, daysInterval, maxFleets, anchor);
}
@Override
protected CampaignFleetAPI spawnFleet() {
//if ((float) Math.random() < 0.5f) return null;
String type = null;
float r = (float) Math.random();
if (r > .8f) {
type = "defencefleet";
} else {
type = "defencefleet";
}
CampaignFleetAPI fleet = getSector().createFleet("happy_drunk", type);
getLocation().spawnFleet(getAnchor(), 0, 0, fleet);
if (type.equals("defencefleet")) {
fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, getAnchor(), 51);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
} else {
if ((float) Math.random() > 0.5f) {
fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, getAnchor(), 51);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
} else {
fleet.addAssignment(FleetAssignment.RAID_SYSTEM, null, 51);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
}
}
return fleet;
}
}
@SuppressWarnings("unchecked")
public class hpconvoySpawnPoint extends BaseSpawnPoint {
private final SectorEntityToken convoyDestination;
public hpconvoySpawnPoint(SectorAPI sector, LocationAPI location,
float daysInterval, int maxFleets, SectorEntityToken anchor, SectorEntityToken convoyDestination) {
super(sector, location, daysInterval, maxFleets, anchor);
this.convoyDestination = convoyDestination;
}
@Override
protected CampaignFleetAPI spawnFleet() {
//if ((float) Math.random() < 0.5f) return null;
String type = null;
float r = (float) Math.random();
if (r > .8f) {
type = "defencefleet";
} else {
type = "defencefleet";
}
CampaignFleetAPI fleet = getSector().createFleet("happy_drunk", type);
getLocation().spawnFleet(getAnchor(), 0, 0, fleet);
if (type.equals("defencefleet")) {
CargoAPI cargo = fleet.getCargo();
cargo.addWeapons("annihilatorpod", 10);
cargo.addWeapons("harpoon", 5);
cargo.addWeapons("heavymg", 5);
cargo.addWeapons("arbalest", 35);
cargo.addWeapons("heavyac", 10);
cargo.addWeapons("dualflak", 5);
cargo.addWeapons("heavyblaster", 5);
cargo.addWeapons("lightdualac", 5);
cargo.addWeapons("lightag", 5);
cargo.addWeapons("lightneedler", 5);
cargo.addWeapons("heavymauler", 5);
cargo.addWeapons("gravitonbeam", 5);
cargo.addWeapons("hellbore", 5);
cargo.addWeapons("cyclone", 2);
cargo.addWeapons("pilum", 5);
cargo.addWeapons("taclaser", 5);
cargo.addWeapons("pulselaser", 5);
cargo.addWeapons("heavyburst", 5);
cargo.addWeapons("hil", 3);
cargo.addWeapons("hveldriver", 5);
cargo.addWeapons("reaper", 5);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_nomad_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_phoenix_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_phoenix_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_scissor_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_scissor_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_scissor_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_scissor_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_piker_Hull", null);
cargo.addMothballedShip(FleetMemberType.SHIP, "hp_piker_Hull", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "firefly_wing", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "firefly_wing", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "spike_wing", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "spike_wing", null);
cargo.addMothballedShip(FleetMemberType.FIGHTER_WING, "spike_wing", null);
cargo.addCrew(CrewXPLevel.ELITE, 25);
cargo.addCrew(CrewXPLevel.VETERAN, 250);
cargo.addCrew(CrewXPLevel.REGULAR, 500);
cargo.addCrew(CrewXPLevel.GREEN, 500);
cargo.addSupplies(630);
cargo.addFuel(500);
fleet.addAssignment(FleetAssignment.DELIVER_RESOURCES, convoyDestination, 1000);
fleet.addAssignment(FleetAssignment.GO_TO_LOCATION_AND_DESPAWN, getAnchor(), 1000);
}
return fleet;
}
}
so this is the "new" file its actually an old one since i removed some stuff to actually make the game start and it gives me this error on start up.
Spoiler
9546 [Thread-6] DEBUG com.fs.graphics.TextureLoader - Loading [graphics/ships/atlas_af.png] as texture with id [graphics/ships/atlas_af.png]
19557 [Thread-6] DEBUG com.fs.graphics.TextureLoader - Loaded 83,59 MB of texture data so far
19776 [Thread-6] INFO com.fs.profiler.Profiler - ID Calls Duration Percent
19776 [Thread-6] INFO com.fs.profiler.Profiler - --------------------------------
19789 [Thread-6] ERROR com.fs.starfarer.combat.String - java.lang.RuntimeException: Error compiling [data.scripts.world.HappyGen]
java.lang.RuntimeException: Error compiling [data.scripts.world.HappyGen]
at com.fs.starfarer.loading.scripts.ScriptStore$1.run(Unknown Source)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: Compiling unit "data/scripts/world/HappyGen.java"
at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:212)
at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:164)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: File data/scripts/world/HappyGen.java, Line 35, Column 27: No applicable constructor/method found for actual parameters "com.fs.starfarer.api.campaign.SectorAPI, com.fs.starfarer.api.campaign.StarSystemAPI, int, int, com.fs.starfarer.api.campaign.SectorEntityToken"; candidates are: "data.scripts.world.hpconvoySpawnPoint(com.fs.starfarer.api.campaign.SectorAPI, com.fs.starfarer.api.campaign.LocationAPI, float, int, com.fs.starfarer.api.campaign.SectorEntityToken, com.fs.starfarer.api.campaign.SectorEntityToken)"
at org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:9403)
at org.codehaus.janino.UnitCompiler.findMostSpecificIInvocable(UnitCompiler.java:6994)
at org.codehaus.janino.UnitCompiler.invokeConstructor(UnitCompiler.java:5975)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3797)
at org.codehaus.janino.UnitCompiler.access$69(UnitCompiler.java:3721)
at org.codehaus.janino.UnitCompiler$11.visitNewClassInstance(UnitCompiler.java:2978)
at org.codehaus.janino.Java$NewClassInstance.accept(Java.java:2918)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:3629)
at org.codehaus.janino.UnitCompiler.access$63(UnitCompiler.java:3552)
at org.codehaus.janino.UnitCompiler$11.visitMethodInvocation(UnitCompiler.java:2967)
at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:2993)
at org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:4017)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:2413)
at org.codehaus.janino.UnitCompiler.access$38(UnitCompiler.java:2412)
at org.codehaus.janino.UnitCompiler$8.visitMethodInvocation(UnitCompiler.java:2381)
at org.codehaus.janino.Java$MethodInvocation.accept(Java.java:2831)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2407)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:1426)
at org.codehaus.janino.UnitCompiler.access$8(UnitCompiler.java:1425)
at org.codehaus.janino.UnitCompiler$5.visitExpressionStatement(UnitCompiler.java:926)
at org.codehaus.janino.Java$ExpressionStatement.accept(Java.java:1447)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:946)
at org.codehaus.janino.UnitCompiler.compileStatements(UnitCompiler.java:972)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:2083)
at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:851)
at org.codehaus.janino.UnitCompiler.compileDeclaredMethods(UnitCompiler.java:832)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:528)
at org.codehaus.janino.UnitCompiler.compile2(UnitCompiler.java:421)
at org.codehaus.janino.UnitCompiler$3.visitPackageMemberClassDeclaration(UnitCompiler.java:376)
at org.codehaus.janino.Java$PackageMemberClassDeclaration.accept(Java.java:765)
at org.codehaus.janino.UnitCompiler.compile(UnitCompiler.java:383)
at org.codehaus.janino.UnitCompiler.compileUnit(UnitCompiler.java:352)
at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:210)
... 5 more
line 35
system.addSpawnPoint(new hpconvoySpawnPoint(sector, system, 1, 1, token));
funny part is that this line is not changed since the last version, so it must be giving an error because something is wrong with the code hes pointing at which is the conoy spawn.
which probaply crashes due to something i just edited and that is this part
Spoiler
public hpconvoySpawnPoint(SectorAPI sector, LocationAPI location,
float daysInterval, int maxFleets, SectorEntityToken anchor, SectorEntityToken convoyDestination) {
super(sector, location, daysInterval, maxFleets, anchor);
this.convoyDestination = convoyDestination;
If i would look at this with some reason i would say its because convoydestination is not given ,although i cant seem to find any file where convoy destination is defined ,so it might just be something else.