1
Mods / Re: [0.97a] Console Commands v2024.10.04
« on: March 28, 2025, 12:50:40 PM »
can someone explain why this command is not working for planets I didn't place myself. it is from this same thread, the last post on page 55
it throws this error unless i created the planet. I even tried to copy and paste the id directly from the list command, and it still throws the error.
Code
runcode String _planetId = "Planet_ID";
SectorEntityToken _fleet = Global.getSector().getPlayerFleet();
StarSystemAPI _sys = (StarSystemAPI)_fleet.getContainingLocation();
SectorEntityToken _planet = _sys.getEntityById(_planetId);
float _orbitRadius = com.fs.starfarer.api.util.Misc.getDistance(_fleet.getLocation(), _planet.getLocation());
float _orbitDays = _orbitRadius / (20f + new Random().nextFloat() * 10f);
_sys.addRingBand(_planet,
"misc",
"rings_special0",
512,
1,
Color.RED,
256,
_orbitRadius,
_orbitDays)
it throws this error unless i created the planet. I even tried to copy and paste the id directly from the list command, and it still throws the error.
Code
2121426 [Thread-2] ERROR org.lazywizard.console.Console - Execution failed:
java.lang.NullPointerException: Cannot invoke "com.fs.starfarer.api.campaign.SectorEntityToken.getLocation()" because "<local3>" is null