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 ... 484 485 [486] 487 488 ... 706

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

azmodii

  • Ensign
  • *
  • Posts: 2
  • Discord: Az#5263
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7275 on: April 13, 2021, 09:35:05 PM »

Hi all,

I'm wondering if there is a way to bypass the initial "launcher" screen (you know, the one with the "Play Starsector" button).

I'm building a launcher that can update mods automatically and browse mods and install them from within the launcher, and it works well enough but it looks like the main entry process executes some code to start the game and I can't for the life of me replicate that code.

Any help would be appreciated!
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7276 on: April 14, 2021, 02:28:03 AM »

How do I remove that Ziggurat thing always make me recognized by others?

How do I add a ship from an outdated mod?  I won't publish it, just want to use it myself.
For Ziggurat, see here
(there's no way to do it in defs, since the tag is only added when the recoverable ship is created for player)

Adding a ship from an old mod (i.e. porting it to a new mod) should go about the same as adding a completely new ship to the new mod, see the wiki guide or ask on Discord if you need help with that.

I'm trying to mod the pristine nano forge to remove the pollution debuff it gives to planets, which file has the actual nano forges stats?
There's some stats stuff in ItemEffectsRepo.java, but the pollution effect is handled by the heavy industry class (HeavyIndustry.java).
Logged

CoreWolff

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7277 on: April 14, 2021, 03:36:27 AM »

Hi,

So, I have searched through the forums before asking this, they may have been asked before but I couldn't find definitive answers.

What's the correct way to calculate beam damage in an EveryFrameCombatPlugin?

if you're using advance with a float "amount", I've seen in different scripts:

beam.getDamage().computeDamageDealt(amount);
beam.getWeapon().getDamage().getDamage() * amount;
beam.getDamage().getDamage() * amount;

Or intervals and checking every 0.1f with getDerivedStats:
float interval_dmg = beam.getWeapon().getDerivedStats().getDps() / 10f;

I've seen one post earlier saying computeDamageDealt is unreliable, so don't use that. I've seen others saying the getDamage might not be taking into account skills etc either? So.... very confused!


Also, separate to the above but related, if you want to modify the damage of a beam is this the correct way to do that below? Some of the skill e.g. RangedSpecialization seem to do it this way.

DamageAPI damage = beam.getDamage();
String id = "damage_increase";
float DAMAGE_BONUS = 30f;
damage.getModifier().modifyPercent(id, DAMAGE_BONUS);


setMultiplier() also seems to manipulate the final damage but I wasn't sure of the differences there, is that meant to be related to different damage types vs armor, shields, etc?

Appreciate any answers to the above!  :)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7278 on: April 14, 2021, 08:37:46 AM »

Hi all,

I'm wondering if there is a way to bypass the initial "launcher" screen (you know, the one with the "Play Starsector" button).

I'm building a launcher that can update mods automatically and browse mods and install them from within the launcher, and it works well enough but it looks like the main entry process executes some code to start the game and I can't for the life of me replicate that code.

Any help would be appreciated!

Ah - offhand, I'm not sure if it's possible or not. These parameters to the JVM should make it skip the launcher, but I'm not sure if it'll actually work or not. That code path is ancient and hasn't been trod in many a year.

-DlaunchDirect=true -DstartRes=1280x768 -DstartFS=false -DstartSound=true

You'd also have to save all the mod-related things in the right places in the registry, along with the other settings the launcher lets you manage...

What's the correct way to calculate beam damage in an EveryFrameCombatPlugin?

beam.getDamage().computeDamageDealt(amount);

That's the one you want. The amount passed in doesn't matter; it *should* return the accumulated damage on the frames the beam does deal damage, and 0 otherwise. And it should also correctly factor in the source ship's damage modifiers.

setMultiplier() also seems to manipulate the final damage but I wasn't sure of the differences there, is that meant to be related to different damage types vs armor, shields, etc?

It accounts for 1) frames where the beam isn't dealing damage (set to zero there) and otherwise, the charge level/brightness of the beam.
Logged

Silveressa

  • Ensign
  • *
  • Posts: 23
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7279 on: April 14, 2021, 11:34:54 AM »


There's some stats stuff in ItemEffectsRepo.java, but the pollution effect is handled by the heavy industry class (HeavyIndustry.java).
[/quote]

Thanks, and which folder do I look in to find that file?
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 #7280 on: April 14, 2021, 12:33:54 PM »

There's some stats stuff in ItemEffectsRepo.java, but the pollution effect is handled by the heavy industry class (HeavyIndustry.java).

Thanks, and which folder do I look in to find that file?

Both are in: Starsector\starsector-core\starfarer.api.zip\com\fs\starfarer\api\impl\campaign\econ\impl
Logged

CoreWolff

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7281 on: April 14, 2021, 12:54:34 PM »


