Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Anubis-class Cruiser (12/20/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.

Messages - rogerbacon

Pages: [1] 2 3 ... 11
1
Where do I mod to make blueprints for individual ships I've added to the game show up as bar quests or random drops? Do I need to have each ship individually listed in special_items.csv? I only listed the packs there right now.

2
I made a custom AI script for a ship system and I'm 99% sure its the cause of null reference crashes I'm having in combat. Here is the log:
Code
271369 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.combat.ai.o0OO.o00000(Unknown Source)
at com.fs.starfarer.combat.ai.BasicShipAI.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.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$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

And here is the class

Code
// 
// Decompiled by Procyon v0.5.36
//


package data.scripts.ai.systems;

import com.fs.starfarer.api.Global;
import org.lazywizard.lazylib.MathUtils;
import org.lwjgl.util.vector.Vector2f;
import com.fs.starfarer.api.combat.CombatEngineAPI;
import com.fs.starfarer.api.util.IntervalUtil;
import com.fs.starfarer.api.combat.ShipSystemAPI;
import com.fs.starfarer.api.combat.ShipwideAIFlags;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipSystemAIScript;
import com.fs.starfarer.api.util.Misc;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.List;

public class sfb_CloakingDevice_ai_simple implements ShipSystemAIScript
{
    private ShipAPI ship;
    private ShipwideAIFlags flags;
    private ShipSystemAPI system;
    private final IntervalUtil tracker;
private float cloakDuration = 0f;

   
    public sfb_CloakingDevice_ai_simple() {
        this.tracker = new IntervalUtil(0.75f, 1.0f);
    }
   
    public void init(final ShipAPI ship, final ShipSystemAPI system, final ShipwideAIFlags flags, final CombatEngineAPI engine) {
        this.ship = ship;
        this.flags = flags;
        this.system = system;
    }
   
    public void advance(final float amount, final Vector2f missileDangerDir, final Vector2f collisionDangerDir, final ShipAPI target) {
if (this.ship == null) {
return;
}

        this.tracker.advance(amount);
this.cloakDuration += amount;
boolean shouldAttack = false;
ShipAPI closestEnemy = null;
        if (this.tracker.intervalElapsed()) {
            if (this.system.isActive()) {
closestEnemy = FindClosestNonFighterShipWithOwner(this.ship, 1);
if (closestEnemy != null) {
if (!MathUtils.isWithinRange(closestEnemy.getLocation(), this.ship.getLocation(), 1000000.0f)) {
shouldAttack = true;
}
if ( IsCloakedShipBehind(this.ship, closestEnemy)) {
shouldAttack = true;
}
}
                if (!this.ship.areSignificantEnemiesInRange()
|| closestEnemy == null
|| shouldAttack
|| this.flags.hasFlag(ShipwideAIFlags.AIFlags.SAFE_VENT )) {
if (this.cloakDuration > 6f) {
ShipAPI myTarget = this.ship.getShipTarget();
if (myTarget != null && myTarget.getOwner() == 0) {
this.ship.setShipTarget(null); // try to prevent friendly fire when decloaking
}
this.system.deactivate();
}

                }
            }
            else if (this.ship.isRetreating() || this.flags.hasFlag(ShipwideAIFlags.AIFlags.IN_CRITICAL_DPS_DANGER)
|| this.flags.hasFlag(ShipwideAIFlags.AIFlags.BACKING_OFF )) {
                this.ship.useSystem();
this.cloakDuration = 0f;
            }
        }
    }

public static ShipAPI FindClosestNonFighterShipWithOwner(ShipAPI cloakedShip, int owner) {
        List<ShipAPI> allShips = Global.getCombatEngine().getAllShips(); 
        ShipAPI closestNonFighterShip = null;
        float closestDistance = Float.MAX_VALUE;
       
        for (ShipAPI ship : allShips) {
                if (ship.getOwner() == owner && !ship.isFighter() && !ship.isHulk()) {
                    float distance = MathUtils.getDistance(ship.getLocation(), cloakedShip.getLocation());
                    if (distance < closestDistance) {
                        closestNonFighterShip = ship;
                        closestDistance = distance;
                    }
                }
           
        } 
        return closestNonFighterShip;
    }

public static boolean IsCloakedShipBehind(ShipAPI cloakedShip, ShipAPI otherShip) {
        // Get the direction vector from otherShip to cloakedShip
        //Vector2f directionVector = MathUtils.getVector(otherShip.getLocation(), cloakedShip.getLocation());
       
        // Get the forward facing vector of otherShip
        Vector2f forwardVector = otherShip.getLocation();
       
float angle = Misc.getAngleInDegrees(cloakedShip.getLocation(), forwardVector);
        // Calculate the angle between direction vector and forward vector
        //float angle = MathUtils.getShortestRotation(forwardVector, directionVector);
       
        // Check if the angle is greater than 90 degrees
        return Math.abs(angle) > Math.PI / 2f;
    }
}


3
Modding / Null reference in my script somewhere
« on: June 24, 2024, 04:43:09 PM »

4
Here is another one from a new game.

I had just captured a station from Forces of Chaos, then they retook it (eliminating my faction) then I invaded it again. When I capture the station, it crashes. (I don't actually get the capture message, it crashes first but I know that I've captured it because the crash happens right on a new day when I have overwhelming ground forces).

This game, and all the mods, have been really stable for years. I don't know why all of a sudden its crashing.


323230 [Thread-3] INFO  exerelin.campaign.intel.groundbattle.GBUtils  - Setting garrison damage for Gluttony: 0.750
323230 [Thread-3] INFO  com.fs.starfarer.api.impl.campaign.events.RepTrackerEvent  - Sending rep change of 0.0 with the Forces of Chaos due to trade/smuggling
323820 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at exerelin.campaign.SectorManager.transferMarket(SectorManager.java:1137)
   at exerelin.campaign.SectorManager.transferMarket(SectorManager.java:1012)
   at exerelin.campaign.InvasionRound.conquerMarket(InvasionRound.java:442)
   at exerelin.campaign.intel.groundbattle.GroundBattleIntel.handleTransfer(GroundBattleIntel.java:961)
   at exerelin.campaign.intel.groundbattle.GroundBattleIntel.endBattle(GroundBattleIntel.java:1056)
   at exerelin.campaign.intel.groundbattle.GroundBattleIntel.checkForVictory(GroundBattleIntel.java:1152)
   at exerelin.campaign.intel.groundbattle.GroundBattleIntel.advanceTurn(GroundBattleIntel.java:1183)
   at exerelin.campaign.intel.groundbattle.GroundBattleIntel.advanceImpl(GroundBattleIntel.java:1424)
   at com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin.advance(BaseIntelPlugin.java:78)
   at exerelin.campaign.intel.groundbattle.GroundBattleIntel.advance(GroundBattleIntel.java:1389)
   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$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

[Edit]
I should point out that this is not the latest StarSector release. It is 0.96a-rc10, which makes it all the weirder since I haven't changed anything in months.

5
Can this work for missions as well as campaign?

6
Crash in campaign (heavily modded game but seems to be a missing music file from core game)

Log
782795 [Thread-8] INFO  sound.oo0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOO  - Cleaning up music with id [campaign_noncore_part1.ogg]
783282 [Thread-10] INFO  sound.oo0OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOO  - Creating streaming player for music with id [campaign_noncore_part1.ogg]
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
java.lang.NullPointerException
   at com.fs.starfarer.api.impl.campaign.econ.impl.OrbitalStation.matchStationAndComm anderToCurrentIndustry(OrbitalStation.java:422)
   at com.fs.starfarer.api.impl.campaign.econ.impl.OrbitalStation.notifyDisrupted(OrbitalStation.java:602)
   at com.fs.starfarer.api.impl.campaign.econ.impl.BaseIndustry.setDisrupted(BaseIndustry.java:1793)
   at com.fs.starfarer.api.impl.campaign.econ.impl.OrbitalStation.disrupt(OrbitalStation.java:619)
   at exerelin.campaign.intel.invasion.InvActionStage.autoresolve(InvActionStage.java:357)
   at exerelin.campaign.intel.invasion.InvActionStage.updateStatus(InvActionStage.java:180)
   at com.fs.starfarer.api.impl.campaign.intel.raid.BaseRaidStage.advance(BaseRaidStage.java:106)
   at com.fs.starfarer.api.impl.campaign.intel.raid.ActionStage.advance(ActionStage.java:25)
   at exerelin.campaign.intel.invasion.InvActionStage.advance(InvActionStage.java:81)
   at com.fs.starfarer.api.impl.campaign.intel.raid.RaidIntel.advanceImpl(RaidIntel.java:219)
   at exerelin.campaign.intel.fleets.OffensiveFleetIntel.advanceImpl(OffensiveFleetIntel.java:579)
   at com.fs.starfarer.api.impl.campaign.intel.BaseIntelPlugin.advance(BaseIntelPlugin.java:78)
   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$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

7
Modding / Re: [0.97a] Combat Background Enhanced v0.1
« on: April 12, 2024, 05:30:56 AM »
So, let me see if I understand correctly. It draws hulks and other objects on a lower level so they are visually there but no interaction with ships in combat. If that is correct I think it would be great if you could include a console command to move hulks in the combat layer down into your new layer over time. Sometimes the battlefield gets too cluttered and I think it's kinda silly in 3d space to have a wall of debris cutting me off from the enemy.

8
Mods / Re: [0.97a] Ship Mastery System (4/4/24)
« on: April 11, 2024, 11:21:03 AM »
I'm quite happy with Progressive S mods but I'd love to haev the ship recovery system from this mod. Many times I've known a battle is lost but don't want to retreat because I know I won't be able to recover lost ships. How hard would it be to have just this feature of this mod?

9

That'll be [0.96a] Order from the Boss by A-111164.

Thanks. I was going crazy trying to find it.

10
Is there a way to set a ship as untargetable? I see there is ship.isTargetable() but I didn't see a setter. Right now I have a workaround of setting it to the neutral team but that has some unintended consequences so I was hoping there was something obvious I'd missed.

11
Which mod was it that allowed you to issue some commands to another ship in combat? Specifically, you could hold down a key and get a 4-way popup menu that allowed you to order the ship to use it's shipSystem as one example.

12
How do I find a missile's target? I want to get a list of all missiles targeting a specific ship.

13
Modding / Re: [0.96.a-RC10] Alkemia Armoury
« on: February 08, 2024, 09:13:43 AM »
Does the Welder weapon on the Fixer Repair Drone actually repair armor? In the wpn file the beamEffect entry is just the ionBeam so I'm not sure where the logic is to make it repair stuff.

[Edit]

Never mind. I found it in the RepairDroneAi class.

14
Mods / Re: [0.96a] Space Truckin' v1.4a
« on: February 04, 2024, 07:03:46 AM »
Is there anyway to haev the USL representative available at factions that spawn later in the game? I know we can set where they appear at the beginning but when a new faction spawns mid-game the USL is not on those faction's planets.

15
Mods / Re: [0.96a] Hiver Swarm - V1.10 - 11/01/23
« on: January 23, 2024, 11:20:36 AM »
I found the conflict. In Starship Legends I had included the decompiled java files and sometimes that causes issues as it differs slightly from the compiled version. After removing them, it loads fine now.

I'm on episode 6 of your video series. I watch them at lunchtime. It's what motivated me to install the mod.

Pages: [1] 2 3 ... 11