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: Simulator Enhancements (03/13/24)

Pages: 1 ... 411 412 [413] 414 415 ... 706

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6180 on: March 15, 2020, 05:02:02 PM »

@Zapper: in a nutshell, you need to provide a version of the skill in your mod, and make sure your mod also has a skill_data.csv that points to your implementation of the skill.

It sounds like you're editing the source files from starfarer.api.zip - those are only provided for reference, so changing them directly won't do anything.
Logged

Zapper

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6181 on: March 16, 2020, 03:22:34 AM »

@Alex

i have downloaded this mod https://fractalsoftworks.com/forum/index.php?topic=14502.0 and that uses one .skill file in this structure "data\characters\skills" here it points to {"type":"ALL_SHIPS_IN_FLEET", "script":"skillrework.campaign.skills.AdvancedCountermeasures$Level1f"} this gets an error "unknown scoure" when i edit it to fleetlogistics
it also usess a jar file "jars/skillreworks.jar in this arcive are the class file "jars\SkillRework\campaign\skills" that have been edited to his liking.

i have looked @ the skill_data but dont know what i sould do with it as i'm not making a new skill just over writing and existing skill.

see below the error i'm getting
P.S i am using intelliJ to make the jar file flowing a guide on this forum.

9744 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [ma.campaign.skills.FleetLogistics$Level2]
java.lang.RuntimeException: Error compiling [ma.campaign.skills.FleetLogistics$Level2]
   at com.fs.starfarer.loading.scripts.ScriptStore$3.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: ma.campaign.skills.FleetLogistics$Level2
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:179)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more

Logged

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6182 on: March 16, 2020, 05:25:32 AM »

Per drone, yeah.

Thanks - that works quite well :)

Another question though: how do I get the instance of the statsScript associated with a ship's system?
Logged

fortyseven

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6183 on: March 16, 2020, 04:45:40 PM »

Hi there is it possible when making a customised star system to position it randomly on the sector map?

      
Spoiler
//Star
      PlanetAPI star = system.initStar(
         "star",
         "star_yellow",
         800,
                        x
                        y   
         600);
[close]

So I would like the x and y coordinates to have random values say between -20000 to -10000 or 10000 to 20000 (I want to not have it spawn amongst the core worlds)

Is it possible to use (int)Math.random() for this? and how would you make the "or" argument?

Thank you!
Logged

tomatopaste

  • Captain
  • ****
  • Posts: 306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6184 on: March 16, 2020, 07:10:49 PM »

Hi there is it possible when making a customised star system to position it randomly on the sector map?

      
Spoiler
//Star
      PlanetAPI star = system.initStar(
         "star",
         "star_yellow",
         800,
                        x
                        y   
         600);
[close]

So I would like the x and y coordinates to have random values say between -20000 to -10000 or 10000 to 20000 (I want to not have it spawn amongst the core worlds)

Is it possible to use (int)Math.random() for this? and how would you make the "or" argument?

Thank you!

Basic java, you just want to replace the numbers 800 and 600 with a randomX and randomY where
Code
int randomX;
        int randomY;
        do {
            randomX = ThreadLocalRandom.current().nextInt(-20000, 20000);
            randomY = ThreadLocalRandom.current().nextInt(-20000, 20000);
        } while (!(-10000 < randomX && randomX < 10000) && !(-10000 < randomY && randomY < 10000));
« Last Edit: March 16, 2020, 07:16:18 PM by tomatopaste »
Logged

fortyseven

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6185 on: March 17, 2020, 03:15:29 AM »


Basic java, you just want to replace the numbers 800 and 600 with a randomX and randomY where
Code
int randomX;
        int randomY;
        do {
            randomX = ThreadLocalRandom.current().nextInt(-20000, 20000);
            randomY = ThreadLocalRandom.current().nextInt(-20000, 20000);
        } while (!(-10000 < randomX && randomX < 10000) && !(-10000 < randomY && randomY < 10000));

Hi tomatopaste, thanks for your reply! I appologise for my lack of java knowledge so you might need to help me a little more a long the way.

I tried to insert your code at x and y but I get a runtime exception due to a parsing error. This is the readout from the log file starting at the error.

