Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  


Starsector 0.97a is out! (02/02/24); New blog post: Codex Overhaul (05/11/24)

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - rogerbacon

Pages: [1] 2 3
Crash in campaign (heavily modded game but seems to be a missing music file from core game)

783283 [Thread-10] INFO  sound.H  - Playing music with id [campaign_noncore_part1.ogg]
783413 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
   at com.fs.starfarer.api.impl.campaign.econ.impl.OrbitalStation.matchStationAndComm anderToCurrentIndustry(
   at com.fs.starfarer.api.impl.campaign.econ.impl.OrbitalStation.notifyDisrupted(
   at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.setDisrupted(
   at com.fs.starfarer.api.impl.campaign.econ.impl.OrbitalStation.disrupt(
   at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
   at com.fs.starfarer.campaign.CampaignState.advance(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$ Source)
   at Source)

Modding / Help with Fatal: MISSILE weapons must fire missiles
« on: January 04, 2024, 07:30:59 PM »
I created a weapon and it works fine when I fire it. However, if I set my ship to AI control the game crashes with the message in the title.

proj file
"explosionColor":[68,250,50,255],  # purely visual
"explosionRadius":30, # purely visual

"id":"SFB_Mine_Caster",  # this id must match what's in the spreadsheet


"turretOffsets":[28, 0],
"hardpointOffsets":[28, 0],

"barrelMode":"LINKED", # or ALTERNATING.  whether barrels fire at the same time or alternate.

"muzzleFlashSpec":{"length":50.0,   # only used if animationType = MUZZLE_FLASH

"autocharge":true,  # whether the weapon will continue charging and fire if the LMB is tapped instead of held
"projectileSpecId":"sfb_mine_caster_shot",  # projectile that will be fired

I also tried copying an existing missile proj file and replacing stuff specific to my proj but this crashes the game on load with the useless message "Fatal: null" and nothing in the log file
"explosionColor":[255,255,100,255],  # purely visual, will get a white additively blended core on top of this color
"explosionRadius":90, # purely visual
"loc":[-6, 0],
"mode":"QUAD_STRIP", # PARTICLES or QUAD_STRIP, determines which params are used
"contrailWidthAddedFractionAtEnd":1,  # can be negative. makes trail spread out/narrow at the end
"contrailMinSeg":5, # min segment length, in pixels
#"contrailSpawnDistMult":0f, # how far away from engine it starts
"type":"SMOKE" # GLOW or SMOKE; additive or regular blend mode
Any help would be appreciated.

General Discussion / My shipyard stopped building ships
« on: October 16, 2023, 06:59:09 PM »
For some reason my shipyards have stopped building ships. I've had a small order in for months and it never finishes. The shipyards are not disrupted and I've cleared the queue and resubmitted it many times. Has anyone ever had this happen and/or know why it happens?

General Discussion / Why is the sell price one credit?
« on: September 30, 2023, 07:46:00 AM »
According to the F1 information at the port, this commodity is supposed to sell for 358 but it is only selling for 1. Why is that?

{edit] It seems that if I click on the planet it is 1 credit but if I click on the orbital station it is the correct price. I never realized there was a difference.

I'm staging a series of computer vs computer fights for testing and I've never noticed the enemy ships start having malfunctions. I even made a player ship with 10 minutes of combat readiness and it ran out while the enemy ships continued to be fine. Does combat readiness decrease only affect player ships?

I've owned the game since near the beginning and I've been launching it every day for the past few months. Why would it ask for the key now? I had a Java update but that's the only thing in common with StarSector that I can think of. Luckily, I had the key.

Modding / ChatGPT understands StarSector's API
« on: March 28, 2023, 05:01:36 PM »

Alex may not have to answer so many questions in the future.

Modding / Help wityh phasor effect please
« on: February 18, 2023, 07:49:40 PM »
Hello all. I've made a phasor effect that when applied to a limited duration beam like the phase lance or similar weapons causes the beam to 'move' from the point of aim off to the left or right up to 10 degrees. So it strafes over the target (and some of it probably misses).
It works by changing the weapon offset when it fires so the beam moves from initial position to the new offset. After it fires I reset the offset so it's ready to fire again.
The problem occurs if the battle ends before the weapons finishes firing (including the cooldown time).  Then the default aim position is offset by whatever it was last time it fired. So, the beam will always miss. My code is below. It was originally based on another mod where they had the beam sweep back and forth, but that's not exactly what I want in mine.
If anyone can see how to make sure the offsets are always reset, regardless of when the battle ends I would appreciate it. Of course if I'm totally doing this the hard way and there is an easier way that would be great too.

Note : ANGLES is an arraylist in the code but it has only one item. It was leftover from the original SCY code that had more than one intem.
package data.scripts.weapons;
import java.lang.Math;
//import com.fs.starfarer.api.combat.BeamAPI;
//import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lazywizard.lazylib.combat.CombatUtils;
//import org.lazywizard.lazylib.VectorUtils;
import java.awt.Color;
import java.util.*;
import org.lazywizard.console.Console;
import org.lwjgl.util.vector.Vector2f;

import com.fs.starfarer.api.Global;
import org.lwjgl.util.vector.ReadableVector2f;
import org.lazywizard.lazylib.FastTrig;
import java.util.Collection;
import com.fs.starfarer.api.combat.WeaponAPI;
import java.util.ArrayList;
import java.util.List;
import com.fs.starfarer.api.combat.EveryFrameWeaponEffectPlugin;

public class phasorEffect implements EveryFrameWeaponEffectPlugin

private float timer=0, randomization=0, perShotRandom = 0;
    private Vector2f muzzle= new Vector2f();
    private boolean  runOnce=false , hasFired=false, setInitialRandom = false;;
    private ArrayList<java.lang.Float> ANGLES = new ArrayList<java.lang.Float>();
private ArrayList<java.lang.Float> originalAngles = new ArrayList<java.lang.Float>();
//public static boolean runOnce=false ;
    public phasorEffect() {
        this.randomization = 0.0f;


    public void advance(float amount, CombatEngineAPI engine, final WeaponAPI weapon)

if (engine.isPaused()) {
        //get the base offsets
// This still runs every frame at start of combat until I fire once
            ANGLES=new ArrayList<java.lang.Float>(weapon.getSpec().getTurretAngleOffsets());

// store original angles
for(int i=0; i<ANGLES.size(); i++){
if (originalAngles.size() == 0){
// Console.showMessage("setting orig angle " + i + " to " + ANGLES.get(i));

            randomization= (float)Math.random()*10;
            } else if(weapon.getSlot().isTurret()){
        //move the offsets while firing
if (!setInitialRandom) {
//Console.showMessage("setting new random at " + timer);
perShotRandom = (float)Math.random()*10 - 5f;
setInitialRandom = true;
//timer = 0;

            for(int i=0; i<ANGLES.size(); i++){
                //float offset=(float)FastTrig.cos(5*(timer+i+randomization))*2;
float offset=(float)FastTrig.cos(5*(perShotRandom+i+randomization))*10;

offset = offset * timer/2f;
java.lang.Float myAngle = (java.lang.Float)ANGLES.get(i);
                weapon.getSpec().getTurretAngleOffsets().set(i, myAngle+offset);
        if(weapon.getChargeLevel()==1 && !hasFired){
            //weapon glow
            Vector2f LOC = new Vector2f(weapon.getLocation());
            Vector2f.add(LOC, muzzle, LOC);
                    new Color(50,100,255,255)
        } else if(hasFired && weapon.getChargeLevel()==0){
timer = 0f;
setInitialRandom = false;
this.randomization = (float)Math.random()*10;
// Reset turret angles for next time
for(int i=0; i<ANGLES.size(); i++){
weapon.getSpec().getTurretAngleOffsets().set(i, originalAngles.get(i));


Bug Reports & Support (modded) / Suddenly all of my fights are retreats
« on: February 05, 2023, 07:54:00 PM »
So this is strange. Suddenly every fight I accept, my ships are being pursued like I elected to run away. Even when I elect to pursue a fleet that is reluctant to fight I'm the one that is set as teh running away fleet. Has anyone else encountered this? Very confusing.

General Discussion / Does the campaign use dynamic ship generation?
« on: December 30, 2022, 05:59:53 PM »
Are the ships we encounter in the campaign put together dynamically (hull + weapons + hull mods) or do they have to exist as a variant already?

Modding / Adding inaccuracy to a beam?
« on: December 29, 2022, 03:54:50 PM »
I'd like a beam that 'rakes' across an area of space where it's aimed at instead of hitting with perfect accuracy. I tried editing the min.max spread in the csv but that's only for projectiles.

My thought now is to get the angle of the beam relative to the firing ship and move it +/- some amount every second. However, it seems all methods in BeamAPI are getters and not setters so I'm not sure how I would, programmatically, move the beams target point.
Any suggestions?

I'm trying to make a weapon that abosrbs flux over time and then , when it fires, does bonus damage equal to the flux it has absorbed.
My code is below. I have a class implementing BeamEffectPlugin and a listener class. The listener is adding teh flux to the battery but when I fire the weapon the check for this.ML.fluxBattery > 0  always fails. It knows what the listener is because if I print some other value like FLUX_PER_SECOND_CHARGE_RATE  from this.ML, it knows what that is.
I hope someone can tell me what I'm doing wrong here.

package data.scripts.weapons;
import java.lang.Math;
import com.fs.starfarer.api.combat.*;
import com.fs.starfarer.api.combat.BeamAPI;
import com.fs.starfarer.api.combat.BeamEffectPlugin;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.combat.CombatEntityAPI;
import com.fs.starfarer.api.combat.DamageType;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import org.lazywizard.lazylib.combat.CombatUtils;
import com.fs.starfarer.api.combat.listeners.AdvanceableListener;
import org.lazywizard.lazylib.VectorUtils;
import org.lazywizard.lazylib.MathUtils;
import org.lazywizard.console.Console;
import org.lazywizard.lazylib.CollisionUtils;
import com.fs.starfarer.api.combat.FluxTrackerAPI;
import com.fs.starfarer.api.loading.DamagingExplosionSpec;
import java.awt.Color;
import java.util.*;
import org.lwjgl.util.vector.Vector2f;
import static com.fs.starfarer.api.util.Misc.ZERO;

public class PlasmaMaulerEffect implements BeamEffectPlugin
public boolean listenerAttached = false;
public MaulerListenerScript ML = null;
public ShipAPI firer = null;

    public void advance(float amount, CombatEngineAPI engine, BeamAPI beam)
if (!listenerAttached) {
listenerAttached = true;
this.firer = beam.getSource();
this.ML  = new MaulerListenerScript(this.firer);
if (!beam.getSource().hasListenerOfClass(ML.getClass())) {

if (this.ML == null) {
Console.showMessage("ML is null");
CombatEntityAPI target = beam.getDamageTarget();
if (this.ML.fluxBattery > 0 /* && beam.getBrightness() >= 1f && target instanceof ShipAPI */) {

Console.showMessage("*Flux battery*: " + this.ML.fluxBattery);

// TODO: add damage here
                        // Drain the batteries
this.ML.fluxBattery = 0;


public class MaulerListenerScript implements AdvanceableListener {
private ShipAPI ship;
private FluxTrackerAPI fluxTracker = null;
public float fluxBattery = 0f;
private float time;
public float FLUX_PER_SECOND_CHARGE_RATE = 400f;
private float MAX_BATTERY_CAPACITY = 8000f;

public MaulerListenerScript(ShipAPI ship) {
this.ship = ship;
this.fluxTracker = ship.getFluxTracker();

public void advance(float amount) {
// increment our timer to collect fluxBattery
time += amount;
if (time > 1f)

// move flux into the battery
float amountOfFluxToRemove = FLUX_PER_SECOND_CHARGE_RATE * time;
float currentFlux = fluxTracker.getCurrFlux();
if (amountOfFluxToRemove > currentFlux) {
amountOfFluxToRemove = currentFlux;
this.fluxBattery += amountOfFluxToRemove;
if (this.fluxBattery > MAX_BATTERY_CAPACITY)
this.fluxBattery = MAX_BATTERY_CAPACITY;

//Console.showMessage("Flux battery: " + this.fluxBattery);
//Console.showMessage("Current flux level: " + fluxTracker.getFluxLevel());
time = 0f;


General Discussion / Friendly fire, collisions turned off?
« on: December 22, 2022, 01:18:17 PM »
I don't know if they removed friendly fire and collisions or if I accidentally turned them off but I miss it. Can anyone tell me if this is a setting somewhere? Or if it's modded, the command that disables it so I can search for it in my installed mods.

Modding / Is it possible to modify which proj a weapon fires during combat
« on: December 11, 2022, 06:11:46 AM »
I want to make a weapon that has two modes, call them slug and shotgun. All the differences between them are in the proj class that the weapon fires. Is it possible to bind a hotkey that changes what proj a weapon fires and be able to call it during combat?
I see in the WeaponSpecAPI there is a GetProjectileSpec() but I don't see any setter method.

Modding / How to create a hullmod that provides benefit based on hull size
« on: December 08, 2022, 03:44:44 PM »
I want to create a hull mode that reduces the fuel used by small ships. I assume I do that in applyEffectsAfterShipCreation() like many examples I've seen. However, I need a reference to the shipAPI for the ship the mod is going on, right? How do I get that?
Once I have it I think I can use ship.getMutableStats().getFuelUseMod().modifyFlat(id, -1f); to do what I want.

Thanks in advance for any help.

Pages: [1] 2 3