Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 415 416 [417] 418 419 ... 710

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

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6240 on: March 31, 2020, 01:37:21 PM »

I'm trying to reset a fleet member to its base hull variant if it has no D-Mods.

shipVariant is ShipVariantAPI of the fleet member I want to reset:

shipVariant.setHullSpecAPI(shipVariant.getHullSpec().getBaseHull());

this does not seem to do the trick.
am I missing something obvious again?
Logged

spobely

  • Ensign
  • *
  • Posts: 1
    • View Profile
difficulty modding normal/starfarer
« Reply #6241 on: March 31, 2020, 03:00:54 PM »

I think this is my first time using a forum in like 7 years

Anyways is there a way to add modifiers to "normal" and starfarer difficulty? In settings.json I could edit easy like:
Code
	"easyPlayerDamageDealtMult":1,
"easyPlayerDamageTakenMult":1,
"easySensorBonus":750,
"easySalvageMult":1.0,
"easyOfficerLevelMult":1,

Can the same be done for starfarer/normal? And if so how
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 #6242 on: March 31, 2020, 03:20:34 PM »

I think this is my first time using a forum in like 7 years

Anyways is there a way to add modifiers to "normal" and starfarer difficulty? In settings.json I could edit easy like:
Code
	"easyPlayerDamageDealtMult":1,
"easyPlayerDamageTakenMult":1,
"easySensorBonus":750,
"easySalvageMult":1.0,
"easyOfficerLevelMult":1,

Can the same be done for starfarer/normal? And if so how

You can to a point, yes. I think it will depend upon what you want to do and whether or not you have access to that in the API. And to my knowledge you can only do this for normal and easy (maybe ironmode?- never tried).

You would have to create a script that loads on a new campaign. The script would read your settings file and parse the values that would act as modifiers to apply your changes. Then the script would check for the easy setting. If the easy setting exists, make your easy changes. If not, make normal changes. You will save yourself a lot of time by using an IDE so it's easier to find the API you would have to call. It won't be trivial to do, but it is possible.

To give you a head start because I've used this before:

To check easy setting:
Code
            boolean easyMode = com.fs.starfarer.api.util.Misc.isEasy();
                                                        // higher chance of success when on easy difficulty
            if (easyMode) {
                fireChance += 15;
                aidCost *= 0.65;
            }

Is an example from my commodity request script.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6243 on: April 01, 2020, 12:23:09 PM »

I'm trying to reset a fleet member to its base hull variant if it has no D-Mods.

shipVariant is ShipVariantAPI of the fleet member I want to reset:

shipVariant.setHullSpecAPI(shipVariant.getHullSpec().getBaseHull());

this does not seem to do the trick.
am I missing something obvious again?

Also, I can't seem to find code for the vanilla restoration function - is it obfuscated?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6244 on: April 01, 2020, 01:09:08 PM »

I'm trying to reset a fleet member to its base hull variant if it has no D-Mods.

shipVariant is ShipVariantAPI of the fleet member I want to reset:

shipVariant.setHullSpecAPI(shipVariant.getHullSpec().getBaseHull());

this does not seem to do the trick.
am I missing something obvious again?

You probably just want to suppress its d-mods, by iterating over variant.getPermaMods() and suppressing ones with the dmod tag, using variant.addSuppressedMod().

Also, I can't seem to find code for the vanilla restoration function - is it obfuscated?

Yeah, it's in core code.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6245 on: April 01, 2020, 01:26:21 PM »


You probably just want to suppress its d-mods, by iterating over variant.getPermaMods() and suppressing ones with the dmod tag, using variant.addSuppressedMod().


I'm making an industry that slowly removes D-Mods of ships at a reduced cost, by removing them via ship.getVariant().removePermaMod() - but judging by your answer that might not be the way to go.
The issue I am facing is that a ship without any active D-Mods does not revert back to the standard variant ( Kite(D) -> Kite ) - which I was trying to trigger manually.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6246 on: April 01, 2020, 02:32:04 PM »

Ah, right - what you're doing there with .setHullSpecAPI() seems generally right, then. The way you want to get the base hull is this:

Code
ShipHullSpec base = v.getHullSpec().getDParentHull();
if (!v.getHullSpec().isDefaultDHull() && !v.getHullSpec().isRestoreToBase()) base = v.getHullSpec();
if (base == null && v.getHullSpec().isRestoreToBase()) {
base = v.getHullSpec().getBaseHull();
}

IIRC this handles some special cases about pre-made d-hulls, though, so I'm not sure if this is all necessary anymore, but this is how the restore code does it.

