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 ... 766 767 [768] 769 770 ... 778

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

Vexlia Artemiss

  • Ensign
  • *
  • Posts: 11
  • Zeta Level AI core
    • View Profile
    • Bluesky Page
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11505 on: April 19, 2025, 11:54:51 PM »

I'm looking into making a mod for the game based on the Terran Confederacy of Aligned Systems from Ralts Bloodthornes Behold Humanity book series. my question is where do i start? a lot of the resources on here appear a decade or so old and i worry about development since then. I have no coding experience but want to learn and have some big plans for the mod. UAF really inspired me and i want to learn something new this year and this is it. Also if you haven't checked out the series its amazing!

I recently have similar questions. So I give you some links on tutorials I used.

First of all you should at least read Intro to Modding on wiki:
https://starsector.wiki.gg/wiki/Intro_to_Modding
It goes over most basics and how to make your mod files.

Secondly your most definitely need to set up IDE. There as very good tutorial on Wiki:
https://starsector.wiki.gg/wiki/IntelliJ_IDEA_Setup - it's up to date, so no problems there

After to create basic faction there is few sources:
.faction file overview: https://starsector.fandom.com/wiki/.faction_File_Overview#crest
Guide on forums: https://fractalsoftworks.com/forum/index.php?topic=1282.0

Other than that you can use other mod code as example including UAF. Simply extract .jar using any zip manager and you can look on all code files. Another way is use base game code to do the same. It packed in starsector-core/starfarer.api.zip.

Note: there two types of file structures: one defined outside jar, which used by game only if all paths and files properly named. It's where game have most non java files, general data and graphics.
And where jars, pretty much only java code goes there and it there most interactive stuff originates from. For it you NEED IDE to properly save on pack jars. Advantage is you can sort files as you want, because jar you create directs game there it needed.

Outside of it, if you have no experience with coding I recommend to watch at least some tutorial on java code structure and coding. Game uses mostly custom functions, but there still basics you should understand to have ability to sparsely understand what given code tries to do.

That should give you directions to follow. Also always check for typos in code, especially outside IDE.

edit: first faction tutorial is not what I actually used. Instead I used code from other topic: https://fractalsoftworks.com/forum/index.php?topic=29225.0 - their code easier to understand and i think works better. It's what helped my to make faction appear (after i fixed typo in .faction file).
« Last Edit: April 20, 2025, 12:06:59 AM by Vexlia Artemiss »
Logged
Working on faction mod in background. You can see snipets on my Bluesky.

Check my flag pack: Terra Invicta Inspired Flag Pack.

zanthiem

  • Ensign
  • *
  • Posts: 15
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11506 on: April 20, 2025, 07:21:07 AM »

I'm looking into making a mod for the game based on the Terran Confederacy of Aligned Systems from Ralts Bloodthornes Behold Humanity book series. my question is where do i start? a lot of the resources on here appear a decade or so old and i worry about development since then. I have no coding experience but want to learn and have some big plans for the mod. UAF really inspired me and i want to learn something new this year and this is it. Also if you haven't checked out the series its amazing!

I recently have similar questions. So I give you some links on tutorials I used.

First of all you should at least read Intro to Modding on wiki:
https://starsector.wiki.gg/wiki/Intro_to_Modding
It goes over most basics and how to make your mod files.

Secondly your most definitely need to set up IDE. There as very good tutorial on Wiki:
https://starsector.wiki.gg/wiki/IntelliJ_IDEA_Setup - it's up to date, so no problems there

After to create basic faction there is few sources:
.faction file overview: https://starsector.fandom.com/wiki/.faction_File_Overview#crest
Guide on forums: https://fractalsoftworks.com/forum/index.php?topic=1282.0

Other than that you can use other mod code as example including UAF. Simply extract .jar using any zip manager and you can look on all code files. Another way is use base game code to do the same. It packed in starsector-core/starfarer.api.zip.

Note: there two types of file structures: one defined outside jar, which used by game only if all paths and files properly named. It's where game have most non java files, general data and graphics.
And where jars, pretty much only java code goes there and it there most interactive stuff originates from. For it you NEED IDE to properly save on pack jars. Advantage is you can sort files as you want, because jar you create directs game there it needed.

