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: Simulator Enhancements (03/13/24)

Pages: 1 ... 80 81 [82] 83 84 ... 93

Author Topic: [0.96a] Console Commands v2023.05.05  (Read 1536089 times)

Damonvi

  • Ensign
  • *
  • Posts: 18
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1215 on: September 17, 2022, 01:19:16 AM »

editing conditions is easy. what i was looking for was for the planet to visually change in relation to the type it's given.

in my example. if i went to a barren planet, and did "addcondition cryovolcanic", the planet will still be labeled as barren, have the jpeg of a barren planet, but the only change will be that it now has a wide condition icon saying it's now a cryovolcanic planet.

i was hoping the edit would update the visuals of the planet, as well as changing it's typing.
Logged

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2846
  • Your Friendly Forum Friend
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1216 on: September 17, 2022, 06:45:48 PM »

Did you try leaving the system then re-entering it? Or leaving, saving, reloading and re-entering it to see if it updates?
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

tigartar

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1217 on: September 18, 2022, 09:21:43 PM »

For anyone who wants to make a planet orbit around another planet

runcode PlanetAPI planet = (PlanetAPI) $loc.getEntityById("desired planet"); $loc.addPlanet("cc_barren", planet, "Barren World", "barren", VectorUtils.getAngle(planet.getLocation(), $playerLoc), 150, MathUtils.getDistance(planet.getLocation(), $playerLoc), 120)

Change "desired planet" to the planet you want it to be orbiting around (can be gained by typing list planets in console)
Change "cc_barren" to something fitting(Not too sure right now what it does again)
Change "Barren World" to your desired name
Change "barren" to the type of world(can be gained by typing list conditions)
Change the 150 before mathUtils for size
Change the 120 at the end for planet_orbit_length


If you are not happy with the planet you made dock at it and run the below code to get rid off it

runcode SectorEntityToken ent = Global.getSector().getCampaignUI().getCurrentInteractionDialog().getInteractionTarget(); if (ent.getMarket() != null) Global.getSector().getEconomy().removeMarket(ent.getMarket()); ent.getContainingLocation().removeEntity(ent);


