Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.98a is out! (03/27/25)

Pages: 1 ... 763 764 [765] 766 767 ... 772

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

vicegrip

  • Captain
  • ****
  • Posts: 334
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11460 on: April 08, 2025, 03:04:50 PM »

Is there an easy way to determine via code if the current ship fittings are over its total OP budget (as in when the fitting bar goes red in vanilla)?

float

  • Captain
  • ****
  • Posts: 416
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11461 on: April 08, 2025, 06:17:58 PM »

Is there an easy way to determine via code if the current ship fittings are over its total OP budget (as in when the fitting bar goes red in vanilla)?
If
Code
variant.getHullSpec().getOrdnancePoints(stats) - variant.computeOPCost(stats)

is negative, where stats is your character stats (I guess it would be the fleet's commander's stats, in this case).
Logged

vicegrip

  • Captain
  • ****
  • Posts: 334
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11462 on: April 08, 2025, 07:22:23 PM »

Is there an easy way to determine via code if the current ship fittings are over its total OP budget (as in when the fitting bar goes red in vanilla)?
If
Code
variant.getHullSpec().getOrdnancePoints(stats) - variant.computeOPCost(stats)

is negative, where stats is your character stats (I guess it would be the fleet's commander's stats, in this case).

Hmmm, that is the way I am currently doing it, but some other mods that alter OP is causing this "is leftover OP negative" check to trip before OP is filled out on the ship. However the game UI is still showing the correct totals.

float

  • Captain
  • ****
  • Posts: 416
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11463 on: April 08, 2025, 08:03:30 PM »

Is there an easy way to determine via code if the current ship fittings are over its total OP budget (as in when the fitting bar goes red in vanilla)?
If
Code
variant.getHullSpec().getOrdnancePoints(stats) - variant.computeOPCost(stats)

is negative, where stats is your character stats (I guess it would be the fleet's commander's stats, in this case).

Hmmm, that is the way I am currently doing it, but some other mods that alter OP is causing this "is leftover OP negative" check to trip before OP is filled out on the ship. However the game UI is still showing the correct totals.
That's odd, can't say I've ever run into that issue. Could be an ordering thing, e.g. you're running the check before the other mod's adjustment actually takes effect, but hard to say for sure. I'd run a debugger and check your variant's OP total and op spent before the check you're making.
Logged

NikoTheGuyDude

  • Admiral
  • *****
  • Posts: 508
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11464 on: April 08, 2025, 09:25:40 PM »

I'm going to go insane. I feel like this has to be inflater schenanigans, and I thought I fixed it, but I might be wrong.

I'm trying to make custom fleets. I want the ships in these fleets to have smods, dmods, a custom hullmod, and a special weapon loadout (omega).

But every time the game saves, all these modifications are erased, and I'm left with a dmodless, smodless, normally equipped derelict ship. It's on game save,  not load.

https://github.com/nikothedude/MorePlanetaryConditions/blob/master/src/data/scripts/campaign/magnetar/niko_MPC_derelictOmegaFleetConstructor.kt#L141-L172 Here's what I do. I inflate, then I null inflater. So why is this happening? Any ideas at all? I've had to deal with this issue on so many different parts of my mod I'm going to start going insane pretty soon.
Logged

float

  • Captain
  • ****
  • Posts: 416
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11465 on: April 08, 2025, 10:11:20 PM »

I'm going to go insane. I feel like this has to be inflater schenanigans, and I thought I fixed it, but I might be wrong.

I'm trying to make custom fleets. I want the ships in these fleets to have smods, dmods, a custom hullmod, and a special weapon loadout (omega).

But every time the game saves, all these modifications are erased, and I'm left with a dmodless, smodless, normally equipped derelict ship. It's on game save,  not load.

https://github.com/nikothedude/MorePlanetaryConditions/blob/master/src/data/scripts/campaign/magnetar/niko_MPC_derelictOmegaFleetConstructor.kt#L141-L172 Here's what I do. I inflate, then I null inflater. So why is this happening? Any ideas at all? I've had to deal with this issue on so many different parts of my mod I'm going to start going insane pretty soon.

