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 ... 367 368 [369] 370 371 ... 706

Author Topic: Misc modding questions that are too minor to warrant their own thread  (Read 1700166 times)

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5520 on: October 30, 2019, 09:13:00 AM »

A really dumb question, especially since I've been modding for a moment now...

In hull.csv, what is the "8/6/5/4%" column for?
It's there to provide info while ship designing, similar to the "range" section near fuel. If I understand right, Alex had it set up on his spreadsheet to autofill based on the ship size and flux dissipation, to give a vague goal on flux capacity. A normal (frigate/destroyer/cruiser/capital) will have its dissipation be (8/6/5/4%) of its capacity. So for example, if a frigate had 80 dissipation, its "8%" column would be 80 / 0.08, or 1000, which you could use for the flux capacity stat if you wanted the ship to have a capacity:dissipation ratio in the normal range, or you can raise or lower the capacity to make a ship more or less efficient at dissipation compared to capacity. The column doesn't actually change the ship's stats, so you can leave it blank.
« Last Edit: October 30, 2019, 09:15:02 AM by Sinosauropteryx »
Logged

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5521 on: October 30, 2019, 11:02:30 AM »

How can I find out if a fleet is in emergency burn? I want to make a ship that increases its own max burn during emergency burns, is that possible?
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5522 on: October 30, 2019, 11:40:03 AM »

@Sundog: thank you for helping out here!
Or trying to, at least  ::)

Specifically I want blueprint packages to give individual blueprints instead, but a new plugin means it doesn't work unless the package calls the new plugin instead (which is problematic with mods).

Failing that, is there a way to (effectively) do a search and replace on which plugin a blueprint calls?
I'm not sure about any of that, but I think a better approach might be to remove/disable all blueprint packages and replace them with standalone blueprints. Of course, that might not work for what you're trying to do.

How can I find out if a fleet is in emergency burn? I want to make a ship that increases its own max burn during emergency burns, is that possible?
Neat idea. Maybe try something like this:
Code
    @Override
    public void advanceInCampaign(FleetMemberAPI member, float amount) {
        if(member.getFleetData().getFleet().getAbility(Abilities.EMERGENCY_BURN).isActive()) {
            member.getStats().getDynamic().getMod(Stats.FLEET_BURN_BONUS).modifyFlat("my_hullmod_id", 1);
        }
    }
Not sure if that'll work, and of course it needs a bunch of null checks.
By the way, you're making some pretty crazy stuff! I hope you keep it up  :)

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5523 on: October 30, 2019, 12:56:16 PM »

Maybe try something like this:
It works! I only had to change "isActive" to "isActiveOrInProgress," I suppose because emergency burn isn't a toggle.
Quote
I hope you keep it up  :)
Thanks, I will.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5524 on: October 30, 2019, 06:47:55 PM »

Or trying to, at least  ::)

Oh, definitely succeeding :D

Only thing I'd suggest for this:

member.getFleetData().getFleet().getAbility(Abilities.EMERGENCY_BURN)

Is checking that getAbility() doesn't return null. Some fleets may not have the Emergency Burn ability - iirc remnant fleets, the player's fleet early in the tutorial, some other enemy fleets - and in that case getAbility() will return null.
Logged

King Alfonzo

  • Admiral
  • *****
  • Posts: 679
  • -- D O C T O R --
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5525 on: October 30, 2019, 10:45:50 PM »

If you run the game in dev mode, the log will show a lot of stuff regarding which rule is picked and why, so I'd recommend looking at that.

So I've just done this several times with several tweaks and it's still not making sense. Here's the breakdown of the outputs that occur.
Spoiler



[close]

The fact that the custom dialogue I have for this station isn't showing up is pretty indicative that the game thinks this is something else, despite this thing being tagged and id'd in the original HMINightmare class file. Could it possibly have something to do with the custom_entities entry?

Code
		"hmi_station_nightmare":{
"defaultName":"Kiel Research Station", # used if name=null in addCustomEntity()
"defaultRadius":45, # used if radius<0 in addCustomEntity()
"nameInText":"Kiel research station",
"shortName":"station",
"customDescriptionId":"station_research_remnant",
"interactionImage":"graphics/illustrations/orbital_construction.jpg",
"icon":"graphics/icons/station0.png",
"iconWidth":20,
"iconHeight":20,
"sprite":"graphics/stations/station_side00.png",
"spriteWidth":40,
"spriteHeight":40,
"renderShadow":true,
"useLightColor":true,
"showInCampaign":true,
"showIconOnMap":true,
"showNameOnMap":false,
"scaleNameWithZoom":false,
"scaleIconWithZoom":true,
"tags":["has_interaction_dialog", "salvageable"],
"layers":[STATIONS], # what layer(s) to render in. See CampaignEngineLayers.java for possible values
},

Sorry for being a bother.

RustyCabbage

  • Captain
  • ****
  • Posts: 347
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5526 on: October 31, 2019, 02:02:06 AM »

Is there a way to reliably adjust maxShipsInAIFleet within the game, i.e. outside of directly editing settings.json? I threw the following piece of code together based very loosely on this means of adjusting maxIndustries:
Code: java
    public void AdjustMaxAIShips() {
        for (FactionAPI faction : Global.getSector().getAllFactions()) {
            FactionDoctrineAPI doctrine = faction.getDoctrine();
            if (doctrine.getNumShips() > HighestNumShips) {
                HighestNumShips = doctrine.getNumShips();
            }
        }
        int OverMax = (int) Math.floor((HighestNumShips-5)/2);
       
        int maxShipsInAIFleet = Global.getSettings().getInt("maxShipsInAIFleet");
        maxShipsInAIFleet = 30 + OverMax;
    }
