Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95.1a is out! (12/10/21); Blog post: Hostile Activity (09/01/22)

Pages: 1 ... 421 422 [423] 424 425 ... 616

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

planeswalker

  • Lieutenant
  • **
  • Posts: 51
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6330 on: April 23, 2020, 05:14:21 AM »

Hey all, I have a question regarding feasibility and if it can be done can someone point me to a dummies guide to doing it.

For quite some time now I've been using the console command mod to add 20 OP to all my ships but it resets everytime I leave the game. I thought of making a hullmod that will cost 'negative OP' like I've seen some mod hullmods do. Is it also possible to restrict it to player only so AI ships cannot get it?

Thanks
Logged

AxleMC131

  • Admiral
  • *****
  • Posts: 1721
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6331 on: April 23, 2020, 04:24:00 PM »

... I thought of making a hullmod that will cost 'negative OP' like I've seen some mod hullmods do. Is it also possible to restrict it to player only so AI ships cannot get it?

Easy. Just don't put it in any default variants, and don't put it in any faction's "knownHullmods" list. By default factions only use those hullmods attached to their ship loadouts or noted in the faction file.

So... basically you have to do nothing. ;)
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 6546
  • Harpoon Affectionado
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6332 on: April 23, 2020, 04:33:38 PM »

Regarding hullmods and the above question, does setting Hidden to True in the csv also stop autofit from including it? I know it stops codex entry.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6333 on: April 23, 2020, 04:42:59 PM »

Indirectly - IIRC the plugin that provides autofit with which hullmods are available strips out any "hidden" ones.

"hidden" basically means "built in only, can never be installed otherwise"
"hidden" + "alwaysHidden" means "this is required for some internal functionality, do not show this to the player anywhere, including as being installed on the ship in the refit screen"
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 #6334 on: April 24, 2020, 02:39:04 PM »

Use case: Trying to make a market connected to the economy but with only a military market.

1) What is the specId of the black market and open market submarkets? Is the open market a submarket or the primary market itself?

2) Does this do anything bad as far as supply/demand of the economy?

Example:

Code
        SectorEntityToken fortress = system.getEntityById("gilead_station");
        fortress.getMarket().removeSubmarket("black_market");
        fortress.getMarket().removeSubmarket("open_market");
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6335 on: April 24, 2020, 03:05:41 PM »

1) For ids, see data/campaign/submarkets.csv and the Submarkets class. The open market is a submarket like the other ones.

2) It shouldn't.
Logged

planeswalker

  • Lieutenant
  • **
  • Posts: 51
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6336 on: April 24, 2020, 11:47:05 PM »

... I thought of making a hullmod that will cost 'negative OP' like I've seen some mod hullmods do. Is it also possible to restrict it to player only so AI ships cannot get it?

Easy. Just don't put it in any default variants, and don't put it in any faction's "knownHullmods" list. By default factions only use those hullmods attached to their ship loadouts or noted in the faction file.

So... basically you have to do nothing. ;)

Oh right ok, lol. More importantly is there a 'dummies guide to make a custom hullmod guide' on this forum? My searches gave me a lot of tips for making new ships, weapons etc but not hullmods. Maybe my search skills are abit bad. Thanks!

Ok nvm I think I found a older post in this thread, lemme try that first.
« Last Edit: April 24, 2020, 11:51:01 PM by planeswalker »
Logged

AxleMC131

  • Admiral
  • *****
  • Posts: 1721
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6337 on: April 24, 2020, 11:57:15 PM »

Does anyone know if there is a method to get a particular keypress from the player in accordance with their keybind settings? Specifically I want to be able to check if a player is pressing the "use system" key, which may not necessarily be F. Is that possible?
Logged

Amoebka

  • Admiral
  • *****
  • Posts: 959
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6338 on: April 28, 2020, 12:11:48 PM »

What's the easiest way to iterate though all markets a faction owns starting from a market they own? marketAPI.getFaction() gives factionAPI, but there's nothing in it that actually returns a set of all markets?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6339 on: April 28, 2020, 12:34:32 PM »

Does anyone know if there is a method to get a particular keypress from the player in accordance with their keybind settings? Specifically I want to be able to check if a player is pressing the "use system" key, which may not necessarily be F. Is that possible?

No easy way - I think the best you could do is SettingsAPI.getControlStringForEnumName("SHIP_USE_SYSTEM") and then try to parse that, accounting for it possibly being mapped to something with a modifier key as well. Can't say I'd recommend it, though.

What's the easiest way to iterate though all markets a faction owns starting from a market they own? marketAPI.getFaction() gives factionAPI, but there's nothing in it that actually returns a set of all markets?

See: Global.getSector().getEconomy().getMarketsCopy()

Logged

Amoebka

  • Admiral
  • *****
  • Posts: 959
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6340 on: April 28, 2020, 12:45:34 PM »

See: Global.getSector().getEconomy().getMarketsCopy()

I don't think I quite understand. That would give me the list of ALL markets in the entire sector, right? I can iterate through all of them and check if they belong to the faction I want one by one, is that the solution? I'm mostly afraid it would be really slow to check every single market every time.
Logged

SirHartley

  • Admiral
  • *****
  • Posts: 582
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6341 on: April 28, 2020, 01:14:41 PM »

See: Global.getSector().getEconomy().getMarketsCopy()

I don't think I quite understand. That would give me the list of ALL markets in the entire sector, right? I can iterate through all of them and check if they belong to the faction I want one by one, is that the solution? I'm mostly afraid it would be really slow to check every single market every time.

Code
ArrayList<MarketAPI> playerMarketList = new ArrayList<>();
for (MarketAPI market : Global.getSector().getEconomy().getMarketsCopy()){
        if(market.isPlayerOwned()){
                playerMarketList.add(market);
        }
}
return playerMarketList;

The total market list is usually <50 markets, which makes iterating through them a non issue unless you do it every frame.
Be aware that Nexerelin "Autonomous colonies" are player faction markets, but do not count as playerOwned.


Edit - I just reread your question: to get all markets that a certain faction owns, use Misc.getFactionMarkets() - be wary of the above though.
« Last Edit: April 28, 2020, 01:32:06 PM by SirHartley »
Logged

Amoebka

  • Admiral
  • *****
  • Posts: 959
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6342 on: April 28, 2020, 01:42:51 PM »

Misc.getFactionMarkets()

Thank you, that's exactly what I wanted!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20803
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6343 on: April 28, 2020, 02:03:44 PM »

(Incidentally, Misc.getFactionMarkets() also iterates through the entire market list. But, as SirHartley said, it's small enough that this isn't generally a problem.)
Logged

AxleMC131

  • Admiral
  • *****
  • Posts: 1721
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6344 on: April 28, 2020, 10:36:49 PM »

Does anyone know if there is a method to get a particular keypress from the player in accordance with their keybind settings? Specifically I want to be able to check if a player is pressing the "use system" key, which may not necessarily be F. Is that possible?

No easy way - I think the best you could do is SettingsAPI.getControlStringForEnumName("SHIP_USE_SYSTEM") and then try to parse that, accounting for it possibly being mapped to something with a modifier key as well. Can't say I'd recommend it, though.

Darn. I'd prefer something stable, so I might resort to my alternative, far less graceful script format. ;) Ah well, the price we pay for cool stuff.
Logged
Pages: 1 ... 421 422 [423] 424 425 ... 616