On save suggests that the fleet is deflated on save (and, quick check of the code, this does happen in CampaignFleet's writeReplace, likely to save space). Setting inflater to null does not prevent deflation, you need to set the original variant to null, e.g. variant.setOriginalVariant(null).
Logged

cjy4312

  • Ensign
  • *
  • Posts: 49
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11466 on: April 09, 2025, 01:14:02 AM »

Hi Alex.
What spec does WeaponAPI's ensureClonedSpec clone? After use this on a weapon, I tried modifying the firePoints in weaponSpec and the Location of weaponSlot. I found that the firePoints of the same weapon on different ship were also affected. Moreover, when multiple ships of the same hull without run that code , the weaponSlots on ships also changed offset.
never mind. I realized that I had reset the x and y of Vector2f inside instead of adding new ones after clear the list
« Last Edit: April 09, 2025, 03:47:07 AM by cjy4312 »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 25903
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11467 on: April 09, 2025, 05:49:59 PM »

I'm going to go insane. I feel like this has to be inflater schenanigans, and I thought I fixed it, but I might be wrong.

I'm trying to make custom fleets. I want the ships in these fleets to have smods, dmods, a custom hullmod, and a special weapon loadout (omega).

But every time the game saves, all these modifications are erased, and I'm left with a dmodless, smodless, normally equipped derelict ship. It's on game save,  not load.

https://github.com/nikothedude/MorePlanetaryConditions/blob/master/src/data/scripts/campaign/magnetar/niko_MPC_derelictOmegaFleetConstructor.kt#L141-L172 Here's what I do. I inflate, then I null inflater. So why is this happening? Any ideas at all? I've had to deal with this issue on so many different parts of my mod I'm going to start going insane pretty soon.

On save suggests that the fleet is deflated on save (and, quick check of the code, this does happen in CampaignFleet's writeReplace, likely to save space). Setting inflater to null does not prevent deflation, you need to set the original variant to null, e.g. variant.setOriginalVariant(null).

To add to this, what you're doing looks a bit odd - you're setting .REFIT variants on stuff and *then* running the inflater? Does that even... work? I'm not 100% sure the default inflater can handle non-stock variants, though I suppose maybe it can.
Logged

Killer of Fate

  • Admiral
  • *****
  • Posts: 3347
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11468 on: April 10, 2025, 05:14:14 PM »

SPOILER
Spoiler
is the maximum amount of fabricated threats by a fabricator enemy related to their DP? Will doubling their DP make it so that Fabricator will stop making new enemies sooner?

edit: never mind it does
[close]
« Last Edit: April 10, 2025, 05:52:04 PM by Killer of Fate »
Logged
years ago, I was Mairaathaneese
Now, I'm a naturalised Kazeroneese

Cryovolcanic

  • Captain
  • ****
  • Posts: 446
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11469 on: April 11, 2025, 06:00:14 AM »

Is there a way to see a merged weapons.csv or ships.csv for all mods that I have installed?
Logged

LazyWizard

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1374
    • View Profile
    • GitHub Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11470 on: April 11, 2025, 12:29:46 PM »

Is there a way to see a merged weapons.csv or ships.csv for all mods that I have installed?

You can calculate the post-mod merge contents of any vanilla CSV using
Code
Global.getSettings().getMergedSpreadsheetDataForMod("id", "data/weapons/weapon_data.csv", "starsector-core");
(swapping out the second argument for whichever CSV you want)
« Last Edit: April 11, 2025, 12:31:33 PM by LazyWizard »
Logged
Active mods: LazyLib | Combat Radar | Console Commands | Version Checker  ||  Old mods: Autosave | Omnifactory | Simulator Overhaul
Feel free to use any code I've written or PM me for help with your own. Anyone is free to translate my work.

NikoTheGuyDude

  • Admiral
  • *****
  • Posts: 508
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11471 on: April 11, 2025, 02:15:57 PM »

Is there any way to hide a star from the planet view? As it stands, one of my secret systems is being exposed by the fact you can open the star viewer and see, down in the abyss, is a literal magnetar. I'd really like for this secret to remain a secret.
Logged

NikoTheGuyDude

  • Admiral
  • *****
  • Posts: 508
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11472 on: April 11, 2025, 02:16:33 PM »

I'm going to go insane. I feel like this has to be inflater schenanigans, and I thought I fixed it, but I might be wrong.

I'm trying to make custom fleets. I want the ships in these fleets to have smods, dmods, a custom hullmod, and a special weapon loadout (omega).

But every time the game saves, all these modifications are erased, and I'm left with a dmodless, smodless, normally equipped derelict ship. It's on game save,  not load.

https://github.com/nikothedude/MorePlanetaryConditions/blob/master/src/data/scripts/campaign/magnetar/niko_MPC_derelictOmegaFleetConstructor.kt#L141-L172 Here's what I do. I inflate, then I null inflater. So why is this happening? Any ideas at all? I've had to deal with this issue on so many different parts of my mod I'm going to start going insane pretty soon.

On save suggests that the fleet is deflated on save (and, quick check of the code, this does happen in CampaignFleet's writeReplace, likely to save space). Setting inflater to null does not prevent deflation, you need to set the original variant to null, e.g. variant.setOriginalVariant(null).

To add to this, what you're doing looks a bit odd - you're setting .REFIT variants on stuff and *then* running the inflater? Does that even... work? I'm not 100% sure the default inflater can handle non-stock variants, though I suppose maybe it can.

While I'm sure this is a weird way of doing it, nulling original variant has fixed the issue and honestly I'm too scared to touch this code again, so I'll leave it as it is until it causes problems.
Logged

Jaydee8652

  • Ensign
  • *
  • Posts: 32
    • View Profile
    • JaydeePiracy
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11473 on: April 11, 2025, 02:47:23 PM »

Can you switch out the portrait of a person during a conversation without hiding and unhiding them so that it's continuous?

HideVisual
SetPersonPortrait person "person2"
ShowPersonVisual false person

I thought this would do it but the HideVisual seems to take priority and they simply don't come back.

There is an "answer", which is to make a bunch of hidden copies of the person to show, which would work in my case as I plan for their death in this conversation anyway so relations don't matter, but it feels silly.
« Last Edit: April 11, 2025, 04:08:10 PM by Jaydee8652 »
Logged

Audax

  • Captain
  • ****
  • Posts: 332
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11474 on: April 12, 2025, 01:13:04 AM »

Not sure if bug, currently doing some testing with GenericRaidFGI.

If I set tryToCaptureObjectives to false and I dont add any industries to disrupt, the raid immediately fails the moment the fleet arrives in the system. Other than that I only set the target to 1 market. Also having tryToCaptureObjectives to true will not fail the raid.

The only way I could solve the issue is to add industries to disrupt.

EDIT: Looks like I needed to set allowNonHostileTargets to true so that it wont fail.
« Last Edit: April 12, 2025, 09:28:37 AM by Audax »
Logged
Pages: 1 ... 763 764 [765] 766 767 ... 772