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 ... 452 453 [454] 455 456 ... 706

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

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6795 on: October 02, 2020, 06:05:23 PM »

Hello there! I'm currently working on a mod that may required something very wierd, like a special, unique item (or commodity), that will be dropped only once and later maybe giving some special story with them. Frankly I didn't know how I may achive this, and this may beyond my knowledge scope. Is there anything (file, mod) specific that I could looked into?  ;)

Check out com\fs\starfarer\api\impl\campaign\procgen\themes\MiscellaneousThemeGenerator.java

That details how you can seed one or otherwise limited instances of an item (Legion). From there you would have to generate a mission upon picking up/otherwise interacting with the item. Depending upon what the item is, this can be done multiple ways depending upon if you are using a script, rules or some combination of the two.
Logged

BeyondTheHorizon

  • Commander
  • ***
  • Posts: 178
  • Grand Admiral of the Galactic Empire
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6796 on: October 02, 2020, 07:01:23 PM »

Offhand that seems like it'd be fine. Hmm. I'd suggest maybe stepping through with a debugger/adding some print statements to figure out exactly what's not working here.
Found the problem, m.getDamageTarget() did return null, just don't know why other projectiles return the correct entity except for missiles.
Logged

L:atte Mint

  • Ensign
  • *
  • Posts: 11
  • this kitty is not included.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6797 on: October 02, 2020, 09:08:12 PM »

Hello there! I'm currently working on a mod that may required something very wierd, like a special, unique item (or commodity), that will be dropped only once and later maybe giving some special story with them. Frankly I didn't know how I may achive this, and this may beyond my knowledge scope. Is there anything (file, mod) specific that I could looked into?  ;)

Check out com\fs\starfarer\api\impl\campaign\procgen\themes\MiscellaneousThemeGenerator.java

That details how you can seed one or otherwise limited instances of an item (Legion). From there you would have to generate a mission upon picking up/otherwise interacting with the item. Depending upon what the item is, this can be done multiple ways depending upon if you are using a script, rules or some combination of the two.

Thanks for reply! Gonna check this out asap ;)
Logged
-- 404 FELINE NOT FOUND --

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6798 on: October 03, 2020, 11:41:15 AM »

Is there a easy way to make a logistics ship that grants more repair speed, CR recovery, higher recovery chance or something similar for only frigs and destroyers in the fleet? (without ugly workarounds I mean)
Logged
Check out my ships

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6799 on: October 03, 2020, 12:12:40 PM »

When I put weapons into custom submarket that extends StoragePlugin they no longer are seen as "owned". If I put a weapon to vanilla storage, they are "seen", e.g. tooltip on that weapon shows "You own a total of x...". My class extends StoragePlugin, and submarkets.csv has "player" as faction.

Is there a way to make custom submarkets count towards player-owned weapons? Because an image is worth 1000 words: https://imgur.com/a/MZu9vd5
« Last Edit: October 04, 2020, 12:35:20 PM by Jaghaimo »
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6800 on: October 03, 2020, 08:41:16 PM »

Code
    @Override
    public void onGameLoad(boolean newGame) {
        Global.getSector().addTransientListener(new CommissionCheckMarket());
    }

I'm unfamiliar with transient listener. Am I supposed to remove them everytime the player saves? I feel like if this code is in, it'll keep readding and readding itself.

Also is there a way to add a cooldown like.. wait 5 days before re-checking again or something in reportPlayerOpenedMarket? I'm really unfamiliar with how listener works overall. I think having to run a very performance-intensive code everytime a player dock(and they may dock several time) is unfriendly to toaster PCs as well.

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6801 on: October 04, 2020, 07:22:55 AM »

Transient stuff is not saved.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6802 on: October 04, 2020, 07:46:25 AM »

If you want to add a cooldown, probably save the current timestamp (via Global.getSector().getClock().getTimestamp()) and then only check if clock.getElapsedDaysSince(timestamp) > 5f. But if it's a transient listener, then it won't save the timestamp when you save, so that wouldn't be good since you'd get inconsistent behavior if you reload vs if you don't.