Outside of it, if you have no experience with coding I recommend to watch at least some tutorial on java code structure and coding. Game uses mostly custom functions, but there still basics you should understand to have ability to sparsely understand what given code tries to do.

That should give you directions to follow. Also always check for typos in code, especially outside IDE.

edit: first faction tutorial is not what I actually used. Instead I used code from other topic: https://fractalsoftworks.com/forum/index.php?topic=29225.0 - their code easier to understand and i think works better. It's what helped my to make faction appear (after i fixed typo in .faction file).
Thank you with this tonight I start the Terran Confederacy mod. If car maintenance doesn't wipe me out...
Logged
Go my children with the blessings of the Digital Omni-Messiah.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26033
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11507 on: April 21, 2025, 01:55:51 PM »

So I have weird question. Is it possible to count amount of specific mods or factions using Rules.csv? Or should it be done through script which set logical flags? Basically idea is, for character to comment on state of the sector depending on how much faction mods player added.
I assume with script it's guaranty what I can code it, but I don't know Rules.csv as much.

You'd have to write a custom command to use this info from rules.csv. See the com.fs.starfarer.api.impl.campaign.rulecmd package for examples of how commands are coded.

Another question I had, is how hard it would to allow battle UI change depending on which ship you pilot? I guess it's something game not really built to do, but is it possible, or game engine would prevent it?

It's not really built for that.


Hi there !
Is there a tutorial on logging ? -- More specifically how to transform an object of unknown type to string and then write it to the log file
...
I pretty sure there some simple solution to all of this but I just cannot see it at the moment

Hi - generally speaking, object.toString()?
Logged

Kenshkrix

  • Lieutenant
  • **
  • Posts: 55
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11508 on: April 21, 2025, 02:13:35 PM »

I wanted to add hullmods to some ships in fleets based on some conditions.
So I've made a class that extends BaseCampaignEventListener and overrides the reportFleetSpawned method, and I run a Global.getSector().addListener(new listenerClass()) in onNewGame and onGameLoad
(probably not the best way to do this, but prototyping)

For testing I just directly add the test hullmod to all members of the fleet, which works for the player fleet spawned at the start of the game.
It doesn't seem to work on any other fleet, though.
Is there a convenient way to do this?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26033
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11509 on: April 21, 2025, 03:02:20 PM »

Most fleets start out "deflated" - i.e. with stock variants - and get "inflated" - i.e. get their, somewhat randomized variants - when the player mouses over the fleet or runs into it. So, what you want is a FleetInflationListener - my guess is that when the fleet is inflated, it overrides whatever changes you made.
Logged

Kenshkrix

  • Lieutenant
  • **
  • Posts: 55
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11510 on: April 21, 2025, 03:16:15 PM »

Most fleets start out "deflated" - i.e. with stock variants - and get "inflated" - i.e. get their, somewhat randomized variants - when the player mouses over the fleet or runs into it. So, what you want is a FleetInflationListener - my guess is that when the fleet is inflated, it overrides whatever changes you made.
That makes sense.
I'll look into that, thanks.
Logged

Not_a_cat

  • Lieutenant
  • **
  • Posts: 54
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11511 on: April 22, 2025, 02:53:56 AM »

Dear fellow modders

I would like to add option to the planet menu without using rules.csv.
So far I've been using

Code
addOption("My Option Text", "my_option_id", Color.Yellow, "")

Which does work.
What I don't understand however is how to handle on optionSelected properly.
Right now I am wrapping dialog.plugin with my own handler which once again does seem to work however
1) It feels like a hack 
2) I loose the ability to open market while wrapping is in place

Here is the code I am using
Code
    override fun init(dialog: InteractionDialogAPI) {
        if(originalDialogPlugin == null && dialog.plugin != this) {
            originalDialogPlugin = dialog.plugin
            dialog.plugin = this
        }
    }

    override fun optionSelected(optionText: String?, optionData: Any) {
        if(optionMap.containsKey(optionData)) { // optionMap contains optionId to optionHandler pairs
            optionMap[optionData]?.invoke(this)
        } else {
            originalDialogPlugin!!.optionSelected(optionText, optionData)
        }
    }

What would be the better way to provide optionSelected handlers to existing dialog plugin ?


Logged

Ashrac

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11512 on: April 23, 2025, 12:17:54 PM »

