Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 407 408 [409] 410 411 ... 711

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

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6120 on: February 26, 2020, 09:00:02 AM »

I see, I'll move market creation/removal out of that class and into a script.

Thank you for taking the time to answer this.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6121 on: February 26, 2020, 09:14:04 AM »

Yep! Good luck.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6122 on: February 26, 2020, 12:14:48 PM »

Just letting you know, it worked flawlessly and I learned a lot about not putting all my eggs in one basket.
thanks again!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6123 on: February 26, 2020, 12:21:06 PM »

Nice, glad you were able to figure it out!
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6124 on: February 26, 2020, 01:27:29 PM »

Would this: (for wings definition in a variant file)

Code
  "wings": [
    "archean_wasp_wing",
    "archean_wasp_wing",
    "archean_xyphos_wing",
    "archean_dagger_wing",
  ]

As opposed to:

Code
  "wings": [
    "archean_wasp_wing",
    "archean_wasp_wing",
    "archean_xyphos_wing",
    "archean_dagger_wing"
  ]

Cause a nullpointer in combat main?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6125 on: February 26, 2020, 01:46:32 PM »

The difference being one comma, right? No it would not; both ways should parse/load fine.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6126 on: February 26, 2020, 01:56:13 PM »

Sometimes a new line, but no additional entries or anything. Thanks for ruling it out. Back to the drawing board.