What's the correct way to calculate beam damage in an EveryFrameCombatPlugin?

beam.getDamage().computeDamageDealt(amount);

That's the one you want. The amount passed in doesn't matter; it *should* return the accumulated damage on the frames the beam does deal damage, and 0 otherwise. And it should also correctly factor in the source ship's damage modifiers.

setMultiplier() also seems to manipulate the final damage but I wasn't sure of the differences there, is that meant to be related to different damage types vs armor, shields, etc?

It accounts for 1) frames where the beam isn't dealing damage (set to zero there) and otherwise, the charge level/brightness of the beam.

Thank you, appreciate the answers!  :D
Logged

azmodii

  • Ensign
  • *
  • Posts: 2
  • Discord: Az#5263
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7282 on: April 14, 2021, 03:38:15 PM »

Hi all,

I'm wondering if there is a way to bypass the initial "launcher" screen (you know, the one with the "Play Starsector" button).

I'm building a launcher that can update mods automatically and browse mods and install them from within the launcher, and it works well enough but it looks like the main entry process executes some code to start the game and I can't for the life of me replicate that code.

Any help would be appreciated!

Ah - offhand, I'm not sure if it's possible or not. These parameters to the JVM should make it skip the launcher, but I'm not sure if it'll actually work or not. That code path is ancient and hasn't been trod in many a year.

-DlaunchDirect=true -DstartRes=1280x768 -DstartFS=false -DstartSound=true

You'd also have to save all the mod-related things in the right places in the registry, along with the other settings the launcher lets you manage...


Thanks Alex, worked like a charm! Appreciate the response
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7283 on: April 15, 2021, 02:20:27 AM »