(To be honest, I didn't look too deeply into this right now...)
Logged

MISTB

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6247 on: April 01, 2020, 02:55:40 PM »

So I've been working on a mod and have most everything down and a ship prepped with decorative weapons to be animated, but i'm not familiar with java at all. Pouring through others mods I found most of what I needed to do but since their animations are more complex i'm having trouble understanding exactly what is doing what.

Basically, if anyone can throw together a very basic script with some stand in ID's that animates a single decorative weapon in a straight line while active venting I think i'd be able to understand a lot easier than trying to determine what is what from a very complex animation script. Can tell for the most part what is what in the scripting, but not competent enough in Java to directly create a barebones script since i'm unsure what's absolutely necessary and what isn't.

Thanks in advance for anyone willing to spend their time throwing one together for me to look at or use. Hoping I can get the hang of it and make a good variety of ships without having to pester someone to script for me.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6248 on: April 01, 2020, 03:29:36 PM »

Ah, right - what you're doing there with .setHullSpecAPI() seems generally right, then. The way you want to get the base hull is this:

-code

IIRC this handles some special cases about pre-made d-hulls, though, so I'm not sure if this is all necessary anymore, but this is how the restore code does it.

(To be honest, I didn't look too deeply into this right now...)

And with that, my issue is solved. I honestly still don't know where my error was, but I am very grateful for you solving it.
Thank you for repeatedly taking the time answering questions, I very much appreciate it.
« Last Edit: April 01, 2020, 03:32:23 PM by SirHartley »
Logged

GigaVivian

  • Ensign
  • *
  • Posts: 21
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6249 on: April 02, 2020, 05:03:33 PM »

I can't find if this has been asked already, I know easy player damage has been mentioned alot, but what if I want to change the Damage types themselves? Like make Fragmentation damage deal 30% to all types but hull instead of 25%? As the player damage (assumingly) does not affect your >non-player controlled< fleet or ally's ships' vs enemy ships' (and vise versa) damage, right?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6250 on: April 02, 2020, 05:12:07 PM »

And with that, my issue is solved. I honestly still don't know where my error was, but I am very grateful for you solving it.
Thank you for repeatedly taking the time answering questions, I very much appreciate it.

You're welcome, glad that did it!

I can't find if this has been asked already, I know easy player damage has been mentioned alot, but what if I want to change the Damage types themselves? Like make Fragmentation damage deal 30% to all types but hull instead of 25%? As the player damage (assumingly) does not affect your >non-player controlled< fleet or ally's ships' vs enemy ships' (and vise versa) damage, right?

It's not currently possible. However - let me add the relevant setter methods to the DamageType enum. Might even end up being of use to a TC that wanted to completely revamp/rename damage types.
Logged

Gwyvern

  • Captain
  • ****
  • Posts: 318
  • I build ships.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6251 on: April 02, 2020, 10:35:55 PM »

As long as you are on the topic, how difficult would it be to allow the addition of whole new damage types?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6252 on: April 03, 2020, 08:53:58 AM »

As long as you are on the topic, how difficult would it be to allow the addition of whole new damage types?

It'd be pretty difficult, especially since it's also something the AI is aware of. In practical terms, while not strictly impossible, it's a very definite "no" - sorry!
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 #6253 on: April 03, 2020, 03:57:55 PM »

I've had a report of substantial collisions upon starting a battle with modded ships (more so than vanilla). Is there anything I can do about this? The current theory is that smaller ships are too slow and when larger ships (that spawn in the back) have max speed boosts and are relatively fast for their class they often plow through the front line and even destroy allied ships. Since I nerfed carrier speed rather substantially to prevent kiting and force carrier protection, I also think that could be coming into play if a lot of frigate carriers are deployed.

Probably not much I can do other than increase the speed of smaller ships globally, but figured I'd ask just in case.

------

I'm going to look into the API for some clarity on this, but I'm concerned I'm not seeing enough procurement missions in the campaign simulation which is making it hard to troubleshoot a bug with them. Do I strictly need economy deficits for those to come into play? I'm flying a freighter heavy fleet (I think that is a factor iirc) with plenty of free cargo space yet I only get the occasional mission of that type and though I've had a few mod faction missions, these spawn much more frequently on pirate colonies (which have deficits).

The consideration I am trying to make with this is to give factions more equality of starting industries/resources at players' request. (I gave the Luddic Church fuel production, another large refining colony, a couple more military bases and an orbital works, for instance. I also gave Gilead a high command star fortress to guard it from above.) That being said, I don't want to completely remove procurement missions when playing the campaign stand-alone outside of the volatility of faction dynamics in Nex. Right now in my current build, though factions have strengths and weakness in market share, it's split fairly evenly among most commodities. Any pointers?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24111
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6254 on: April 03, 2020, 07:28:42 PM »

I've had a report of substantial collisions upon starting a battle with modded ships (more so than vanilla). Is there anything I can do about this? The current theory is that smaller ships are too slow and when larger ships (that spawn in the back) have max speed boosts and are relatively fast for their class they often plow through the front line and even destroy allied ships. Since I nerfed carrier speed rather substantially to prevent kiting and force carrier protection, I also think that could be coming into play if a lot of frigate carriers are deployed.

Probably not much I can do other than increase the speed of smaller ships globally, but figured I'd ask just in case.

Yeah, that AI generally assumes that it's the smaller ship's job to get out of the way, and that it's capable of it. Smaller ships too far out of the expected movement speed range band cause problems.

Do I strictly need economy deficits for those to come into play?

I *think* it needs to not be available "nearby" but I'm not 100% sure. You'd probably need to dig through ProcurementMissionIntel to figure it out for sure.
Logged
Pages: 1 ... 415 416 [417] 418 419 ... 710