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 ... 520 521 [522] 523 524 ... 706

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7815 on: August 02, 2021, 09:58:59 AM »

How do I store a variant into engine mid-game instead of loading it at game launch? (Is it possible?)

In SettingsAPI:
   List<RoleEntryAPI> getEntriesForRole(String factionId, String role);
   void addEntryForRole(String factionId, String role, String variantId, float weight);
   void removeEntryForRole(String factionId, String role, String variantId);

Edit - and also:
   List<RoleEntryAPI> getDefaultEntriesForRole(String role);
   void addDefaultEntryForRole(String role, String variantId, float weight);
   void removeDefaultEntryForRole(String role, String variantId);

The latter if you don't want/need to do it for a specific faction but for all of them.
Logged

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7816 on: August 02, 2021, 10:18:53 AM »

How do I store a variant into engine mid-game instead of loading it at game launch? (Is it possible?)

In SettingsAPI:
   List<RoleEntryAPI> getEntriesForRole(String factionId, String role);
   void addEntryForRole(String factionId, String role, String variantId, float weight);
   void removeEntryForRole(String factionId, String role, String variantId);

Edit - and also:
   List<RoleEntryAPI> getDefaultEntriesForRole(String role);
   void addDefaultEntryForRole(String role, String variantId, float weight);
   void removeDefaultEntryForRole(String role, String variantId);

The latter if you don't want/need to do it for a specific faction but for all of them.

Oh, I should’ve been more specific.
I mean like what player do in ship refit, they can store their current fit as a template for future autofit.
I want to generate variant procedurally and store them with dynamically created ID but follows a certain naming convention so the created variant can be identified and reused later.
For example, a wasp wing (since its really just a ship API), I want to dynamically generate a wasp but it uses lr pd laser instead of regular pd. I will create such variant on the fly and assign the ID of wasp_fighter_lrpd (or whatever weapon id). Oh, and also how do I dynamically add wing data, as each wing data ID maps to a variant and it only assigns wing ID for a ship’s fighter bay.
« Last Edit: August 02, 2021, 10:26:00 AM by Sutopia »
Logged


Since all my mods have poor reputation, I deem my efforts unworthy thus no more updates will be made.

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7817 on: August 03, 2021, 12:26:06 PM »

How does one make a new bar mission available to be offered?
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 #7818 on: August 03, 2021, 12:54:11 PM »

How does one make a new bar mission available to be offered?

Check out bar_events.csv under data/campaign.

It has a frequency and probability column.

*EDIT*

 - Though a follow up question I would have would be how would one go about making faction-specific bar events? Would you just handle it in the mission script itself?
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7819 on: August 03, 2021, 02:15:17 PM »

- Though a follow up question I would have would be how would one go about making faction-specific bar events? Would you just handle it in the mission script itself?
Isn't that just setting a faction.id in the rules.csv finding out if the person is "from that faction" and what not?

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7820 on: August 03, 2021, 02:30:14 PM »

Isn't that just setting a faction.id in the rules.csv finding out if the person is "from that faction" and what not?

Ah yeah probably thanks. I forgot about the rules portion.
Logged

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7821 on: August 03, 2021, 08:36:23 PM »

In the DamageTakenModifier interface, what is the param object type when it's ramming damage?

Edit: Is there a way to get damage source ShipAPI regardless of damage type?
« Last Edit: August 03, 2021, 11:08:00 PM by Sutopia »
Logged


Since all my mods have poor reputation, I deem my efforts unworthy thus no more updates will be made.

Helldiver

  • Captain
  • ****
  • Posts: 378
  • space fruit
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7822 on: August 03, 2021, 10:58:16 PM »

Where are the values for required crew/supplies/machinery when establishing a colony?
Logged
Afflictor bean plushie that glows purple when you squeeze it
30$

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7823 on: August 04, 2021, 10:37:28 AM »

