Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21); Blog post: A Tale of Two Tech Levels (05/28/21)

Author Topic: starfarer.api Hullmods/Skill modifications  (Read 106 times)

Ranakastrasz

  • Admiral
  • *****
  • Posts: 624
  • Prince Corwin of Amber
    • View Profile
starfarer.api Hullmods/Skill modifications
« on: June 24, 2021, 09:01:23 AM »

I am trying to modify the range of several effects in the game, but am unsure how to do so.
The skill effects, as well as some hull mods and ship abilities appear to be inside the starfarer.api.zip, which is bizarre, and imitating that in my mod structure, with or without the zip appears to do nothing.

What am I doing wrong here?
Logged
I think is easy for Simba and Mufasa sing the Circle of Life when they're on the top of the food chain, I bet the zebras hate that song.

Cigarettes are a lot like hamsters. Perfectly harmless, until you put one in your mouth and light it on fire

SafariJohn

  • Admiral
  • *****
  • Posts: 2038
    • View Profile
Re: starfarer.api Hullmods/Skill modifications
« Reply #1 on: June 24, 2021, 09:24:39 AM »

Do your own versions of the effect classes, then reference them in the appropriate data locations.

- Ship ability scripts are referenced in the .system files in data/shipsystems
- Hull mod scripts are referenced in data/hullmods/hull_mods.csv
- Skill scripts are referenced in the .skill files in data/characters/skills
Logged

Ranakastrasz

  • Admiral
  • *****
  • Posts: 624
  • Prince Corwin of Amber
    • View Profile
Re: starfarer.api Hullmods/Skill modifications
« Reply #2 on: June 24, 2021, 08:21:22 PM »

After relocating the "Escort Package" Hullmod, it errored out based on the "MilitarizedSubsystems" reference. I tried an include for "com.fs.starfarer.api.impl.hullmods", the old package name, and also tried using that as a prefix for all "MilitarizedSubsystems" references in the code, but still errors out.


Edit: Actually, what is going on. What I did before, was make a copy, in the corresponding folder. Does starsector search all folders when compiling, and/or build relationships based on the packages? Not sufficiently familier with how Java works exactly, compared to other languages.

Before, I didn't change the package name, expecting it to overwrite the base files. Now, when I renamed it, and made a new reference, that should link it, but given that it was referencing the old package and class name, why didn't that work?

Specifically, It seems that renaming the packages results in it not seeing, presumably, the rest of those packages. So I am confused, and believe I misunderstood what you meant.

I actually WAS doing my own versions of the effect classes, and it wasn't working.
« Last Edit: June 24, 2021, 08:30:11 PM by Ranakastrasz »
Logged
I think is easy for Simba and Mufasa sing the Circle of Life when they're on the top of the food chain, I bet the zebras hate that song.

Cigarettes are a lot like hamsters. Perfectly harmless, until you put one in your mouth and light it on fire

Morrokain

  • Admiral
  • *****
  • Posts: 1778
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: starfarer.api Hullmods/Skill modifications
« Reply #3 on: June 24, 2021, 09:25:49 PM »

Here is an example of me overriding a weapon effect:

1 - In your custom weapon file, add your new effect.

   "specClass":"beam",
   "id":"archean_riftcascade",
   "beamEffect":"data.scripts.weapons.ArcheusRiftCascadeEffect",
   "type":"ENERGY",
   "size":"LARGE",

 - The effect portion points to the new effect which has a new name. The rest is for location reference.

2 - Define the new effect. For instance, copy the old effect and paste it in a new location. I compile the script in a jar (which is added to the standard scripts by defining the relevant jar in mod_info.JSON -    "jars": ["Archean Order TC v0.9.1a.jar"],)

 - It doesn't have to be in a jar iirc, it just needs to be under the specified path. So, "data.scripts.weapons" could actually be linked to "data\scripts\weapons" in the base mod directory that is comprised of folders starting at the "data" level of the mod:

Spoiler
Base Directory:

Directory Level 2 after clicking on the "data" folder:

[close]

Although keep in mind that a jar is better as far as saving system resources goes - I believe.

3 - Then you just need to define the new weapon, etc.

If this isn't a mod, and is a personal edit, you can simply edit the core hullmod entry in hullmods.csv to point to the newly added path in the starsector-core directory where you have added the script with the changes. It just needs a different name and needs to be linked to the new path.

Specifically for the Escort/Assault Package, it gets tricky as they rely on Militarized Subsystems being installed and have a direct reference by Id. If you post your code I can assist further.

Anyway I wrote this in a big hurry so if it doesn't make sense let me know and I'll try and make it more clear. Good luck!
Logged

Ranakastrasz

  • Admiral
  • *****
  • Posts: 624
  • Prince Corwin of Amber
    • View Profile
Re: starfarer.api Hullmods/Skill modifications
« Reply #4 on: June 24, 2021, 09:48:33 PM »

Got it to work. Thanks for the help.
Logged
I think is easy for Simba and Mufasa sing the Circle of Life when they're on the top of the food chain, I bet the zebras hate that song.

Cigarettes are a lot like hamsters. Perfectly harmless, until you put one in your mouth and light it on fire

Morrokain

  • Admiral
  • *****
  • Posts: 1778
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: starfarer.api Hullmods/Skill modifications
« Reply #5 on: June 24, 2021, 10:31:58 PM »

*thumbs up* Nice! Happy to help.
Logged