Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 599 600 [601] 602 603 ... 710

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

SafariJohn

  • Admiral
  • *****
  • Posts: 3021
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9000 on: August 10, 2022, 07:35:53 AM »

why do you need his listener though? why can't you use Global.getSettings().getModManager() (i forget what the actual method is) to check if the Detailed Combat Results mod is enabled before putting messages into the custom data?

Because adding a check for Detailed Combat Results to Realistic Combat would introduce a hard dependency.

Many mods check if other mods are enabled. For example, my Roider Union mod checks for Nexerelin. There does not need to be any dependency at all.
Logged

Wispborne

  • Captain
  • ****
  • Posts: 408
  • Discord: wispborne
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9001 on: August 10, 2022, 07:41:51 AM »

why do you need his listener though? why can't you use Global.getSettings().getModManager() (i forget what the actual method is) to check if the Detailed Combat Results mod is enabled before putting messages into the custom data?

Because adding a check for Detailed Combat Results to Realistic Combat would introduce a hard dependency.

As SafariJohn said, calling methods in or simply checking for the existence of another mod does not create a dependency on the mod, except for you when compiling.

I made some of this code up to illustrate the idea:
Code
if (Global.getSettings().getModManager().isModEnabled("nexerelin") { // Checks if Nex is enabled, no dependency on Nex, doesn't run the below code if Nex not enabled.
  if (Nexerelin.isCorvusEnabled()) { // If this line of code is run and Nex is not enabled, this will crash. However, because of the above line, this line won't run if it isn't enabled.
    // do something
  }
}
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).

Liral

  • Admiral
  • *****
  • Posts: 718
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9002 on: August 10, 2022, 02:18:02 PM »

Many mods check if other mods are enabled. For example, my Roider Union mod checks for Nexerelin. There does not need to be any dependency at all.

As SafariJohn said, calling methods in or simply checking for the existence of another mod does not create a dependency on the mod, except for you when compiling.

I made some of this code up to illustrate the idea:
Code
if (Global.getSettings().getModManager().isModEnabled("nexerelin") { // Checks if Nex is enabled, no dependency on Nex, doesn't run the below code if Nex not enabled.
  if (Nexerelin.isCorvusEnabled()) { // If this line of code is run and Nex is not enabled, this will crash. However, because of the above line, this line won't run if it isn't enabled.
    // do something
  }
}

You're right, I should not have called it a dependency.  What I meant was that, should any other mod ever want to know what damage weapons dealt in Realistic Combat, which uses a custom damage listener that bypasses the vanilla damage system, its creator would have to guess that Realistic Combat did so, look deep into the source code to know that it nevertheless reported the relevant information--but only if DCR were installed--and then ask me, and then I would have to add it. 

While I am very lucky that NickXR is smart, helpful, available, and organized enough to write the fancy data bus-flusher that keeps my mod from flooding memory with reports, enabling the cooperation of DCR and RC without the API feature I have requested, other future creators of mods that pass messages frame-by-frame should not expect (or be expected to give) as much help as I got from him in this regard.  Moreover, every such modder would have to re-invent the bus-flushing wheel--something certainly beyond me--whereas adding Global.getCombatEngine().getFrameCustomData() to the API would build-in a self flushing bus.

Hence my proposal: just think of the potential if every mod could pass messages frame-by-frame!  :D

Klaive

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9003 on: August 10, 2022, 04:34:19 PM »

Hello, i have an issue in a heavy modded game.

For some reason when i pursuit the battlemap deploys buoys and if there's a special enemy the game tells me with the alarm; but when i engage in normal combat the battlemap doesn't get anything. Maybe is for some mod? Playing 0.9.5 rc6 with some legal bootlegs

The list:
Spoiler
Code
  "pantera_ANewLevel40",
  "Adjusted Sector",
  "sd_advancedHullMods",
  "A_S-F",
  "AttunedDriveField",
  "blackrock_driveyards",
  "CaptainsLog",
  "chatter",
  "timid_commissioned_hull_mods",
  "lw_console",
  "diyplanets",
  "istl_dassaultmikoyan",
  "hm_flagpack",
  "diableavionics",
  "dynamictariffs",
  "exoticatechnologies",
  "sun_fuel_siphoning",
  "GrandColonies",
  "HMI",
  "nbj_ice",
  "immersionFriendlyPortraitPack",
  "IndEvo",
  "interestingportraitspack",
  "kadur_remnant",
  "lw_lazylib",
  "lockedAndLoaded",
  "MagicLib",
  "Mayasuran Navy",
  "Neutrino",
  "nexerelin",
  "officerExtension",
  "JYDR",
  "planet_search",
  "PulseIndustry",
  "pt_qolpack",
  "QualityCaptains",
  "repdec",
  "roider",
  "tahlan_scalartech",
  "sclskl_scalingskilllimits",
  "SCY",
  "simpleplayerflags",
  "sun_starship_legends",
  "StopGapMeasures3",
  "Sylphon_RnD",
  "tahlan",
  "Terraforming & Station Construction",
  "TORCHSHIPS",
  "URW",
  "vic",
  "vayrasector",
  "vayrashippack",
  "lw_version_checker",
  "weftinships",
  "shaderLib"

[close]
Thanks for your time.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9004 on: August 10, 2022, 05:38:43 PM »

Also is there a way to increase ECM cap to %20 just like Nav rating?
Yes but you'd, IIRC, have to edit the script and recompile it/provide your own version etc.
How do I do this? 10% is insignificant. The cap should be higher by default
BASE_MAXIMUM in com.fs.starfarer.api.impl.campaign.skills.ElectronicWarfareScript

It's a static and non-final variable, so a mod can modify it from outside like Adjustable Skill Thresholds does for some other skills (maybe AST could have that feature if it doesn't already).

