Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 411 412 [413] 414 415 ... 467

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

Zapper

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6180 on: March 15, 2020, 02:11:19 PM »

Hi all, i am new to this game and have been playing for a few days now.
the only thing about this game that is bugging me is maintance supplys i do not like.
so i started looking for a way to change that. console command inf supply i tried first i do not like that because that to op.
 second thing i tried was editing the ship_data.csv file and edit the "AM"colum to all 0 this was oke until i got in a battle and could deploy every ship in my fleet including the AI becuase ZERO deployment cost followed by masive lag.
next atempt changing the skill fleet logistics second level modifier -25% maintance upkeep i want to change this to -95% and keep editing it untill its to my liking but here comes the my problem i can't get it to work i have spend the last 4 hours trying and you guys/girls are my last hope i have tried a lot but there is always a error apperently this is not a easy change value like i am use to in game like HOI4, Skyrim, EU4, AOE2, Factorio. could you give me some advice on how to continue
Logged

tomatopaste

  • Commander
  • ***
  • Posts: 105
  • Gentle Mann of Leisure
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6181 on: March 15, 2020, 03:14:24 PM »

One other thing you want to do that's subtle in its effects:

drone.getAIFlags().setFlag(AIFlags.DRONE_MOTHERSHIP, 20000f, mothership);

If this isn't done, things will work, but enemy AI will be more distracted by the drones than it should be.

Do you mean
Code
ship.getAIFlags().setFlag(ShipwideAIFlags.AIFlags.DRONE_MOTHERSHIP, 20000.0f, (java.lang.Object)this.ship);
or per drone?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6182 on: March 15, 2020, 04:59:51 PM »

Per drone, yeah.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6183 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 #6184 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

  • Commander
  • ***
  • Posts: 105
  • Gentle Mann of Leisure
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6185 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: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6186 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

  • Commander
  • ***
  • Posts: 105
  • Gentle Mann of Leisure
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6187 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: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6188 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

  • Captain
  • ****
  • Posts: 294
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6189 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

  • Ensign
  • *
  • Posts: 33
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6190 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

  • Captain
  • ****
  • Posts: 294
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6191 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: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6192 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

  • Captain
  • ****
  • Posts: 294
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6193 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: 17419
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6194 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
Pages: 1 ... 411 412 [413] 414 415 ... 467