Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 472 473 [474] 475 476 ... 710

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

Stealth

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7095 on: March 01, 2021, 06:46:40 AM »

edit2: so i got another error

It looks like you aren't importing the EconomyAPI class in your class.

Sorry if I am assuming too much, but this leads me to believe you are not using an IDE to compile your code since it generally wouldn't compile the code in the first place without an import statement. I would highly recommend setting one up if possible. It will save you a lot of time and effort dealing with things like this. It points out syntax errors and lets you know when variables you create aren't used, when objects could potentially cause nullpointers, etc. I use IntelliJ. There is a tutorial to set that up though it is a little dated by now.

For this specific case, it would have made your EconomyAPI object unusable and when you mouse over it the IDE tells you that you need the import statement. You can then hold alt + left click and select "import class" and it would add the statement for you without you even having to scroll up.

------------------------------------------------

*EDIT*
Ahh, ok I don't think the IntervalUtil being static was the factor. The issue was actually because I was running 2+ IntervalUtils and so they had to elapse simultaneously for the logic to work properly. I just need to preserve the isElapsed boolean in another variable and run the logic when that variable returns true.

yeah i use intellj too but i am not well versed in codeing and stuff. anyway i figured out that i didnt import the economyapi. it all works now (althought how do you slow down the orbit time of planet?) and i tried to add the planet to my faction but i am getting an compiling error.
Quote
16523 [Thread-4] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.RuntimeException: Error compiling [data.scripts.McrnPlugin]
java.lang.RuntimeException: Error compiling [data.scripts.McrnPlugin]
   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.McrnPlugin'
   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/McrnPlugin.java', Line 34, Column 27: '(' expected instead of '.'
   at org.codehaus.janino.Parser.compileException(Parser.java:3125)
   at org.codehaus.janino.Parser.read(Parser.java:2822)
   at org.codehaus.janino.Parser.parseFormalParameters(Parser.java:999)
   at org.codehaus.janino.Parser.parseMethodDeclarationRest(Parser.java:916)
   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

i add this
Code
public class McrnPlugin implements SectorGeneratorPlugin {

public abstract void com.fs.starfarer.api.campaign.SectorGeneratorPlugin.generate(com.fs.starfarer.api.campaign.SectorAPI){
FactionAPI mcrn = sector.getFaction("mcrn");
}}
to my code because i assume (from looking at other mods) thats how you add a faction
Logged
"it is what it is"  ~me every 30 seconds

Bad_Idea

  • Ensign
  • *
  • Posts: 17
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7096 on: March 01, 2021, 11:50:26 PM »

So i've been working on a fun little mod that does a fair bit of stuff with hyperspace clouds. Whilst the general function of the mod works just fine i'm having an annoying issue: whenever you use nebulaeditor tiles[ ][ ] to change a cell into a hyperspace cloud it's always given the same sprite.

https://i.imgur.com/3dKpkFn.jpg
As seen in this image the clouds are all the same sprite, just rotated at random. If there's no way of directly affecting this that'd be fine (mod itself does work, after all), but it'd be really nice if there was!
possibly solved, didn't realize the tile value probably corresponds to which cloud is spawned
« Last Edit: March 02, 2021, 12:30:52 AM by Bad_Idea »
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7097 on: March 03, 2021, 08:04:05 AM »


While this is not the question you asked Shoi? I would *strongly* recommend against remove and replace to do what you are doing. That will have innumerable issues some of which can be solved easily, some with great difficulty, and some not at all. Not going to list off specifically what is what as there is a much more correct way of fixing your issue and I don't want to effort post right now anyways...
- The problem you found
- Missile hitpoints
- Missile engine state
- Missile engine lifetime
- Missile fuze time (especially custom scripted ones)
- Missile EMP arc resistance
- Continuously spawned submunitions on some mod missiles
- And a bunch of other things...
Code: java
                    if (thisProj instanceof MissileAPI)
                    {
                        MissileAPI asMissile = (MissileAPI) thisProj;
                        exigency_MissileJammerPlugin.unhackMissile(asMissile);

                        if (asMissile.getMissileAI() instanceof GuidedMissileAI)
                        {
                            ((GuidedMissileAI) asMissile.getMissileAI()).setTarget(null);
                        }
                    }
Do something like that instead, and then the missile will retarget as you want it to. Source? Heh, legends of my past insanity...

This was EXACTLY what I was trying to figure out how to do! Thanks a ton Meso!
Logged

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7098 on: March 05, 2021, 11:08:56 AM »

is it possible to modify "TextureScrollSpeed" from a Beam or Weapon API
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7099 on: March 05, 2021, 11:13:55 AM »

is it possible to modify "TextureScrollSpeed" from a Beam or Weapon API

I don't think so - it's a property of the beam spec, not an individual weapon.

You could in theory do weaponensureClonedSpec() and then change the spec, but the relevant methods for texture scroll speed are not in WeaponSpecAPI since non-beam weapons don't have it.

(So, basically, this *could* be doable, but currently isn't... sorry!)
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7100 on: March 10, 2021, 02:26:32 AM »

How does ConstellationGen.SpringSystem actually work?

More specific form of the question
So, Nexerelin's random sector uses a modified StarSystemGenerator to create a single large constellation in the middle of the map during the new game sector generation.
Nex and other mods can also add manually defined and placed star systems at this point; in the screenshot below, they're the Sitnalta nebula to the left and Styx and Antioch star systems to the right.
(click to enlarge)


Now as you can see, one of the procgen star systems is overlapping Sitnalta. So I figure, I can try to the list of systems passed to ConstellationGen.doConstellationLayout, the idea being that the "springs" will gently push the systems apart.

Instead it completely changed the shape of the constellation, with Sitnalta pushed to the bottom (new sector generated with the same seed):



Given that I don't want Sitnalta to drift too far from the approximate center of the map (due to its intended role as a trade stop in the middle of the sector), is there a better way to avoid the overlap issue?
[close]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7101 on: March 10, 2021, 11:17:41 AM »

I'd suggest using the SectorProcGen.blotOut() method. IIRC stuff marked with that will not get constellation placed there during the rest of procgen, if you do it early enough. E.G. if you look at SectorProcGen.generate(), it does blotOut() for the hand-made core system areas (and a few other places) before proceeding with procgen.

(The SpringSystem stuff, as you've found, will radically alter the shape of the constellation. It's only meant to be used on stars within one constellation at a time, though; I'm guessing you added more stars than that? I'm not sure why it'd move Sitnalta so far away otherwise.)
Logged

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7102 on: March 10, 2021, 11:51:04 AM »

<WeaponAPI>.getSpec().getTurretFireOffsets().get(0)

on a weapon with a single offset, returns randomly one of four points on a slowly rotating circle whose radius is equal to the actual turretoffset length. I'am a bit confused as to why.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7103 on: March 10, 2021, 12:02:49 PM »

My guess is something is writing to that weapon's turret offset array. This could be from another weapon; weapon specs are shared across all weapons unless you call WeaponAPI.ensureClonedSpec() for that weapon.
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7104 on: March 11, 2021, 01:22:55 PM »

What's the difference between getFluxLevel() and getCurrFlux()?

I want to say one of them returns a float between 0-1, but im not sure if im thinking of something else.

edit: it says in the api, i am a derp
« Last Edit: March 11, 2021, 01:46:01 PM by shoi »
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7105 on: March 12, 2021, 06:14:38 AM »

I'm looking to check if a Hullmod is legal to apply to a ShipVariant.
Is there a way to even do that?

I can't find an option to create a ShipAPI object from a ShipVariantAPI obj. to use HullModSpecAPI.getEffect().isApplicableToShip(ShipAPI) since ShipAPI does not exist out of combat.

I'd appreciate the help.
Thank you -
« Last Edit: March 12, 2021, 06:18:39 AM by SirHartley »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7106 on: March 12, 2021, 11:47:44 AM »

It's not possible, yeah.

Consider stuff like Omni Shield Emitter - it doesn't apply to a Hound, unless the Hound also has Makeshift Shield Generator installed. But the effect of MSG only happens when it's applied to a ship; there's no way to tell from the variant whether it adds a shield or not. Other interactions of this general nature are possible, too.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7107 on: March 12, 2021, 12:03:38 PM »

Makes sense, thank you!
Logged

Sinosauropteryx

  • Captain
  • ****
  • Posts: 262
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7108 on: March 13, 2021, 02:36:03 PM »

What determines a ship's contrail on the campaign map?

Is there a way for a ship with all angled engines (non 180 degrees) to have a normal 180 degree contrail?
Logged

Kakroom

  • Commander
  • ***
  • Posts: 172
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7109 on: March 13, 2021, 06:57:56 PM »

I'm looking for the ground_support .java in starsector-core\data\hullmods. I'm trying to make a very small mod, with one hullmod that you can choose to apply to a carrier/s that gives your fleet a bonus to raid effectiveness based on its size, because I want to pretend I'm sending in my fighters to bomb stuff. I know very, very little about scripting, so I was hoping to learn some from Ground Support Package's script since that's the only other vanilla one that affects raid strength... but I can't find it. Is it located somewhere else?
Logged
Pages: 1 ... 472 473 [474] 475 476 ... 710