Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 452 453 [454] 455 456 ... 462

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

BeyondTheHorizon

  • Ensign
  • *
  • Posts: 16
  • Grand Admiral of the Galactic Empire
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6795 on: October 01, 2020, 08:44:49 PM »

How does getDamageTarget() work for missile? The code below works for other projectiles with DamagingProjectileAPI but not for missiles.
Code
for (MissileAPI m : missiles) {
if (m.getDamageTarget() == ship) {
flux.increaseFlux(m.getDamageAmount() * m.getDamageType().getShieldMult(), true);
}
}
« Last Edit: October 02, 2020, 01:00:16 AM by BeyondTheHorizon »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17258
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6796 on: October 02, 2020, 08:31:52 AM »

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.
Logged

Iota Latte

  • Ensign
  • *
  • Posts: 7
  • 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, 03:04:25 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?  ;)
Logged
-- 404 FELINE NOT FOUND --

Morrokain

  • Admiral
  • *****
  • Posts: 1518
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6798 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

  • Ensign
  • *
  • Posts: 16
  • Grand Admiral of the Galactic Empire
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6799 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

Iota Latte

  • Ensign
  • *
  • Posts: 7
  • this kitty is not included.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6800 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: 438
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6801 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

  • Commander
  • ***
  • Posts: 113
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6802 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
Stellar Logistics - courier services
Hyperspace Network - information services

Techpriest

  • Commander
  • ***
  • Posts: 116
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6803 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: 1798
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6804 on: October 04, 2020, 07:22:55 AM »

Transient stuff is not saved.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17258
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6805 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

Techpriest

  • Commander
  • ***
  • Posts: 116
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6806 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: 17258
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6807 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

Priestacity

  • Ensign
  • *
  • Posts: 5
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6808 on: October 05, 2020, 09:44:59 PM »

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...
Logged

Jaghaimo

  • Commander
  • ***
  • Posts: 113
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6809 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
Stellar Logistics - courier services
Hyperspace Network - information services
Pages: 1 ... 452 453 [454] 455 456 ... 462