Hi all,
I currently have a faction set up. When starting a new game with the faction loaded, faction fleets spawn from faction planets based on the buildings (patrol HQ, military base etc), however when loading a vanilla game and then saving and loading back up with the mod enabled, the systems and factions spawn, however fleets do not spawn from the planets.

Does anyone have any idea regarding this? I am not using any Fleetfactory code or similar, the fleets should spawn organically from the planet buildings.
Thanks,
Logged

Tecrys

  • Admiral
  • *****
  • Posts: 626
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11513 on: April 24, 2025, 04:00:15 AM »

Is there an easy way to make a faction always trust the player when joining an ongoing battle with transponder off?
or make the faction trust every faction to join battles?

and if yes then how do I do that?
« Last Edit: April 24, 2025, 05:58:39 AM by Tecrys »
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26033
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11514 on: April 24, 2025, 08:39:07 AM »

I would like to add option to the planet menu without using rules.csv.

(Just replying to say that I'm not ignoring the question, it's just that my suggestion would be to use rules.csv.)


Hi all,
I currently have a faction set up. When starting a new game with the faction loaded, faction fleets spawn from faction planets based on the buildings (patrol HQ, military base etc), however when loading a vanilla game and then saving and loading back up with the mod enabled, the systems and factions spawn, however fleets do not spawn from the planets.

Does anyone have any idea regarding this? I am not using any Fleetfactory code or similar, the fleets should spawn organically from the planet buildings.
Thanks,

That does sound strange - what you're describing should work, and it's hard to say why it might not. Perhaps the code you're running on new game creation, and on new game load, is different from each other? That is, I'm assuming you're doing something to check if the save that was loaded already has your faction stuff and if not addes it, and maybe that code is somehow different than the one that runs on the creation of a new game, something like that.


Is there an easy way to make a faction always trust the player when joining an ongoing battle with transponder off?
or make the faction trust every faction to join battles?

and if yes then how do I do that?

A faction, I don't think so, but setting MemFlags.MEMORY_KEY_ALLOW_PLAYER_BATTLE_JOIN_TOFF to true in the memory of the fleets will do this.
Logged

Killer of Fate

  • Admiral
  • *****
  • Posts: 3437
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11515 on: April 24, 2025, 10:20:10 AM »

how to make it so that engines only turn on when manoeuvring jets are on?

Like Brawler, and Conquest does it? Etc.
Logged
off to write another nightmare

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 26033
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11516 on: April 24, 2025, 10:32:31 AM »

how to make it so that engines only turn on when manoeuvring jets are on?

Like Brawler, and Conquest does it? Etc.

You set the otherwise-unused contrailSize field to 128 instead of the "standard" 64. It's somewhere between "hack" and "I guess we're using this unused field to pass in flags now".
Logged

nathan67003

  • Captain
  • ****
  • Posts: 258
  • Excellent imagination, mediocre implementation.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11517 on: April 24, 2025, 11:24:29 AM »

It's somewhere between "hack" and "I guess we're using this unused field to pass in flags now".
Saving that
Logged
I have some ideas but can't sprite worth a damn and the ideas imply really involved stuff which I've no clue how to even tackle.

volt

  • Lieutenant
  • **
  • Posts: 74
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11518 on: April 24, 2025, 12:18:30 PM »

* Can a custom commodity use crew space instead of cargo space?
* Is it possible to make a commodity illegal to sell even on black markets (for certain factions, e.g. non-pirate black markets)?
* And/or change the price of a commodity depending on the faction?
Logged

Sorrydough

  • Ensign
  • *
  • Posts: 33
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #11519 on: April 24, 2025, 01:26:31 PM »

On the topic of system engines, I'm having this issue:
- I have script-controlled auxiliary engines on my ships
- These auxiliary engines are visible on the campaign map and it looks terrible
- I can't make them invisible there because it uses the primary engine style data for all the engines
- I can't use contrail 128 to fix it because these engines need to render all the time during combat, not just when the system is active

So I'm looking for either a way to hide these engines on the campaign map directly, or to make them a 128 engine that's always on in combat.
« Last Edit: April 24, 2025, 01:33:39 PM by Sorrydough »
Logged
Pages: 1 ... 766 767 [768] 769 770 ... 778