How can I alter the description of a planet/station?

Anything - file editing or ConsoleCommands will work.
Planet and station descriptions are stored in data/strings/descriptions.csv (found in vanilla and most mods)

A mod can change descriptions at runtime (WhatMod does this), haven't checked if adding new ones dynamically is possible.
Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9005 on: August 10, 2022, 05:57:50 PM »

Moreover, every such modder would have to re-invent the bus-flushing wheel--something certainly beyond me--whereas adding Global.getCombatEngine().getFrameCustomData() to the API would build-in a self flushing bus.

Hence my proposal: just think of the potential if every mod could pass messages frame-by-frame!  :D

the inherent issues of this system are that getFrameCustomData would be based entirely on order of advance methods. say mod A depends on a message from mod B but mod A's advance method runs before mod B's; they would never get the message.
Logged

Liral

  • Admiral
  • *****
  • Posts: 718
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9006 on: August 10, 2022, 06:23:06 PM »

the inherent issues of this system are that getFrameCustomData would be based entirely on order of advance methods. say mod A depends on a message from mod B but mod A's advance method runs before mod B's; they would never get the message.

Reading your message has led me to recognize that the broadest understanding of this request entails designing and implementing an asynchronous protocol to pass messages among arbitrarily-many pieces of almost-arbitrary code.  I cannot immediately think of a solution, but I can think of a simpler problem: request the messages passed last frame rather than this one.  A one-frame difference would be unnoticeable to the player but let all advance() methods run, guaranteeing that every mod would see the messages it needs while also prohibiting modders from coding their mods to see or send messages 'too early' and therefore unsafely.

JAL28

  • Commander
  • ***
  • Posts: 217
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9007 on: August 11, 2022, 08:11:22 AM »