If I wanted to have an IntervalUtil used for a specific instance of a hull, what would be the best way to go about doing that? I've tried storing and retrieving one using customData tied to ships unique ID but this doesn't seem to work (i suspect because it's a hullmod script and im still setting the intervalUtil to a variable in the script, so every single ship with hullmod has access to it..) as when two ships of the same type fulfill the condition for the intervalutil to advance, it starts incrementing at 2x speed. I have a snippet below showing what i am currently doing:

Code
				engine.getCustomData().put("armaa_strikecraftRefitTime"+ship.getId(),DockingAI.getCarrierRefitRate());
engine.getCustomData().put("armaa_strikecraftIntervalUtil"+ship.getId(),new IntervalUtil(20f,20f));
float refitMod = (float)engine.getCustomData().get("armaa_strikecraftRefitTime"+ship.getId());

if(engine.getCustomData().get("armaa_strikecraftIntervalUtil"+ship.getId()) instanceof IntervalUtil)

if(BASE_REFIT == null)
BASE_REFIT =(IntervalUtil)engine.getCustomData().get("armaa_strikecraftIntervalUtil"+ship.getId());

BASE_REFIT.advance((amount*(ship.getHullLevel()*1.5f)*refitMod));
engine.getCustomData().put("armaa_strikecraftIntervalElapsed"+ship.getId(),BASE_REFIT.getElapsed());
BASE_REFIT.setElapsed((float)engine.getCustomData().get("armaa_strikecraftIntervalElapsed"+ship.getId()));
« Last Edit: April 15, 2021, 02:26:34 AM by shoi »
Logged

Haka

  • Ensign
  • *
  • Posts: 21
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7284 on: April 16, 2021, 12:25:29 AM »

When I set my doctrine to use my modded weapons from my own mod i'm working on them they just don't. Everything is checked, my ships populate the fleet lists, but the weapons are nowhere to be seen.

Same thing happens with auto-fit, including variants i've made that uses my custom weapons. When I use them it just ignores those slots completely despite me having the weapons in storage and listing them as being part of the variant. I can even outfit a ship with all my custom weapons and then save a new autofit variant, and when I go to assign it it will simply leave everythign blank.

On the other hand, doctrine uses the ships fine and so do the pirates after me giving them my full BP package as well.

I have no clue what I need to do to make the game actually use my weapons actually after assigning them to my doctrines/variants/load-outs
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7285 on: April 16, 2021, 10:42:17 AM »

Is the dialogue/interaction bit that appears when you come across two fleets in a battle that don't trust you modifiable? Would I be able to say, add an option that consumes a story point to it?
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7286 on: April 17, 2021, 12:48:37 AM »

I'm currently debugging an issue where newly formed NPC colonies in Nexerelin get from size 3 to size 4 almost immediately.

After hacking CoreImmigrationPluginImpl to print some debug messages, I found some strange behavior.
About half a day after the colony is formed (at next economy tick?), ImmigrationTask.doNextBatch calls CoreImmigrationPluginImpl.advance many times in a row, resulting in years of growth squeezed into a single frame.
Pastebin
(the "<number> time" bit is the value of f in that advance call)

So, like, how do I make it not do that?

When I set my doctrine to use my modded weapons from my own mod i'm working on them they just don't. Everything is checked, my ships populate the fleet lists, but the weapons are nowhere to be seen.

Same thing happens with auto-fit, including variants i've made that uses my custom weapons. When I use them it just ignores those slots completely despite me having the weapons in storage and listing them as being part of the variant. I can even outfit a ship with all my custom weapons and then save a new autofit variant, and when I go to assign it it will simply leave everythign blank.

On the other hand, doctrine uses the ships fine and so do the pirates after me giving them my full BP package as well.

I have no clue what I need to do to make the game actually use my weapons actually after assigning them to my doctrines/variants/load-outs
Quick guess: Do your weapons have their autofit tags set? Like LMG has "pd6, kinetic3, SR"

Is the dialogue/interaction bit that appears when you come across two fleets in a battle that don't trust you modifiable? Would I be able to say, add an option that consumes a story point to it?
It's part of FleetInteractionDialogPluginImpl. So: moddable, but will have conflicts with the several other mods that change the fleet interaction dialog.
Logged

Helldiver

  • Captain
  • ****
  • Posts: 378
  • space fruit
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7287 on: April 17, 2021, 03:39:45 AM »

I was unable to find an answer elsewhere so here's a question:

Is there a way to slow down campaign speed/time compression? There's a "speed up" function in game, and it can be edited, but from what I see it can only speed up and at a minimum of 2x.

Other people want to make things faster but in my case, I want to make things slower.

Thank you in advance.
Logged
Afflictor bean plushie that glows purple when you squeeze it
30$

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7288 on: April 17, 2021, 12:17:27 PM »

If I wanted to have an IntervalUtil used for a specific instance of a hull, what would be the best way to go about doing that? I've tried storing and retrieving one using customData tied to ships unique ID but this doesn't seem to work (i suspect because it's a hullmod script and im still setting the intervalUtil to a variable in the script, so every single ship with hullmod has access to it..) as when two ships of the same type fulfill the condition for the intervalutil to advance, it starts incrementing at 2x speed. I have a snippet below showing what i am currently doing:

See: com.fs.starfarer.api.impl.hullmods.SharedFluxSink for an example. Basically you want all your data to be stored in customdata and none of it in member variables, for the reason you say.


Is the dialogue/interaction bit that appears when you come across two fleets in a battle that don't trust you modifiable? Would I be able to say, add an option that consumes a story point to it?

Not super easily. It *is* modifiable but not in a way that makes it easy for multiple mods to make changes the it. The best bet might might to show a custom interaction dialog on that interaction (via CampaignPlugin.pickInteractionDialogPlugin()) and then restarting the interaction... somehow.


I'm currently debugging an issue where newly formed NPC colonies in Nexerelin get from size 3 to size 4 almost immediately.

After hacking CoreImmigrationPluginImpl to print some debug messages, I found some strange behavior.
About half a day after the colony is formed (at next economy tick?), ImmigrationTask.doNextBatch calls CoreImmigrationPluginImpl.advance many times in a row, resulting in years of growth squeezed into a single frame.
Pastebin
(the "<number> time" bit is the value of f in that advance call)

So, like, how do I make it not do that?

Hmm - I'm guessing you have a custom plugin in Nex? Since this isn't a problem in vanilla.

The "uiUpdateOnly" parameter for the plugin should be true when it's called like that, I suspect. The plugin should not actually add to the population growth when this is true, but should only update the various stats that impact it so that the tooltips etc can show up-to-date values.

I was unable to find an answer elsewhere so here's a question:

Is there a way to slow down campaign speed/time compression? There's a "speed up" function in game, and it can be edited, but from what I see it can only speed up and at a minimum of 2x.

Other people want to make things faster but in my case, I want to make things slower.

Thank you in advance.

I don't think so. You could make fleets move more slowly, but not actually make time pass more slowly. There *is* an internal core variable - CampaignClock.SECONDS_PER_GAME_DAY - so you might be able to set it with a code call, but it's in obfuscated code so I hesitate to suggest it.
Logged

Xeno056

  • Ensign
  • *
  • Posts: 25
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7289 on: April 17, 2021, 07:24:36 PM »

So this is more "tweaking existing files" as opposed to plugins, but is there any way to fiddle around with the spawn rate of planets and/or system sizes? I keep getting single cat five planets with nary even a barren world to industrialize. I changed around some values in the planet generation csv but didn't get anything tangable from other old systems I made when starting a new game. So 1, it's in code deep and dark enough that the big boys haven't bother to mod it or 2, It's easy enough to tweak that no one has made a mod about it or 3, other.
Logged
Pages: 1 ... 484 485 [486] 487 488 ... 706