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: The Pilgrim's Path (07/19/22)

Pages: 1 ... 590 591 [592] 593 594 ... 602

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

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8865 on: June 25, 2022, 09:18:04 AM »

How I add an abandoned station with stuff in storage but that you must fight to get the stuff?

Also, I tried adding defenders to a planet ruins with setDefenderOverride and it works, but prints some "null" errors on the text, how I fix that?
Logged

Histidine

  • Admiral
  • *****
  • Posts: 3890
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8866 on: June 25, 2022, 06:56:21 PM »

Maybe get the actual null errors from starsector.log and work from there.

For defenders of an abandoned station, I'd probably do a custom path for the interaction dialog in rules.csv, started by a rule with an OpenInteractionDialog trigger that checks if the interaction is with the particular station we want. I think once a $defenderFleet is defined, you could use a SalvageDefenderInteraction call to set up the battle.
Logged

AccuracyThruVolume

  • Lieutenant
  • **
  • Posts: 93
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8867 on: June 26, 2022, 06:46:22 AM »

Why would you want to/how would that even work? I feel like there may be some misconception about what the index numbers do - they're just a means to enable the script to return a bunch of different statuses. (I don't remember why I did it this way instead of it just returning a List or some such.)

I'm not so much worried about the index number, more interested if there is a way to return two StatusData items.


Basically I squished the ammofeed and burndrive together, because rushing in with guns blazing is lore correct for the faction I'm working on.   However, the mix of the two shipsystems led me to this in the StatusData  function:

Spoiler

public StatusData getStatusData(int index, State state, float effectLevel) {
      
      float mult = 1f + ROF_BONUS * effectLevel;
      float bonusPercent = (int) ((mult - 1f) * 100f);
      if (index == 0)
      {
         return new StatusData("ballistic rate of fire +" + (int) bonusPercent + "%", false);
         //return new StatusData("increased engine power", false);    <---- had to comment this out
      }
      if (index == 1)
      {
         return new StatusData("ballistic flux use -" + (int) FLUX_REDUCTION + "%", false);
      }
      return null;
   }


[close]

So doing two return commands at once is a no-no, but is there a way to combine the two statusdata commands into one return command?    No worries if this is a no-go.

Hope this makes things less muddy   :)
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2543
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8868 on: June 26, 2022, 06:59:05 AM »

I'm not so much worried about the index number, more interested if there is a way to return two StatusData items.

Yes, add another index number.

Code: java

      if (index == 0)
      {
         return new StatusData("ballistic rate of fire +" + (int) bonusPercent + "%", false);
      }
      if (index == 1)
      {
         return new StatusData("ballistic flux use -" + (int) FLUX_REDUCTION + "%", false);
      }
      if (index == 2)
      {
         return new StatusData("increased engine power", false);
      }
Logged

JAL28

  • Commander
  • ***
  • Posts: 193
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8869 on: June 26, 2022, 10:55:46 PM »

Does anyone know why these two don't seem to spawn in the allocated market's comms board?

Spoiler
        PersonAPI TTambassador = Global.getFactory().createPerson();
        TTambassador.setId("TTambassador");
        TTambassador.setGender(FullName.Gender.MALE);
        TTambassador.getName().setFirst("Tim");
        TTambassador.getName().setLast("test");
        TTambassador.setPostId("TTambassadorpost");
        TTambassador.setRankId("TTambassadorrank");
        TTambassador.setImportance(PersonImportance.HIGH);
        TTambassador.setVoice(Voices.OFFICIAL);
        TTambassador.addTag(Tags.CONTACT_UNDERWORLD);
        TTambassador.addTag(Tags.CONTACT_TRADE);
        ip.addPerson(TTambassador);

        PersonAPI PLambassador = Global.getFactory().createPerson();
        PLambassador.setId("PLambassador");
        PLambassador.setGender(FullName.Gender.MALE);
        PLambassador.getName().setFirst("Bill");
        PLambassador.getName().setLast("Silvergale");
        PLambassador.setPostId("PLambassadorpost");
        PLambassador.setRankId("PLambassadorrank");
        PLambassador.setImportance(PersonImportance.HIGH);
        PLambassador.setVoice(Voices.OFFICIAL);
        PLambassador.addTag(Tags.CONTACT_MILITARY);
        PLambassador.addTag(Tags.CONTACT_TRADE);
        ip.addPerson(PLambassador);

        MarketAPI market = Global.getSector().getEconomy().getMarket("ryzan_supercomplex");
        if (market != null && "sindrian_diktat".equals(market.getFactionId())) {
            market.getCommDirectory().addPerson(TTambassador, 1);
            market.addPerson(TTambassador);
            market.getCommDirectory().addPerson(PLambassador, 2);
            market.addPerson(PLambassador);
        }
[close]