Oh, I should’ve been more specific.
I mean like what player do in ship refit, they can store their current fit as a template for future autofit.
I want to generate variant procedurally and store them with dynamically created ID but follows a certain naming convention so the created variant can be identified and reused later.
For example, a wasp wing (since its really just a ship API), I want to dynamically generate a wasp but it uses lr pd laser instead of regular pd. I will create such variant on the fly and assign the ID of wasp_fighter_lrpd (or whatever weapon id). Oh, and also how do I dynamically add wing data, as each wing data ID maps to a variant and it only assigns wing ID for a ship’s fighter bay.

Ah! I don't think this is possible, actually.


In the DamageTakenModifier interface, what is the param object type when it's ramming damage?

Edit: Is there a way to get damage source ShipAPI regardless of damage type?

I think the param will be null in that case, but that should be easy enough to check. And, I don't think so; you can only get it out of the param.

Where are the values for required crew/supplies/machinery when establishing a colony?

Looks like that's hardcoded in SurveyPluginImpl.getOutpostConsumed(). Not in static variables, unfortunately, so no easy way to change it aside from providing a custom implementation of the plugin.
Logged

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7824 on: August 04, 2021, 10:51:26 AM »

What does the mutablestats’s get entity return in the damage API?
Logged


Since all my mods have poor reputation, I deem my efforts unworthy thus no more updates will be made.

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7825 on: August 04, 2021, 12:39:19 PM »

What triggers the Galatian Stipend when you are in the Tutorial? I can't seem to find it in rules.csv and I thought it was triggerable via it.

 I also would like to know if there's a quick way to get the # of nodes listed (such as storage fees, crew payment, administrator payment, commission bonus) all those things that you get on a monthly thing.

Wispborne

  • Captain
  • ****
  • Posts: 400
  • Discord: wispborne
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7826 on: August 05, 2021, 05:41:35 PM »

I'm starting to go down a very hacky route and need to check to see if there's an easy way that I don't know about.

My goal is to show a bar event at all markets, conditional on some parameters only known after game load (after loading other files). The bar event will have an arbitrary number of options, also only known after game load.


My first approach was extending `BaseBarEventCreator` with `isPriority` true, a frequency weight of 100, and also having `isAlwaysShow()` return true in my `BarEvent`. But it still isn't showing up in all markets, maybe it only shows up in one at a time? It's also possible that I didn't wait long enough for the game to recalculate bar events for all markets...
Code: https://bitbucket.org/CodingTartiflette/magiclib/src/MagicBounties/src/data/scripts/util/bounty/

My second approach is to make a rule in `rules.csv` that triggers on `AddBarEvents`, with only the condition `$hasMarket`, and to fire a custom script that is a subclass of `AddBarEvent` where the `execute` decides whether the bar event should show up. However, next I need a way to have it fire my `BarEvent` subclass, which I guess has to happen from `FireBest`, and that's where I decided to stop and see if maybe there was a proper way to do this that doesn't involve working around vanilla code.


If it helps to visualize, it's a bounty board; so, something that all bars will have, and will always be on display as long as there are bounties to take.
Thanks, and sorry for the wall of text.
Logged
Mod: Persean Chronicles | Mod Manager: SMOL | Tool: VRAM Estimator | Tool: Forum+Discord Mod Database | If I'm inactive for 3 months, anyone can use any of my work for anything (except selling it or its derivatives).

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7827 on: August 05, 2021, 06:05:58 PM »

What does the mutablestats’s get entity return in the damage API?

It should be the ship or the missile that the stats belongs to, but it may also be null. Best way to make would be to check at runtime.

What triggers the Galatian Stipend when you are in the Tutorial? I can't seem to find it in rules.csv and I thought it was triggerable via it.

 I also would like to know if there's a quick way to get the # of nodes listed (such as storage fees, crew payment, administrator payment, commission bonus) all those things that you get on a monthly thing.

For the first, you can look for all occurrences of GalatianAcademyStipend.