Spoiler
25125 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.MyStarPlugin]
java.lang.RuntimeException: Error compiling [data.scripts.MyStarPlugin]
   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.scripts.MyStarPlugin'
   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: File 'data/scripts/MyStarPlugin.java', Line 65, Column 7: Expression "int" is not an rvalue
   at org.codehaus.janino.Java$Located.throwCompileException(Java.java:111)
   at org.codehaus.janino.Java$Atom.toRvalueOrCompileException(Java.java:2698)
   at org.codehaus.janino.Parser.parseArgumentList(Parser.java:2696)
   at org.codehaus.janino.Parser.parseArguments(Parser.java:2682)
   at org.codehaus.janino.Parser.parsePrimary(Parser.java:2354)
   at org.codehaus.janino.Parser.parseUnaryExpression(Parser.java:2252)
   at org.codehaus.janino.Parser.parseMultiplicativeExpression(Parser.java:2211)
   at org.codehaus.janino.Parser.parseAdditiveExpression(Parser.java:2190)
   at org.codehaus.janino.Parser.parseShiftExpression(Parser.java:2169)
   at org.codehaus.janino.Parser.parseRelationalExpression(Parser.java:2072)
   at org.codehaus.janino.Parser.parseEqualityExpression(Parser.java:2046)
   at org.codehaus.janino.Parser.parseAndExpression(Parser.java:2025)
   at org.codehaus.janino.Parser.parseExclusiveOrExpression(Parser.java:2004)
   at org.codehaus.janino.Parser.parseInclusiveOrExpression(Parser.java:1983)
   at org.codehaus.janino.Parser.parseConditionalAndExpression(Parser.java:1962)
   at org.codehaus.janino.Parser.parseConditionalOrExpression(Parser.java:1941)
   at org.codehaus.janino.Parser.parseConditionalExpression(Parser.java:1922)
   at org.codehaus.janino.Parser.parseAssignmentExpression(Parser.java:1901)
   at org.codehaus.janino.Parser.parseExpression(Parser.java:1886)
   at org.codehaus.janino.Parser.parseVariableInitializer(Parser.java:966)
   at org.codehaus.janino.Parser.parseVariableDeclaratorRest(Parser.java:1230)
   at org.codehaus.janino.Parser.parseVariableDeclarator(Parser.java:1215)
   at org.codehaus.janino.Parser.parseVariableDeclarators(Parser.java:1177)
   at org.codehaus.janino.Parser.parseBlockStatement(Parser.java:1158)
   at org.codehaus.janino.Parser.parseBlockStatements(Parser.java:1085)
   at org.codehaus.janino.Parser.parseMethodDeclarationRest(Parser.java:938)
   at org.codehaus.janino.Parser.parseClassBodyDeclaration(Parser.java:565)
   at org.codehaus.janino.Parser.parseClassBody(Parser.java:515)
   at org.codehaus.janino.Parser.parseClassDeclarationRest(Parser.java:481)
   at org.codehaus.janino.Parser.parsePackageMemberTypeDeclaration(Parser.java:269)
   at org.codehaus.janino.Parser.parseCompilationUnit(Parser.java:168)
   at org.codehaus.janino.JavaSourceIClassLoader.findCompilationUnit(JavaSourceIClassLoader.java:203)
   at org.codehaus.janino.JavaSourceIClassLoader.findIClass(JavaSourceIClassLoader.java:146)
   ... 7 more
[close]
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6186 on: March 17, 2020, 04:59:42 AM »

I'm looking for a way to make an industry require two industry slots.
My hackjob solution is to make it unavailible if there are less than two open, and auto-place an secondary industry on build, wich causes issues I would rather not have to account for since it can be removed...

is there a better way?
Thanks :)
Logged

Alluvian

  • Lieutenant
  • **
  • Posts: 53
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6187 on: March 17, 2020, 06:35:29 AM »

I'm looking for a way to make an industry require two industry slots.
My hackjob solution is to make it unavailible if there are less than two open, and auto-place an secondary industry on build, wich causes issues I would rather not have to account for since it can be removed...

is there a better way?
Thanks :)

One alternative would be to still require 2 slots to start, but on build to reduce the total slots available by one. However, this means you would need to restore the reduced slot if/when the industry is removed.

Another would be to add a planetary condition (or other similar non-industry slot addition) that has the -1 reduction effect while present.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6188 on: March 17, 2020, 08:08:04 AM »


One alternative would be to still require 2 slots to start, but on build to reduce the total slots available by one. However, this means you would need to restore the reduced slot if/when the industry is removed.

Another would be to add a planetary condition (or other similar non-industry slot addition) that has the -1 reduction effect while present.

I'd have done that if it was possible to modify the total industry slots on a market, which it is not (without touching pop&infrastructure) to my knowledge.

there is, as far as I can see, no way to make something count as industry (and therefore counting towards the limit on a market) without extending baseIndustry.

but I would gladly be proven wrong
« Last Edit: March 17, 2020, 08:10:54 AM by SirHartley »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6189 on: March 17, 2020, 11:51:48 AM »

Another question though: how do I get the instance of the statsScript associated with a ship's system?

You can't directly - but if that script puts a reference to itself into the CombatEngineAPI.getCustomData(), you could use that.


I'd have done that if it was possible to modify the total industry slots on a market, which it is not (without touching pop&infrastructure) to my knowledge.

(This'll be possible in the next release, btw, there'll be a market stat for this.)
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6190 on: March 17, 2020, 01:03:28 PM »

I have the slight fear that my entire mod will become obsolete with the next release.

Is there a way to do it for the current release, or a way to make invisible industry buildings?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6191 on: March 17, 2020, 01:21:53 PM »

IIRC if you override BaseIndustry.isHidden() to return true, that industry won't show up in the main list. It'd still show up in the "industry count tooltip", though - at least I think.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 839
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6192 on: March 17, 2020, 01:40:48 PM »

Yep, that worked. IndustryCount doesn't show it, but industries&Structures tooltip does.
Thanks!
Logged

Harpuea

  • Lieutenant
  • **
  • Posts: 58
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6193 on: March 18, 2020, 10:10:56 AM »

Is there a way to change the sprite of a ship without having to make duplicated Hulls, variant, and CSVs files? I just want to repaint a ship so all the ships in the fleet match colors. I messed around in Eclipse and found Ship.setSprite API, but it seems that will be complicated to write UI in game in order to work for all ships.

For now, I'll try the hullmod approach. But that is rather specific to a ship and isn't a broad stroke approach in order to paint ALL ships.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6194 on: March 18, 2020, 04:02:39 PM »

If you are okay with all ships of that class having your paint scheme, you should be able to easily make a mod to change the sprites. Just give your sprites the exact same names (and folders) as the ones you want to replace and (if you are replacing mod sprites) be sure to prefix your mod's ID with "zz" so it loads last.

If you only want your ships to have the paint scheme, then a hullmod will probably work. I've never messed around with dynamically changing sprites, so I'm not sure what you can and can't do there.
Logged
Pages: 1 ... 411 412 [413] 414 415 ... 706