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: Anubis-class Cruiser (12/20/24)

Author Topic: I need a simple tutorial on how to make a mod that replaces vanilla files  (Read 590 times)

sterlingkerman117

  • Ensign
  • *
  • Posts: 32
    • View Profile

Howdy y'all!

I am working on a ship-pack mod and encountered an issue wherein missiles are showing despite being on hidden mounts. Turns out that is because the vanilla missile weapon files have a line in them that makes it so they're visible even when on a hidden mount.

Only solution was to manually change that line of code in every single file it was in. Which gives me a problem: If I release my mod, then the users of it will need to also manually modify their vanilla files; not good. So, I figured the next best thing would be to make a sub-mod that overwrites those files for them.

Issue is the Into to Modding tutorial for Starsector doesn't saying anything about making a mod that edits vanilla files, just how to add new stuff. When I tried to figure it out myself, it didn't work. What I tried was to create a mod, then create a perfect replica (file structure and names) of the files I want to edit, and then made the changes in those files. In other games I've modded, like Stellaris, it would prioritize modded files of the same name and folder structure and use them as replacers... but that didn't work. So, I must be missing something.

Can someone teach me here or point me to an existing tutorial that will help me solve this problem?

Thanks <3
« Last Edit: October 01, 2024, 11:26:49 PM by sterlingkerman117 »
Logged

starficz

  • Ensign
  • *
  • Posts: 30
    • View Profile

Generally speaking editing vanilla is a bad idea because of conflicts. I know this is a stackoverflow like answer, but for your specific use case you should be using Deco weapons to mimic part of your ship hull and cover the mount area you wish to hide. By this I mean a weapon mount set to Decorative, with the texture of part of the hull, that has a higher render order so it renders over other weapons under it.
Logged

Great Wound

  • Captain
  • ****
  • Posts: 310
    • View Profile

Got to echo Sterl here, editing vanilla behavior is generally bad idea. That's not to say you shouldn't but if you do tread very carefully.

I modified a vanilla Atlas, it carried over to EVERY Atlas in the modiverse. Bad idea.
I also modified the Mining Laser to become a hybrid and somehow that ended up becoming part of the base game, occasionally you get lucky... it's far more likely you won't.

That's not to say I won't help you cause chaos ;D

There's two ways to go about it:

You could clone a copy of each missiles file in to your mod (same file path) then in your mod_info.json specify to replace those specific files. If you want to see this in action check out my Koc. I did it with some .econ files. It's a brute force method but it works, in my case I resorted to this because, by default, Starsector tries to merge files and doing so resulted in unexpected behavior. I've just got to be mindful that if Alex ever makes changes to those vanilla files I have to update mine accordingly.

Alternatively:
If you create a .wpn file for each missile in your mod you can remove all render hints for that missile with the following snippet of code.

Code: /mods/mymod/data/weapons/hammerack.wpn
{
"renderHints":null,
}

Again, take a look at my Koc, I used a similar method with phasebeam.wpn to add(/merge) a script that makes the vanilla phase beam deal hardflux to shields on certain ships.