(Mass replace of variants' wing ids with my IDE caused that error and I'm trying to retrace it to a formatting issue or a typo or something else I've missed, etc)

*EDIT* Yeah this is a lost cause.  :P

Sigh, I'm just going to purge the project to the last working version. That error is far too annoying to deal with to waste this much time on it. I've searched 200 files so far and the ids all match. It would have to be a fighter id mismatch for a variant- or a hull id or variant id mismatch for the skin files that some fighters use. I've triple checked all the skin files and ship files and their ids are correct. The csv's definitions match too, and I've gone through half of the variant files that actually have wing definitions. All built in wings are correct- and removing the descriptions file doesn't solve it so it's not a parsing issue with that either. I've even checked off the ids I've encountered in variants and- assuming mass replace actually works as intended upon all sub-directories (it seems to) then there is a correct example of each wing definition in at least one variant file- so you'd assume they would therefore all be correct.

It can't be an issue with something that's hardcoded (I've already accounted for the one place I do this myself in the tutorial) because all vanilla files should still be readable and intact. Now all I do for fighters (well if it worked) was add an override the csv entries for wing data and ship data. That should be it.  >:(

Whelp, I'm just going to have to slow down and replace one file and all its references at a time and then load the game for safety. That's what I was doing at first, but it takes forever to do it that way.

*EDIT2*

AHAH! Found it! It wasn't an incorrect id it was a missing one.  ::)

I checked the entire directory three times and I still missed one id reference by lacking a file implementation. I had to block implement prior backed-up changes to isolate it down to figure it out. Everything seems to work as intended now!  ;D
« Last Edit: February 26, 2020, 08:14:38 PM by Morrokain »
Logged

hyoukikyo

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6127 on: February 27, 2020, 01:24:15 AM »

Hello.

Thank you Alex. Your comment about the market specifics made me look into the variants next because luddic and tritach had their own brawlers in their own markets.

It was there that i found that the base game (at least the one that i have currently) does not have a standard/assault brawler variant.
It only has the luddic and tritach variants in the folder(I do not truly know if this mattered).
So what I did was just write a standard brawler variant and now it is working fine and well.
I do not think I fully understand the various specifics and how all the files affect each other yet but this has been very helpful to me to start with.

Thank you.
« Last Edit: February 27, 2020, 01:35:20 AM by hyoukikyo »
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6128 on: March 01, 2020, 06:33:41 PM »

Hi guys,

So I was tooling around with another experiment of mine, and I found out you can make a "playable" fighter by making it a frigate, and then with script wizardry setting its hullsize and collisionclass to a fighter with everyframe as soon as they deploy.

It seems to work for the most part, i've only ran into a few bugs outside of some UI issue.
 
a.) Game crash when "fighter" retreats
Quote
java.lang.NullPointerException
   at com.fs.starfarer.combat.ai.movement.maneuvers.RetreatManeuver.o00000(Unknown Source)
   at com.fs.starfarer.combat.CombatState.controlPlayerShip(Unknown Source)
   at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

Since AI is obfuscated ( or so i am told), I dont think there's anything I can do to fix this, so I thought...Instead of normal retreat, what about making it so that the player can fly to any ship on player side with a fighter bay, and "land" on it using beginLandingAnimation. Is there any method to lock the controls of the "fighter" and keep it anchored to the ship it landed on (to simulate it being inside the ship, if that makes sense) until calling "abortLanding()" by some arbitrary condition being satisified? I figure that I can maybe do this, and then set player ship to isRetreating if the carrier retreats? Do you think that would work?

Oh and one other question, how do ships priortize fighter threat level? I noticed sometimes they will actually attempt to fire all guns on it, and keep their distnace usually if its the only target, and otherwise kind of ignore it if there's something else around like a frigate/destroyer/etc..are there any factors that play into this beside the size of those targets?
« Last Edit: March 01, 2020, 10:28:50 PM by shoi »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6129 on: March 02, 2020, 07:21:59 AM »

Since AI is obfuscated ( or so i am told), I dont think there's anything I can do to fix this, so I thought...Instead of normal retreat, what about making it so that the player can fly to any ship on player side with a fighter bay, and "land" on it using beginLandingAnimation. Is there any method to lock the controls of the "fighter" and keep it anchored to the ship it landed on (to simulate it being inside the ship, if that makes sense) until calling "abortLanding()" by some arbitrary condition being satisified? I figure that I can maybe do this, and then set player ship to isRetreating if the carrier retreats? Do you think that would work?

That... might kind of work. I don't exactly remember, though. And if *that* ship retreated, the player "fighter" would still be left on the field somewhere in an unretreated and invisible state.

Oh and one other question, how do ships priortize fighter threat level? I noticed sometimes they will actually attempt to fire all guns on it, and keep their distnace usually if its the only target, and otherwise kind of ignore it if there's something else around like a frigate/destroyer/etc..are there any factors that play into this beside the size of those targets?

That's about right, yeah. Just in general "making a player-pilotable fighter" is really going against the grain, there will be issues that are hard or impossible to solve. It "works" only in the most basic sense of being able to control a fighter.
Logged

Kaykat

  • Ensign
  • *
  • Posts: 8
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6130 on: March 03, 2020, 02:47:18 PM »

Is there a way to have two different descriptions for landing on a planet, one when it isn't colonized and one when it is?

I am not a modder/coder in any capacity more than copy pasting things so simple explain do much good :X
Logged
If all the mod authors weren't so entitled and rude all the time maybe I would've stayed and contributed, au revoir >_>

SafariJohn

  • Admiral
  • *****
  • Posts: 3027
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6131 on: March 03, 2020, 03:35:45 PM »

You can change a planet's description from a simple EveryFrameScript.

I think you can just copy-paste the code below into a file called PlanetDescriptionUpdater.java (create a .txt file in data/scripts and rename it) and it will work (once modified for your ids and stuff), but I'm not sure I've ever actually done it that way. Might need to reference it in settings.json? IDK

Spoiler
package data.scripts;

import com.fs.starfarer.api.EveryFrameScript;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.campaign.PlanetAPI;
import com.fs.starfarer.api.campaign.StarSystemAPI;
import com.fs.starfarer.api.campaign.econ.MarketAPI;

public class PlanetDescriptionUpdater implements EveryFrameScript {
    private static final String SYSTEM = "yourSystemNameHere"; // Name of the star system
    private static final String PLANET = "yourPlanetIdHere"; // id (not name) of the planet
    private static final String DESC_COLONIZED = "yourDescriptionIdHere"; // id of your description in descriptions.csv
    private static final String DESC_EMPTY = "yourDescriptionIdHere"; // id of your description in descriptions.csv

    private boolean isColonized;

    private float interval;

    public PlanetDescriptionUpdater() {
        isColonized = false;

        interval = 0;
    }

    @Override
    public void advance(float amount) {
        float days = Global.getSector().getClock().convertToDays(amount);

        interval += days;

        if (interval < 1) return; // Only check once a day
        interval -= 1;

        StarSystemAPI system = Global.getSector().getStarSystem(SYSTEM);
        PlanetAPI planet = (PlanetAPI) system.getEntityById(PLANET);
        MarketAPI market = planet.getMarket();

        // If colony destroyed
        if (market.isPlanetConditionMarketOnly() && isColonized) {
            isColonized = false;

            planet.setCustomDescriptionId(DESC_EMPTY);
        } // If colonized
        else if (!market.isPlanetConditionMarketOnly() && !isColonized) {
            isColonized = true;

            planet.setCustomDescriptionId(DESC_COLONIZED);
        }

        // Otherwise do nothing.
    }

    @Override
    public boolean runWhilePaused() {
        return false;
    }

    @Override
    public boolean isDone() {
        return false;
    }
}
[close]
« Last Edit: March 03, 2020, 07:23:15 PM by SafariJohn »
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6132 on: March 03, 2020, 11:00:19 PM »



That's about right, yeah. Just in general "making a player-pilotable fighter" is really going against the grain, there will be issues that are hard or impossible to solve. It "works" only in the most basic sense of being able to control a fighter.

Thanks Alex! Yeah,the more I think of it, there are just too many variables you'd have to factor for, even if I was able to get the base implementation working.  I'll shelve this idea for now
Logged

Pandora

  • Ensign
  • *
  • Posts: 37
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6133 on: March 04, 2020, 03:11:01 PM »

What you could do is try and study the shuttle that carries the player from one ship to the other while in combat.That could probably give a few answers...
But it still wouldn't solve the problem with controlling it, huh...
Logged

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6134 on: March 05, 2020, 08:27:41 AM »

If I place a filepath in the replace section of a file_info.json I can replace a vanilla file

Can I do the same with a file that exist in another mod currently used? Meaning, can I replace the (for example) CustomFaction.faction file of Mod A With a Mod B CustomFaction.faction.

In the case where 2 or more mod try to replace the same file, what happens?
Logged
Pages: 1 ... 407 408 [409] 410 411 ... 711