I didn't really expect it to work, but I was surprised to find that it did work for stuff like Mining Fleets, Mercantile Convoys and some specific Hegemony Patrols, but it had no effect on more regular appearing fleets like Fast Pickets and wasn't reliable regardless. I'm expecting that in order to reliably change this for all fleets I'd have to actually modify FleetFactoryV3, but I'm hoping that this might be avoidable. Is this possible?

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5527 on: October 31, 2019, 07:54:03 AM »

I am trying to make a hullmod that adds the cargo capacity of the ship modules to the main ship, but it is not working, what I am doing wrong here?

Code
 @Override
    public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
    if(ship != null) {
    MutableShipStatsAPI stats = ship.getMutableStats();
    List<ShipAPI> modules = ship.getChildModulesCopy();
    if(stats != null && modules != null && !modules.isEmpty()) {
    float cargo = 0;
    for(ShipAPI m : modules) {
    cargo += m.getHullSpec().getCargo();
    }
    stats.getCargoMod().modifyFlat("ED_trainlocomotive", cargo);
    }
    }
    }
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5528 on: October 31, 2019, 10:27:41 AM »

If you run the game in dev mode, the log will show a lot of stuff regarding which rule is picked and why, so I'd recommend looking at that.

So I've just done this several times with several tweaks and it's still not making sense. Here's the breakdown of the outputs that occur.

Ahh, I mean starsector.log, not the on-screen output in the game.

Is there a way to reliably adjust maxShipsInAIFleet within the game, i.e. outside of directly editing settings.json? I threw the following piece of code together based very loosely on this means of adjusting maxIndustries:

Hmm, not really, no - the way it works for maxIndustries is... very situational. I did make some changes to SettingsAPI that makes it doable in the next release, though.

int maxShipsInAIFleet = Global.getSettings().getInt("maxShipsInAIFleet");
maxShipsInAIFleet = 30 + OverMax;

This doesn't actually do anything - "int maxShipsInAIFleet" is a local variable that is assigned the value returned by the getInt() method; changing it will not influence anything outside the method you're in.


I am trying to make a hullmod that adds the cargo capacity of the ship modules to the main ship, but it is not working, what I am doing wrong here?

That's just not going to work - ship modules don't have corresponding FleetMemberAPIs/stats/etc in the campaign. They only exist as variants, along with damage tracking. So, it's just functionally impossible to do what you're trying to do, their hullmods will never be applied in the campaign.

Further:
    public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
   
This method only gets called in combat.
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5529 on: October 31, 2019, 10:41:22 AM »

That's just not going to work - ship modules don't have corresponding FleetMemberAPIs/stats/etc in the campaign. They only exist as variants, along with damage tracking. So, it's just functionally impossible to do what you're trying to do, their hullmods will never be applied in the campaign.

Further:
    public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
   
This method only gets called in combat.
Correct me if I'm wrong, but it could be simulated through use of tags though?

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5530 on: October 31, 2019, 10:54:25 AM »

Correct me if I'm wrong, but it could be simulated through use of tags though?

I'm not sure what you mean?


It could probably be done with a hidden hullmod on the main ship's body going through and checking the variants, though, or some such... ah, maybe I've misread the original question - if the hullmod is not intended to apply to the modules, then that part of it isn't a problem, and just the use of applyEffectsAfterShipCreation is the issue.
Logged

Hoakin Blackforge

  • Ensign
  • *
  • Posts: 15
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5531 on: October 31, 2019, 11:06:44 AM »

What mods do i need for save editing? There is some stuff i want to test out. But im not sure what mods i have to download.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5532 on: October 31, 2019, 12:50:42 PM »

Are there API hooks to modify the list of portraits available to the player faction during the campaign (such as through using a rule command)?

I want to have a script that locks out all but the commissioned faction's portraits when taking on a commission (this will be optional) and reverting back to the settings list when resigning a commission.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5533 on: October 31, 2019, 01:37:45 PM »

What mods do i need for save editing? There is some stuff i want to test out. But im not sure what mods i have to download.
No mods are required, but it sounds like you might be looking for Console Commands. You can edit save files directly with any plaintext editor. Notepad++ is popular, free, lightweight, and extensible.

Are there API hooks to modify the list of portraits available to the player faction during the campaign (such as through using a rule command)?

I want to have a script that locks out all but the commissioned faction's portraits when taking on a commission (this will be optional) and reverting back to the settings list when resigning a commission.
Code: java
WeightedRandomPicker<String> portriatIDs = Global.getSector().getFaction(Factions.PLAYER).getPortraits(FullName.Gender.ANY);
From there, you should be able to modify portraitIDs any way you like.

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5534 on: October 31, 2019, 02:45:00 PM »


That's just not going to work - ship modules don't have corresponding FleetMemberAPIs/stats/etc in the campaign. They only exist as variants, along with damage tracking. So, it's just functionally impossible to do what you're trying to do, their hullmods will never be applied in the campaign.

Further:
    public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
   
This method only gets called in combat.
My objective would be having a modular ship and allow the player to swap any modules by some kind of dialogue option in a special station and have those modules change how the main ship operates, can that be done?
Logged
Check out my ships
Pages: 1 ... 367 368 [369] 370 371 ... 706