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: Of Slipstreams and Sensor Ghosts (09/24/21)

Pages: 1 ... 422 423 [424] 425 426 ... 539

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

planeswalker

  • Ensign
  • *
  • Posts: 41
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6345 on: May 02, 2020, 08:01:39 PM »

Right, only had time to get back to starsector and mini modding but I ran into a snag.

So I started as simple as possible, I made a entry in hullmods.csv. I copied everything from the augmented engine entry into a new line, then changed the name, id and the cost. I loaded up star sector with console command mod, loaded in the new 'technology overhaul' hull mod and fitted it on a ship. This works fine as I now had a +2 burn mod that gave me hullpoints to play with (negative cost).

Now I run into a snag, I made a copy of the AugmentedEngines.java and renamed it into AugmentedEngines2.java ( I want to increase the max burn bonus to 4 without effecting the 'vanilla' engine hullmod). I changed the entry in hullmods.csv to point to this new file and I tried loading star sector. It crashed and I got this in the error log.

Spoiler
13128 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.hullmods.AugmentedEngines2]
java.lang.RuntimeException: Error compiling [data.hullmods.AugmentedEngines2]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Parsing compilation unit 'data.hullmods.AugmentedEngines2'
   at org.codehaus.janino.JavaSourceIClassLoader.findIClass(JavaSourceIClassLoader.java:172)
   at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254)
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:214)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:178)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: Compilation unit 'data.hullmods.AugmentedEngines2' does not declare a class with the same name
   at org.codehaus.janino.JavaSourceIClassLoader.findIClass(JavaSourceIClassLoader.java:160)
   ... 7 more
[close]
Could anyone tell me where I went wrong? I must have missed a step somewhere for adding a hull mod. Unfortunately the info I got from searching this forum only showed how to edit a pre-existing hullmod and not make a one from scratch. Thanks
Logged

TimeDiver

  • Commander
  • ***
  • Posts: 186
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6346 on: May 02, 2020, 08:06:25 PM »

Right, only had time to get back to starsector and mini modding but I ran into a snag.

So I started as simple as possible, I made a entry in hullmods.csv. I copied everything from the augmented engine entry into a new line, then changed the name, id and the cost. I loaded up star sector with console command mod, loaded in the new 'technology overhaul' hull mod and fitted it on a ship. This works fine as I now had a +2 burn mod that gave me hullpoints to play with (negative cost).

Now I run into a snag, I made a copy of the AugmentedEngines.java and renamed it into AugmentedEngines2.java ( I want to increase the max burn bonus to 4 without effecting the 'vanilla' engine hullmod). I changed the entry in hullmods.csv to point to this new file and I tried loading star sector. It crashed and I got this in the error log.

Spoiler
13128 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.hullmods.AugmentedEngines2]
java.lang.RuntimeException: Error compiling [data.hullmods.AugmentedEngines2]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: Parsing compilation unit 'data.hullmods.AugmentedEngines2'
   at org.codehaus.janino.JavaSourceIClassLoader.findIClass(JavaSourceIClassLoader.java:172)
   at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java:254)
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:214)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:178)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more
Caused by: org.codehaus.commons.compiler.CompileException: Compilation unit 'data.hullmods.AugmentedEngines2' does not declare a class with the same name
   at org.codehaus.janino.JavaSourceIClassLoader.findIClass(JavaSourceIClassLoader.java:160)
   ... 7 more
[close]
Could anyone tell me where I went wrong? I must have missed a step somewhere for adding a hull mod. Unfortunately the info I got from searching this forum only showed how to edit a pre-existing hullmod and not make a one from scratch. Thanks
Did you also change line #7 of your newly-copied AugmentedEngines2.java from:

public class AugmentedEngines extends BaseLogisticsHullMod {

to

public class AugmentedEngines2 extends BaseLogisticsHullMod {

as part of your copy-pasting?
Logged

planeswalker

  • Ensign
  • *
  • Posts: 41
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6347 on: May 02, 2020, 08:43:31 PM »

That solved it, thanks Timediver.
Logged

Üstad

  • Lieutenant
  • **
  • Posts: 57
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6348 on: May 03, 2020, 04:50:49 AM »

What does DO_NOT_AIM and HEATSEEKER tag does in weapon_data.csv file? How would it change that how vanilla sabot missiles work? Shoulnd't these tags be already  part of any guided missiles?

Edit:Well I quickly figure out HEATSEEKER tag is for salamanders that targeting engines. Other question still remains though.
« Last Edit: May 03, 2020, 04:53:14 AM by Üstad »
Logged

umbrellaman

  • Ensign
  • *
  • Posts: 7
  • HYPE!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6349 on: May 03, 2020, 04:57:39 AM »

Guys why this thread haven't sticked yet? so other people know where to ask trivial question.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2146
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6350 on: May 03, 2020, 07:42:06 AM »

DO_NOT_AIM tells the ship that it can fire the missile without pointing it at the target first.
Logged

AxleMC131