I checked with other NPC code and there doesn't seem to be anything wrong so I have no idea what's up at this point.

Also for reference I don't believe it's the unique IDs that are causing it since I already defined them in the mod.
« Last Edit: June 26, 2022, 11:11:45 PM by JAL28 »
Logged

AccuracyThruVolume

  • Lieutenant
  • **
  • Posts: 93
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8870 on: June 27, 2022, 06:37:59 AM »

I'm not so much worried about the index number, more interested if there is a way to return two StatusData items.

Yes, add another index number.

Code: java

      if (index == 0)
      {
         return new StatusData("ballistic rate of fire +" + (int) bonusPercent + "%", false);
      }
      if (index == 1)
      {
         return new StatusData("ballistic flux use -" + (int) FLUX_REDUCTION + "%", false);
      }
      if (index == 2)
      {
         return new StatusData("increased engine power", false);
      }


This worked splendidly.   Appreciate the solution!   
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20606
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8871 on: June 27, 2022, 09:38:30 AM »

Does anyone know why these two don't seem to spawn in the allocated market's comms board?

Spoiler
        PersonAPI TTambassador = Global.getFactory().createPerson();
        TTambassador.setId("TTambassador");
        TTambassador.setGender(FullName.Gender.MALE);
        TTambassador.getName().setFirst("Tim");
        TTambassador.getName().setLast("test");
        TTambassador.setPostId("TTambassadorpost");
        TTambassador.setRankId("TTambassadorrank");
        TTambassador.setImportance(PersonImportance.HIGH);
        TTambassador.setVoice(Voices.OFFICIAL);
        TTambassador.addTag(Tags.CONTACT_UNDERWORLD);
        TTambassador.addTag(Tags.CONTACT_TRADE);
        ip.addPerson(TTambassador);

        PersonAPI PLambassador = Global.getFactory().createPerson();
        PLambassador.setId("PLambassador");
        PLambassador.setGender(FullName.Gender.MALE);
        PLambassador.getName().setFirst("Bill");
        PLambassador.getName().setLast("Silvergale");
        PLambassador.setPostId("PLambassadorpost");
        PLambassador.setRankId("PLambassadorrank");
        PLambassador.setImportance(PersonImportance.HIGH);
        PLambassador.setVoice(Voices.OFFICIAL);
        PLambassador.addTag(Tags.CONTACT_MILITARY);
        PLambassador.addTag(Tags.CONTACT_TRADE);
        ip.addPerson(PLambassador);

        MarketAPI market = Global.getSector().getEconomy().getMarket("ryzan_supercomplex");
        if (market != null && "sindrian_diktat".equals(market.getFactionId())) {
            market.getCommDirectory().addPerson(TTambassador, 1);
            market.addPerson(TTambassador);
            market.getCommDirectory().addPerson(PLambassador, 2);
            market.addPerson(PLambassador);
        }
[close]

I checked with other NPC code and there doesn't seem to be anything wrong so I have no idea what's up at this point.

Also for reference I don't believe it's the unique IDs that are causing it since I already defined them in the mod.

Hmm - possibly if the entry is hidden via CommDirectoryEntryAPI.setHidden(true)?

You might try running some code - after adding the entries - to list out the entries and confirm that the one you want is actually present, etc.
Logged

Wispborne

  • Commander
  • ***
  • Posts: 221
  • Discord: Wisp#0302
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8872 on: June 27, 2022, 08:17:17 PM »

Do we have a way to italicize only part of a paragraph in a TextPanelAPI/TooltipMakerAPI/LabelAPI?

I found the ways to change text color within a para, and to italicize a whole para, but haven't managed to find a way for just a few words.
Logged

esciron

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8873 on: June 28, 2022, 06:53:22 AM »

Hi, I want to make a little personal mod. I have no Idea on what's the best way to do this (if there's a way) My goal is to make ships tougher/more durable and capital ships less relevant.

1- I want to add  additional armor, hull, ordinance points and reduce the speed of all ships (including  ships from mods), all of this fixed by a percentage of the ships values. The only way I can think of doing
this is by making a hullmod, but I don't know if there's a way to add that hullmod to every single ship that spawn in the game (including bounties etc).

2- Make capital ships way scarcer and make it so only one capital ship can be deployed at the same time in a battle (1 for each "team" involved) I really don't know how could I do this.

My modding skills are very limited i've only made a couple of hullmods and ships.
I would appreciate any help.
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8874 on: June 28, 2022, 10:49:59 AM »

I have two questions:

1. How I make the name of a system be visible on the map, or not? (I want it  to start the game hidden, and later reveal it after a quest)
2. I saw lots of code floating around about how to delete hyper-nebula on top of your system, but what if I want to ADD hyper nebula on top of  system? (I want it to be actually hard to see)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20606
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8875 on: June 28, 2022, 03:18:04 PM »