For the second, see: MonthlyReport, and SharedData.getCurrentReport()/getPreviousReport().

I'm starting to go down a very hacky route and need to check to see if there's an easy way that I don't know about.

My goal is to show a bar event at all markets, conditional on some parameters only known after game load (after loading other files). The bar event will have an arbitrary number of options, also only known after game load.


My first approach was extending `BaseBarEventCreator` with `isPriority` true, a frequency weight of 100, and also having `isAlwaysShow()` return true in my `BarEvent`. But it still isn't showing up in all markets, maybe it only shows up in one at a time? It's also possible that I didn't wait long enough for the game to recalculate bar events for all markets...
Code: https://bitbucket.org/CodingTartiflette/magiclib/src/MagicBounties/src/data/scripts/util/bounty/

My second approach is to make a rule in `rules.csv` that triggers on `AddBarEvents`, with only the condition `$hasMarket`, and to fire a custom script that is a subclass of `AddBarEvent` where the `execute` decides whether the bar event should show up. However, next I need a way to have it fire my `BarEvent` subclass, which I guess has to happen from `FireBest`, and that's where I decided to stop and see if maybe there was a proper way to do this that doesn't involve working around vanilla code.


If it helps to visualize, it's a bounty board; so, something that all bars will have, and will always be on display as long as there are bounties to take.
Thanks, and sorry for the wall of text.

Hmm - it seems like the way to do would be to add a custom rule command - e.g. "ShouldShowBountyBoard" or some such - and to add a call to that in the conditions column.

As far as using your BarEvent code, that sounds like a good place to use another custom command.  See: GateCMD for an example of a basic custom command that takes some parameters. MarketCMD also shows a possible approach to having some persistent data between invocations of that command; see: how it uses the TempData class.

Does that answer your questions? Happy to elaborate if needed!
Logged

Wispborne

  • Captain
  • ****
  • Posts: 400
  • Discord: wispborne
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7828 on: August 06, 2021, 06:16:12 PM »

Does that answer your questions? Happy to elaborate if needed!

It got me there, thank you!

For anyone else who stumbles across this:

rules.csv
Code
id,trigger,conditions,script,text,options,notes
"#RULESET_NAME MagicLib (bounties)",,,,,,
magiclib_bountyboard_addevent,AddBarEvents,"ShouldShowMagicBountyBoard","AddBarEvent magiclib_bountyboard_selected ""Connect to the local unsanctioned bounty board.""  ""A subroutine from your implant informs you that this establishment is broadcasting an informal job board.""",,,
magiclib_bountyboard_selected,DialogOptionSelected,"$option == magiclib_bountyboard_selected","ShowMagicBountyBoardCmd",,,

Code
public class ShowMagicBountyBoardCmd extends BaseCommandPlugin {
    @Override
    public boolean execute(String ruleId, InteractionDialogAPI dialog, List<Misc.Token> params, Map<String, MemoryAPI> memoryMap) {

        MagicBountyBarEvent event = new MagicBountyBarEvent();
        BarCMD cmd = (BarCMD) getEntityMemory(memoryMap).get("$BarCMD"); // This is pretty weird but it's how it's done in vanilla
        BarEventDialogPlugin plugin = new BarEventDialogPlugin(cmd, dialog.getPlugin(), event, memoryMap);
        dialog.setPlugin(plugin);
        plugin.init(dialog);
        return true;
    }
}


« Last Edit: August 06, 2021, 06:18:27 PM by Wispborne »
Logged
Mod: Persean Chronicles | Mod Manager: SMOL | Tool: VRAM Estimator | Tool: Forum+Discord Mod Database | If I'm inactive for 3 months, anyone can use any of my work for anything (except selling it or its derivatives).

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7829 on: August 06, 2021, 06:28:57 PM »

Nice, glad you worked it out! Dialog-plugin-substitution can get a little tricky :)
Logged
Pages: 1 ... 520 521 [522] 523 524 ... 706