How do I make a rule/condition that displays the amount of times it’s been chosen? For example a value that adds 1 to itself every time you complete an interaction and can be shown again in a text box(like how many times you've done it).
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9008 on: August 11, 2022, 09:11:17 AM »

$global.yourCounterVariable++ in the rule somewhere (or not global, whatever) and then you can use that in the text or options to display the value.
Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9009 on: August 11, 2022, 04:23:19 PM »

could we get the FleetInteractionDialogPluginImpl to run rules if the option selected isn't recognized?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9010 on: August 11, 2022, 04:27:34 PM »

You'd have to provide your own version of it, of course, but it ought to be doable, if you take a look at how it handles conversations. And - if it's firing options that are not recognized - then you're already providing a custom version of it, correct?
Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9011 on: August 11, 2022, 04:33:31 PM »

You'd have to provide your own version of it, of course, but it ought to be doable, if you take a look at how it handles conversations. And - if it's firing options that are not recognized - then you're already providing a custom version of it, correct?

i was really wondering if vanilla could provide that, actually. i have my own override of it (which, apparently i'm not using for anything any more), but it defers to Nexerelin's implementation if it is installed. neither overrides the optionSelected method.
my end goal was adding an additional option to the pre- and post-battle dialogs to look at info related to what enemy ships there are, or in the case of post-battle, what enemy ships remain.
Logged

AccuracyThruVolume

  • Commander
  • ***
  • Posts: 135
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9012 on: August 11, 2022, 06:59:05 PM »

Is is possible to have a ship spawn other ships when it is deployed into battle?   I'm looking to make a ship that spawns a few special ships (small frigates that are then basically frigates) and also have carrier wings.   

As an alternate can a ship spawn ships when deployed and also have them treated as its fighters if it has other fighter wings already?
« Last Edit: August 12, 2022, 07:38:36 AM by AccuracyThruVolume »
Logged

Mr_Castinfon

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9013 on: August 12, 2022, 08:21:10 AM »

I asked reddit, I made thread on the forum and no one answered my questions please just help me I wanna learn
Here's the copy paste of my questions:


I have an idea for a cool mod that I wanna try making and I wanna see if certain things are even possible to do. So here they are.

Can I remove the original factions?
The mod is set outside the Perseus sector and, logically, the hegemony, luddics, sindria and the other guys aren't gonna exist there, so how can I remove them for my custom factions?

How do I remove the core worlds?
My sector won't be centralized, i.e., there is no core worlds and it's just a big cluster of stars. Is there a way to alter the generation to get that kind of effect? I was told on reddit to look at how Nexerelin handles random core worlds, so if anyone can explain the details?

How do I add my own derelicts
Different sector, different lore. So, how can I add something like the gates or probes In vanilla and have my own ways of how to interact with them.

How do I change something for the base game?
There are a few things in vanilla that I wanna keep, but slightly altered. Like, for example, if I think the Kite shuttle looks *** and I wanna change its look, how can I do that while keeping it's stats.

Please, if anyone can answer anything I'll be so grateful
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9014 on: August 12, 2022, 07:36:46 PM »

I asked reddit, I made thread on the forum and no one answered my questions please just help me I wanna learn
Here's the copy paste of my questions:


I have an idea for a cool mod that I wanna try making and I wanna see if certain things are even possible to do. So here they are.

Can I remove the original factions?
The mod is set outside the Perseus sector and, logically, the hegemony, luddics, sindria and the other guys aren't gonna exist there, so how can I remove them for my custom factions?

How do I remove the core worlds?
My sector won't be centralized, i.e., there is no core worlds and it's just a big cluster of stars. Is there a way to alter the generation to get that kind of effect? I was told on reddit to look at how Nexerelin handles random core worlds, so if anyone can explain the details?

How do I add my own derelicts
Different sector, different lore. So, how can I add something like the gates or probes In vanilla and have my own ways of how to interact with them.

How do I change something for the base game?
There are a few things in vanilla that I wanna keep, but slightly altered. Like, for example, if I think the Kite shuttle looks *** and I wanna change its look, how can I do that while keeping it's stats.

Please, if anyone can answer anything I'll be so grateful
Okay, my actual first advice is to start small. Make a mod that changes one of the things you want (say adds a new derelict type or generates a star system), then implement another change in it, and so on.
If you haven't already seen it, the Intro to Modding page on wiki is a helpful resource.

Short answers to the specific questions:
Spoiler
Removing vanilla factions
The most direct way is to have your mod be a total conversion and override the faction list, but this kills compatibility with other mods, so it's not desirable. That said, you can make a faction basically not be there if it has no colonies and is hidden from the intel screen. We'll cover not spawning a faction in the next point.
(I'm not sure how best to make vanilla blueprints not appear in salvage, figure that out later)

Don't spawn vanilla sector
Nexerelin's settings.json contains this table:
Code: json
	"plugins":{
"coreLifecyclePlugin":"exerelin.plugins.NexCoreLifecyclePlugin",
"newGameCreationEntryPoint":"exerelin.world.ExerelinNewGameSetup",

"nex_restoreCommanderPlugin":"exerelin.combat.RestoreCommanderPlugin",
},
The relevant plugin is the newGameCreationEntryPoint one.
The important code of that plugin starts here, but the key point is you generate your own stars instead of the vanilla ones (how to generate stars is a separate exercise).

Discoverable stuff
Look in the game's API* (you can find the source in starsector-core/starfarer.api.zip) for com.fs.starfarer.api.impl.campaign.procgen.themes.SectorThemeGenerator.

Code: java
	public static List<ThemeGenerator> generators = new ArrayList<ThemeGenerator>();

static {
generators.add(new DerelictThemeGenerator());
generators.add(new RemnantThemeGenerator());
generators.add(new RuinsThemeGenerator());
generators.add(new MiscellaneousThemeGenerator());
}
You can add/remove generators to the list from an external mod script. Look at each of the generators to see how they work.

Changing vanilla stuff
Your mod can modify non-code vanilla files, e.g. you could replace the Kite sprite, or change its stats in the .ship file or ship_data.csv row.

JSON-type definition files (like .ship and .weapon) have merging between vanilla and all running mods, so your mod file only needs to include the values that have changed.
For CSVs, you'll need to replace the whole row.
[close]
Logged
Pages: 1 ... 599 600 [601] 602 603 ... 710