Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: Scauldy1 on July 02, 2022, 02:47:49 PM

Title: Changing alternate defense system through hullmods
Post by: Scauldy1 on July 02, 2022, 02:47:49 PM
So, hi. um, this is my first time posting here, and guess what! It's 'cause I have problems trying to make a mod for the game.

Anyways, onto the topic at hand, as the titel states, I'm trying to change the alternate defense system, aka, the defense id using hullmods, and I haven't exactly found much on it, except for a 2014 post, on a mod that mentions it as possible, but well, I'm not the best when it comes to understanding code, so I couldn't exactly understand what in said mod made it work. The post mentioned the code that make it possible was from lazylib, but well, I looked there and didn't find anything that looked like it would fullfill that purpose, so I assume it was depricated and then removed since.

So that's why I'm asking here if it's possible or not. And I suppose in the same sweep I should ask if it's also possible to modify the phase upkeep and phase cost in a similar way?

Any help in this would be appreciated.
Title: Re: Changing alternate defense system through hullmods
Post by: Princess_of_Evil on July 02, 2022, 10:42:24 PM
What kind of "defense system"? If you're talking about adding new shield type or such, then you iirc need to make a ship system (look at phasecloak as basis - that's vanilla phase system) and then set your shield type to PHASE. Look at at the shield converter hull mods to see how to change shield type.
Phase stats are just stats, lul. If you have a hull mod, just change them the same way you do other stats. If you have a hull, change them in the ship csv. If you have a skin and nothing else, make a hull mod.
Title: Re: Changing alternate defense system through hullmods
Post by: Scauldy1 on July 03, 2022, 03:43:26 AM
Well, you aren't haft off, I wanna set that defense id, or well, the ship system that goes in there, into something else using a hullmod, if it's even possible. Like say changing it so that a ship with shields will use the Vangaurd's damper field instead.

I am not trying to make a skin or anything, I'm trying to make a hullmod.
Title: Re: Changing alternate defense system through hullmods
Post by: Ruddygreat on July 03, 2022, 04:25:44 AM
you can do this, but only in a kinda janky way - you've got to do shipAPI.getVariant.setHullSpecAPI (and you can get a hullspecAPI by doing Global.getSettings.getHullspec) to replace the hull with an otherwise identical one with a different system.

unfortunately, this means that you can't do it arbitrarily, but you can still do it for a set of ships pretty easily.
Title: Re: Changing alternate defense system through hullmods
Post by: Scauldy1 on July 03, 2022, 08:41:37 AM
Ahh, that's a shame. Well, on another point, just so I understand this, with "hull" do you mean from the ship_data.csv?
Title: Re: Changing alternate defense system through hullmods
Post by: Ruddygreat on July 03, 2022, 11:58:49 AM
yeah, as long as all of the weapon slots & w/e are the same then you can just do it and the game won't complain.

(though if alex looks at this thread, a setDefenceId() method would be nice)
Title: Re: Changing alternate defense system through hullmods
Post by: Scauldy1 on July 03, 2022, 01:05:42 PM
For sure would be. Well, at least I know where I can look to figure out how to do it, since as far as I've seen the interstellar imperium, I think the name was, has a trio of hullmods that change the normal ship system of their ships.
Title: Re: Changing alternate defense system through hullmods
Post by: Ruddygreat on July 03, 2022, 02:10:44 PM
ah, II hullmods don't change the system
instead, the system looks for the hullmod and behaves differently based on that

for actually changing the system, look at VIC's convoy drive hullmod
Title: Re: Changing alternate defense system through hullmods
Post by: Scauldy1 on July 03, 2022, 05:41:05 PM
Hmm, can't say I've ever seen that hullmod, even thought I do have the mod installed. But yeah, good to know, thanks