  • Admiral
  • *****
  • Posts: 1715
  • Amateur World-Builder
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6351 on: May 03, 2020, 10:28:09 PM »

DO_NOT_AIM tells the ship that it can fire the missile without pointing it at the target first.

Take note: "DO_NOT_AIM" is sometimes joined with the "GUIDED_POOR" tag, which means the ship will try to point at the target to fire the missile, even though it doesn't have to. GUIDED_POOR in conjunction with DO_NOT_AIM denotes a missile with poor tracking over its range (or that have an otherwise very short range), such as the Sabot and Atropos.
Logged

Raeven

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6352 on: May 05, 2020, 11:44:26 AM »

hey i wanna ask does ai fleets implement custom hullmods?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 19208
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6353 on: May 05, 2020, 12:00:04 PM »

If the faction has access to them (via the .faction file), and if the ship variants used by that faction use those hullmods, then yes.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 1955
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6354 on: May 05, 2020, 05:49:34 PM »

If I am just trying to add a jar to a mod that also has a rules file but otherwise doesn't include anything else. What is necessary to make the mod recognizable?

I have:

-mod_info.json recognizing the jar

-empty mod plugin also defined in mod_info

-the rule command package defined in settings

Maybe I don't have the jar built correctly? Or the .idea portion has corrupted files? I figured that would be enough.

Examples:

Spoiler
{
  "id":"fleetdialogue_morro",
   "name":"Fleet Dialogue Options",
   "version":"0.4",
     "author":"Morrokain",
   "description":Adds ceasefire and commodity request options to standard fleet dialogue. Bribery can be used to increase the chances of a successful ceasefire.",
  "gameVersion":"0.9.1a",
   "modPlugin":"fleet_dialogue.plugin.FleetDialogueModPlugin",
   "jars": ["Fleet Dialogue v0.9.1a.jar"],
}



{
   # where rule commands called from rules.csv can be implemented.
   # rules from multiple packages CAN NOT share the same name   
   "ruleCommandPackages":[
          "fleet_dialogue.rulecmd"
   ],
}



[close]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 19208
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6355 on: May 05, 2020, 05:52:53 PM »

It doesn't sound like you're missing anything fundamental. What's the error message? And are there any error messages on loading, or prior to the last error message?

I'd also try copying one of the vanilla rules just to make sure it's not something specific to your rule command. E.G. (iirc) if your rule command does not have a default constructor, things will break. Or if somethings goes wrong during its instantiation (i.e. say in a default value assignment to a data member), things will also break.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 1955
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6356 on: May 05, 2020, 07:35:48 PM »

It doesn't sound like you're missing anything fundamental. What's the error message? And are there any error messages on loading, or prior to the last error message?

I'd also try copying one of the vanilla rules just to make sure it's not something specific to your rule command. E.G. (iirc) if your rule command does not have a default constructor, things will break. Or if somethings goes wrong during its instantiation (i.e. say in a default value assignment to a data member), things will also break.

Ah silly me! It's apparently a problem with the mod_info.json according to the log (missed a quote in the description portion). Since nothing crashed I didn't think to look there. It's at least recognized now, if not yet functional. Thanks!
Logged

ShadowDragon8685

  • Ensign
  • *
  • Posts: 45
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6357 on: May 06, 2020, 06:53:04 PM »

I'm trying to make a hullmod that increases the number of logistics mods that may be added to a ship by 1. I've managed to get it into Starsector, with costs appropriate to hull size, I've finagled it so that the shipyard UI doesn't mistakenly categorize it as a Logistics hullmod in one form or another.

In every respect it works, except that it does not actually increase the number of Logistics hullmods that can be applied to a ship.

Am I missing something really obvious here?

Code
public class sd_AHM_LogisticSlot extends BaseHullMod {

private static final int LOGISTICS_HULLMOD_SLOTS_BONUS = 1;

public void applyEffectsBeforeShipCreation(ShipAPI ship, MutableShipStatsAPI stats, String id) {
ship.getMutableStats().getDynamic().getMod(Stats.MAX_LOGISTICS_HULLMODS_MOD).modifyFlat(id, LOGISTICS_HULLMOD_SLOTS_BONUS);
}

public String getDescriptionParam(int index, HullSize hullsize) {
if (index == 0) return "" + LOGISTICS_HULLMOD_SLOTS_BONUS;
return null;
}

}

I'm feeling very dumb at the moment.

[edit]

Okay, so, thanks to TaxPriest, it's almost-all-working now: by changing

Code
ship.getMutableStats()
to simply
Code
stats
it is in almost all respects working.

The only thing that's left somewhat unideal is that the shipyard still shows the normal maximum number of logistics hullmods when you have the newly-enlarged number of logistics hullmods installed and mouse-over an additional one. But still!
« Last Edit: May 06, 2020, 07:40:22 PM by ShadowDragon8685 »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 19208
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6358 on: May 06, 2020, 08:02:44 PM »

What happens if you install this mod, then install 3 logistics mods, and then uninstall this mod? IIRC this is only really supported as a built-in and wouldn't handle this sort of case (i.e. where removing the mod with this bonus is possible).
Logged

Raeven

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6359 on: May 06, 2020, 11:41:44 PM »

Can you edit the hullmods in the starfarer.api.zip files directly and save it? i want to edit the numbers a bit on expanded cargo holds, fuel tank, deck crew and ground support,

if not,how to make a simple mod to edit these hullmods?  thanks in advance.
Logged
Pages: 1 ... 422 423 [424] 425 426 ... 539