I'd also question how performance intensive what you're doing actually is. Oftentimes things seem intensive but aren't, really.
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6803 on: October 05, 2020, 11:13:39 AM »

If you want to add a cooldown, probably save the current timestamp (via Global.getSector().getClock().getTimestamp()) and then only check if clock.getElapsedDaysSince(timestamp) > 5f. But if it's a transient listener, then it won't save the timestamp when you save, so that wouldn't be good since you'd get inconsistent behavior if you reload vs if you don't.

I'd also question how performance intensive what you're doing actually is. Oftentimes things seem intensive but aren't, really.
Thanks! I only want a 1 day cooldown at most or something really short.  I think my code is always loading up a spreadsheet to call from and this spreadsheet gets bigger, the more modded factions they are.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6804 on: October 05, 2020, 01:48:38 PM »

If you want to add a cooldown, probably save the current timestamp (via Global.getSector().getClock().getTimestamp()) and then only check if clock.getElapsedDaysSince(timestamp) > 5f. But if it's a transient listener, then it won't save the timestamp when you save, so that wouldn't be good since you'd get inconsistent behavior if you reload vs if you don't.

I'd also question how performance intensive what you're doing actually is. Oftentimes things seem intensive but aren't, really.
Thanks! I only want a 1 day cooldown at most or something really short.  I think my code is always loading up a spreadsheet to call from and this spreadsheet gets bigger, the more modded factions they are.

Are you actually doing loading from a file in reportPlayerOpenedMarket()? Unless there are extenuating circumstances, that's really not a good idea. Generally speaking, the "right" way to do this would be to load it once on application load - into some kind of data structure - and then refer to this when actually using it.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6805 on: October 06, 2020, 02:25:33 AM »

I want to transplant a ship from a mod so that I can use the ship without the rest of the mod in-game. What files do I need to collect, and what other processes do I need to do for this? I can generally understand the game files, but my modding experience is very limited.

Files I've collected so far:
The .ship file
The description file
The variant files (All of which need to be edited for vanilla guns)
And the graphics files

I've made a portrait mod before, so I understand some general principles...
You need to look into ship and variants and transplant all weapons and fighters as well (data and graphics and sometimes custom scripts). You also need default roles defined, or ships will not show up. Then you also need to create ship_data.csv and wing_data.csv files with all entries you have transplanted. Then look at special systems for ships and fighters and either change them to something vanilla or transplant scripts.

Transplanting weapon/wing/system scripts will be tricky as it requires some Java knowledge regarding naming, ideally you'd build yourself a jar file with all ship/fighter systems you need. I am probably missing something. All in all I think you're better off creating a mod to blacklist what you don't want.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6806 on: October 07, 2020, 04:41:00 PM »

I wanna make a ship system eat away CR and PP, is this the right way to do both or just CR?

Code
stats.getCRLossPerSecondPercent().modifyMult(id, 4f);
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6807 on: October 07, 2020, 04:51:38 PM »

That's just CR after PPT runs out.

Edit: let me add ShipAPI.setTimeDeployed(); right now that's not exposed...
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6808 on: October 07, 2020, 05:01:05 PM »

That's just CR after PPT runs out.

Edit: let me add ShipAPI.setTimeDeployed(); right now that's not exposed...
would this work to lower peak performance? (internals of 10 sec)
stats.getPeakCRDuration().modifyFlat(id, -10);
also what happens if i .unmodify this?
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23987
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6809 on: October 07, 2020, 05:10:38 PM »

Oh, hey, that's a good idea! I thought that wouldn't work (it wouldn't if that's only computed once when the ship is created), but it should work, since it's not doing that.

If you .umodify() it it'll give it back the peak time that was subtracted. So you actually wouldn't just do -10 every time - you'd want to keep track of how long and modify by the *total* time every time, if that makes sense.
Logged
Pages: 1 ... 452 453 [454] 455 456 ... 706