Am still trying to figure out how to write the adding market data so for now it is just a blank planet (Maybe someone knows how we can do it based on type so that we don't have to manually pick and choose?)

And for spawning a general planet to move around a star run the following code

runcode PlanetAPI star = ((StarSystemAPI) $loc).getStar(); $loc.addPlanet("cc_barren", star, "Barren World"", "barren", VectorUtils.getAngle(star.getLocation(), $playerLoc), 150, MathUtils.getDistance(star.getLocation(), $playerLoc), 120)

To get a planet to follow a specific star in your system run the following code and change "change to star name" to the star you found in the list planets it would look something like this
"system_a488" < this is your main star
"system_a488_b < this is your second star And so on

runcode PlanetAPI star = (PlanetAPI) $loc.getEntityById("change to star name"); $loc.addPlanet("cc_barren", star, "Barren World", "barren", VectorUtils.getAngle(star.getLocation(), $playerLoc), 150, MathUtils.getDistance(star.getLocation(), $playerLoc), 120)

I hope this will help for the few of us who keep asking how to do this, once i find out or someone shares with me how to add conditions based on planet type i will update this post to include that
« Last Edit: September 18, 2022, 11:53:01 PM by tigartar »
Logged

Sigma Draconis

  • Ensign
  • *
  • Posts: 15
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1218 on: September 19, 2022, 01:12:50 PM »

I have a weird issue where sometimes when i use the list ships command the console stops being able to list ships, saying that there are no ships in the game.

Here's the img link for it:
https://media.discordapp.net/attachments/939876903693729834/1021513888086368376/IMG_20220919_171045458.jpg
Logged

Damonvi

  • Ensign
  • *
  • Posts: 18
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1219 on: September 24, 2022, 07:05:03 PM »

Did you try leaving the system then re-entering it? Or leaving, saving, reloading and re-entering it to see if it updates?


found a different way of handling it. utilized a terraforming mod to get a frozen/tundra planet from a barren planet, instead of just editing the barren planet, and just added extreme cold condition from commands.


on a different note, is there a way to add nebula clouds to a system? i use a mod called "ramscoop", which syphons fuel and supplies from nebulas (not hyperspace nebulas), and i found/made the perfect system, however, it doesnt have a nebula, so i cant "top up for free, but time". any of you mega-brained guys know how to spawn one of those clouds in, or is that out of reach?
Logged

rarewhalerw

  • Ensign
  • *
  • Posts: 21
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1220 on: September 25, 2022, 06:47:48 AM »

Did you try leaving the system then re-entering it? Or leaving, saving, reloading and re-entering it to see if it updates?
Is there any way to make all faction go war without typing "setrelation all (faction) -100" 1 by 1?
Logged

TheLemu

  • Ensign
  • *
  • Posts: 19
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1221 on: September 25, 2022, 12:32:06 PM »

Is there any way to make all faction go war without typing "setrelation all (faction) -100" 1 by 1?
You can use the 'alias' command to string together several relation commands like for example:
"alias war setrelation all Hegemony -100; setrelation all (faction) -100; (...)" and so on until you list all the factions you're playing with.
Afterwards you'll just need to type in "war" into the console to trigger an all-out war. This command will work on all saves and subsequent new playthroughs.
Logged

Lethargic

  • Ensign
  • *
  • Posts: 8
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1222 on: September 29, 2022, 01:15:29 PM »

Hello i found something annoying that makes it unable to list ships or hull, has anyone ever had this problem before?
Logged

cytokine

  • Lieutenant
  • **
  • Posts: 59
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1223 on: October 02, 2022, 02:12:16 AM »

I tried using the Traitor command in the sim, but it accepts no arguments, and it wont let me click on things?

Also, why would Spawnfleet not "match vanilla fleet compositions"?
edit: spawnfleet player 200 seems to follow your current faction doctrine, so maybe the disclaimer is outdated.
« Last Edit: October 02, 2022, 02:24:24 AM by cytokine »
Logged

Cry0genic

  • Ensign
  • *
  • Posts: 8
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1224 on: October 03, 2022, 08:08:29 AM »

Did you try leaving the system then re-entering it? Or leaving, saving, reloading and re-entering it to see if it updates?

I did, and neither worked. The wide-icon conditions simply disappear, although checking through the console reveals that it still has those conditions. However, nothing is changed in regards to how the planet performs, or what texture it uses.
Logged

NoCleverness

  • Ensign
  • *
  • Posts: 10
    • View Profile
Re: [0.95a] Console Commands v2021.03.27
« Reply #1225 on: October 07, 2022, 02:45:36 PM »

Some handy snippets to be saved in this thread.

Change limit of industries on planet:
Code
runcode String marketName = "YourPlanetMarket"; int modifier = 10; MarketAPI market = CommandUtils.findBestMarketMatch(planetName); if (market == null) { Console.showMessage("Error - market not found: " + marketName); return; } market.getStats().getDynamic().getMod("max_industries").modifyFlat("playerCustomIndustryMod", modifier);
Market IDs can be listed with "list markets".
[close]

Add industry or structure to build queue
Code
runcode import com.fs.starfarer.api.util.MutableValue; String marketName = "YourMarketName"; String industryID = "QueuedIndustryID"; IndustrySpecAPI spec = Global.getSettings().getIndustrySpec(industryID); if (spec == null) { Console.showMessage("Error - industry not found: " + industryID); return; } int industryCost = (int)spec.getCost(); MutableValue credits = Global.getSector().getPlayerFleet().getCargo().getCredits(); if (industryCost > (int) credits.get()) { Console.showMessage("Error - too expensive:" + industryCost); return; } credits.subtract(industryCost); MarketAPI market = CommandUtils.findBestMarketMatch(marketName); if (market == null) { Console.showMessage("Error - market not found: " + marketName); return; } if (market.getConstructionQueue().hasItem(industryID)) { Console.showMessage("Error - market already has " + industryID); return; } market.getConstructionQueue().addToEnd(industryID, industryCost); Console.showMessage("Success - queued construction of " + industryID + " on " + marketName + " for " + industryCost);
Building IDs can be listed with "list industries".
UI currently supports only 12 buildings and shows them in sorted order, no matter the sequence in which player added them. If building over the UI limit, hidden (last sorted) ones would be: ground defense, patrol hq, cryo revival facility.
[close]

Add a perfect planet with moon and satellites at fleet location
Code
runcode import com.fs.starfarer.api.util.Misc; String planetName = "YourPlanetName"; String moonName = "YourMoonName"; float planetOrbitDays = 180; float planetSize = 200; float moonOrbitRadius = planetSize * 4; float moonRadius = planetSize / 4; float moonOrbitDays = 40; Vector2f playerCoords = $playerFleet.getLocation(); float angleCCW = Misc.getAngleInDegreesStrict(playerCoords); StarSystemAPI sys = (StarSystemAPI)$playerFleet.getContainingLocation(); PlanetAPI star = sys.getStar(); float orbitRadius = Misc.getDistance(star.getLocation(), playerCoords); PlanetAPI planet = sys.addPlanet(planetName, star, planetName, "terran", angleCCW, planetSize, orbitRadius, planetOrbitDays ); MarketAPI market = sys.getEntityById(planetName).getMarket(); market.addCondition("organics_plentiful"); market.addCondition("farmland_bountiful"); market.addCondition("ore_ultrarich"); market.addCondition("rare_ore_ultrarich"); market.addCondition("volatiles_plentiful"); market.addCondition("habitable"); market.addCondition("mild_climate"); market.addCondition("solar_array"); PlanetAPI moon = sys.addPlanet(moonName, planet, moonName, "terran", 0, moonRadius, moonOrbitRadius, moonOrbitDays); market = sys.getEntityById(moonName).getMarket(); market.addCondition("organics_plentiful"); market.addCondition("farmland_bountiful"); market.addCondition("ore_ultrarich"); market.addCondition("rare_ore_ultrarich"); market.addCondition("volatiles_plentiful"); market.addCondition("habitable"); market.addCondition("mild_climate"); market.addCondition("solar_array"); sys.addCustomEntity(null, null, "comm_relay", "player").setCircularOrbitPointingDown(planet, 90, moonOrbitRadius, moonOrbitDays); sys.addCustomEntity(null, null, "nav_buoy", "player").setCircularOrbitPointingDown(planet, 180, moonOrbitRadius, moonOrbitDays); sys.addCustomEntity(null, null, "sensor_array", "player").setCircularOrbitPointingDown(planet, 270, moonOrbitRadius, moonOrbitDays);
Code of adding a derelict cryosleeper was posted somewhere in this thead. Reposting it here:
Spoiler
Code
runcode PlanetAPI star = ((StarSystemAPI) $loc).getStar(); if (star != null) { $loc.addCustomEntity(null, null, "derelict_cryosleeper", "player").setCircularOrbitPointingDown(star, VectorUtils.getAngle(star.getLocation(), $playerFleet.getLocation()), MathUtils.getDistance(star.getLocation(), $playerFleet.getLocation()), 400f); }
[close]
[close]

Add satellites at system center
Code
runcode $loc.addCustomEntity(null, null, "comm_relay", "player").setFixedLocation(0,0);$loc.addCustomEntity(null, null, "nav_buoy", "player").setFixedLocation(0,0);$loc.addCustomEntity(null, null, "sensor_array", "player").setFixedLocation(0,0);
[close]

This console mod is awesome. Game API and scripts, provided with installation, are very handy. I can't think of other game that provided such raw access to everything, for those situations when you're not content with how things are.
Is there a way to run this without spawning the nav buoy and such? I tried deleting the parts that spawn them, but keep getting a nullpointer error. Also, is there a way to spawn the solar array entities in orbit?
Logged

MadLSA97

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1226 on: October 08, 2022, 02:56:16 AM »

Hey, so this is my first post and I have basically no coding knowledge, but I really want to spawn an asteroid ring around my star. I have a minning station, but after using DIY's project Genesis to build a planet I realised that it deleted ALL the asteroid rings, not only the one in which you activate it.

If someone could help me I'd apreciate it
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3786
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1227 on: October 11, 2022, 05:33:18 PM »

Hey, so this is my first post and I have basically no coding knowledge, but I really want to spawn an asteroid ring around my star. I have a minning station, but after using DIY's project Genesis to build a planet I realised that it deleted ALL the asteroid rings, not only the one in which you activate it.

If someone could help me I'd apreciate it

While your fleet is in the system you want an asteroid belt in, call up console commands, and run something like this:
Code
runcode StarSystemAPI system = (StarSystemAPI)Global.getSector().getPlayerFleet().getContainingLocation();
system.addAsteroidBelt( system.getCenter(), 80, 3000, 200, 400, 460 );
Adjust numbers to taste; they are, in order: number of asteroids, radius of asteroid belt (how far it is from the star - 2000 is one grid-square on the map), width of asteroid belt, minimum days to orbit, maximum days to orbit.
(There's a second addAsteroidBelt method that also takes a terrainID string and a asteroid belt name string, but... I don't actually know what needs to go into the terrainID field.)



And while I'm here, here's a useful little script I worked out for adding a convenient gate when using a nex own-faction start (that will almost certainly not put you in a system with a gate.)
Note that this requires you to be docked at the planet you want to put a gate around.
Code
runcode SectorEntityToken planet = $context.getMarket().getPrimaryEntity();
LocationAPI system = planet.getContainingLocation();
CustomCampaignEntityAPI gate = system.addCustomEntity( null, null, "inactive_gate", "neutral" );
gate.setCircularOrbit( planet, 0, 800, 300 );

And create a randomized level 7 officer (for when the ones the game gave you were just bad):
Code
runcode PersonAPI pers = com.fs.starfarer.api.impl.campaign.events.OfficerManagerEvent.createOfficer( Global.getSector().getFaction( Factions.PLAYER ), 7, com.fs.starfarer.api.impl.campaign.events.OfficerManagerEvent.SkillPickPreference.ANY, false, Global.getSector().getPlayerFleet(), true, true, 5, null ); Global.getSector().getPlayerFleet().getFleetData().addOfficer( pers )
« Last Edit: October 27, 2022, 05:10:48 PM by Wyvern »
Logged
Wyvern is 100% correct about the math.

Hyperion505

  • Ensign
  • *
  • Posts: 10
    • View Profile
Re: [0.95a] Console Commands v2021.04.10
« Reply #1228 on: October 18, 2022, 03:49:57 AM »

Is there a way to copy something on the console to the clipboard? for example if i listed all ships could i copy it all to my clipboard?

I'd like to know if this would be possible a well.

Edit: Also, is it possible to change a stars' type? Like change a neutron star to something else?
« Last Edit: October 19, 2022, 03:59:48 PM by Hyperion505 »
Logged

Nalesh

  • Ensign
  • *
  • Posts: 14
    • View Profile
Re: [0.95.1a] Console Commands v2021.12.25
« Reply #1229 on: October 25, 2022, 11:36:03 PM »

Is there a way to change relations with a character, not a faction?
Logged
Pages: 1 ... 80 81 [82] 83 84 ... 93