Do we have a way to italicize only part of a paragraph in a TextPanelAPI/TooltipMakerAPI/LabelAPI?

I found the ways to change text color within a para, and to italicize a whole para, but haven't managed to find a way for just a few words.

There's no way to do that, no. (Obivously technically doable! But enough of a pain that it's not something I'd want to get into barring a compelling need for it in vanilla.)


Hi, I want to make a little personal mod. I have no Idea on what's the best way to do this (if there's a way) My goal is to make ships tougher/more durable and capital ships less relevant.

1- I want to add  additional armor, hull, ordinance points and reduce the speed of all ships (including  ships from mods), all of this fixed by a percentage of the ships values. The only way I can think of doing
this is by making a hullmod, but I don't know if there's a way to add that hullmod to every single ship that spawn in the game (including bounties etc).

Hi! You might achieve this by creating a "hidden" hullmod and then adding it to all ShipHullSpecAPIs (Global.getSettings().getAllShipHullSpecs) in your ModPlugin.onApplicationLoad() method.

2- Make capital ships way scarcer and make it so only one capital ship can be deployed at the same time in a battle (1 for each "team" involved) I really don't know how could I do this.

Hmm, not sure how you'd do this - there's no code to limit deployment by ship type, just by deployment points.


1. How I make the name of a system be visible on the map, or not? (I want it  to start the game hidden, and later reveal it after a quest)

Offhand, I don't know; nothing comes to mind. Hiding star systems isn't really a thing in vanilla. The Lights Out mod does something along these lines, though, but it doesn't hide just the name; you might want to look at how it does things.

2. I saw lots of code floating around about how to delete hyper-nebula on top of your system, but what if I want to ADD hyper nebula on top of  system? (I want it to be actually hard to see)

Take a look at the NebulaEditor class - that, and where/how it's used, should hopefully point you in the right direction. IIRC tile values from 0 to 15 inclusive are the different tiles.
Logged

Brainwright

  • Commander
  • ***
  • Posts: 197
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8876 on: June 28, 2022, 08:59:09 PM »

I'm using quite a lot of mods, and some of them have custom mods with special conditions as for what ship types and mods they can work with.

Thing is, they don't show up on the mod screen.  I can add them manually by modifying the campaign file, and they work fantastically.  Ships spawn with the mods, too.

I just can't add them from the refit screen because they don't show.  Is there some procedure I can use to make sure they show up?
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2543
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8877 on: June 28, 2022, 09:26:44 PM »

You probably need to select their filter tag. Like LoA's hullmods will be under ARS or Reparations Society.
Logged

Brainwright

  • Commander
  • ***
  • Posts: 197
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8878 on: June 28, 2022, 09:30:23 PM »

You probably need to select their filter tag. Like LoA's hullmods will be under ARS or Reparations Society.

Yep, that did it.  Just started mods a couple of months ago, never noticed that.  :P
Logged

esciron

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8879 on: June 29, 2022, 09:13:39 AM »

Hi, I want to make a little personal mod. I have no Idea on what's the best way to do this (if there's a way) My goal is to make ships tougher/more durable and capital ships less relevant.

1- I want to add  additional armor, hull, ordinance points and reduce the speed of all ships (including  ships from mods), all of this fixed by a percentage of the ships values. The only way I can think of doing
this is by making a hullmod, but I don't know if there's a way to add that hullmod to every single ship that spawn in the game (including bounties etc).

Hi! You might achieve this by creating a "hidden" hullmod and then adding it to all ShipHullSpecAPIs (Global.getSettings().getAllShipHullSpecs) in your ModPlugin.onApplicationLoad() method.

2- Make capital ships way scarcer and make it so only one capital ship can be deployed at the same time in a battle (1 for each "team" involved) I really don't know how could I do this.

Hmm, not sure how you'd do this - there's no code to limit deployment by ship type, just by deployment points.

Thank you!
I was able to do the first point, hullmod for the armor and hull but I can't find a way to modify the ordnance points as the only related thing I can find it's in "MutableCharacterStatsAPI".

For the second point a good solution could be multiplying the capital ships deployment points so you wouldn't be able to deploy many capitals but i'm unable to find a way to do it, i've tried to do getSuppliesPerMonth() and getSuppliesToRecover() with a.modifyPercent() in the hullmod but it doesn't change the ships deployment points. Any ideas?

EDIT: I've found a way with getSuppliesToRecover and setSuppliesToRecover in the hullmod plugin (ShipHullSpecAPI). But now I need a way to limit this to capital ships only, is this possible?
EDIT 2: Finally figure it out, it was way simpler than what I was thinking.
« Last Edit: June 29, 2022, 11:28:00 AM by esciron »
Logged
Pages: 1 ... 590 591 [592] 593 594 ... 602