Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.98a is out! (03/27/25)

Pages: 1 ... 116 117 [118] 119 120 ... 769

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

Zaphide

  • Admiral
  • *****
  • Posts: 799
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1755 on: October 06, 2014, 06:15:24 PM »

OK well is DGYGen.java in the data/scripts/world folder? Basically the folder needs to match the package definition (I believe, Java is certainly not my strong point :) )

Yeah it is. I wish it were that straightforward (it probably still is and I'm just blind, it's been awhile since I played with java)

Hmmm maybe attach the file? Bit hard to tell otherwise :)
Logged

SlimPickens

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1756 on: October 11, 2014, 04:46:49 PM »

Zaphide is a scholar and gentleman (or woman)

Edit: found it


On a side note, in my gen file I went and made the star system's coordinates randomized. Nothing else changed, and now it creates two identical star systems. I'm inclined to just call it a feature but haven't the faintest idea why it's happening.
« Last Edit: October 11, 2014, 04:51:20 PM by SlimPickens »
Logged

Rushyo

  • Ensign
  • *
  • Posts: 46
    • View Profile
    • Home Page
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1757 on: October 20, 2014, 07:18:32 AM »

How can you get rid of the traditional starting systems?

e.g. Remove Corvin and all the ships and assorted flotsam that would otherwise spawn there.

It's for a total conversion. Currently the alpha build still has those systems there, but they serve no functional purpose and only serve to demolish suspension of disbelief. I've had a few clumsy attempts to do this using the API and it always ends in a great big mess.

Any ideas?
Logged

MShadowy

  • Admiral
  • *****
  • Posts: 911
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1758 on: October 21, 2014, 06:44:42 PM »

Ahhh, market woes.

Specifically, I've got SHI set up now so that Anar is spawning... not correctly, (the stations are orbiting the wrong bodies, the one supposed to be around Euripides is orbiting Theramin, and Theramins station is orbiting in approximately the center of the local star) but it's spawning.  But the economy in the system is not starting for reasons that are rather unclear.  It's not giving any errors that I can find in the log; will a json for the economy not work if it's a mod?  If so that would seem quite strange.

Also, where are the definition for specific market conditions? I haven't been able to suss them out.

E: Didn't have time earlier, but here's the source for the system generation.

Spoiler
SHIGen.java
Code
package data.scripts.world;

import com.fs.starfarer.api.campaign.FactionAPI;
import com.fs.starfarer.api.campaign.RepLevel;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorGeneratorPlugin;
import com.fs.starfarer.api.impl.campaign.CoreCampaignPluginImpl;
import com.fs.starfarer.api.impl.campaign.CoreScript;
import com.fs.starfarer.api.impl.campaign.events.CoreEventProbabilityManager;
import com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetManager;
import com.fs.starfarer.api.impl.campaign.ids.Factions;

import data.scripts.world.anar.Anar;

public class SHIGen implements SectorGeneratorPlugin {

    @Override
    public void generate(SectorAPI sector) {
        initFactionRelationships(sector);
       
        new Anar().generate(sector);
       
        sector.registerPlugin(new CoreCampaignPluginImpl());
sector.addScript(new CoreScript());
sector.addScript(new CoreEventProbabilityManager());
sector.addScript(new EconomyFleetManager());
    }
   
    public static void initFactionRelationships(SectorAPI sector) {
        FactionAPI hegemony = sector.getFaction(Factions.HEGEMONY);
FactionAPI tritachyon = sector.getFaction(Factions.TRITACHYON);
FactionAPI pirates = sector.getFaction(Factions.PIRATES);
FactionAPI independent = sector.getFaction(Factions.INDEPENDENT);
FactionAPI kol = sector.getFaction(Factions.KOL);
FactionAPI church = sector.getFaction(Factions.LUDDIC_CHURCH);
FactionAPI path = sector.getFaction(Factions.LUDDIC_PATH);
FactionAPI player = sector.getFaction(Factions.PLAYER);
FactionAPI diktat = sector.getFaction(Factions.DIKTAT);
        FactionAPI shadow = sector.getFaction("shadow_industry");
       
        player.setRelationship(shadow.getId(), 0);
       
        shadow.setRelationship(path.getId(), RepLevel.VENGEFUL);
       
        shadow.setRelationship(hegemony.getId(), RepLevel.HOSTILE);
        shadow.setRelationship(pirates.getId(), RepLevel.HOSTILE);
        shadow.setRelationship(diktat.getId(), RepLevel.HOSTILE);
        shadow.setRelationship(church.getId(), RepLevel.INHOSPITABLE);
        shadow.setRelationship(kol.getId(), RepLevel.SUSPICIOUS);
       
        shadow.setRelationship(tritachyon.getId(), RepLevel.NEUTRAL);
       
        shadow.setRelationship(independent.getId(), RepLevel.FAVORABLE);
    }
}

And Anar.java.
Code
package data.scripts.world.anar;

import com.fs.starfarer.api.Global;
//import com.fs.starfarer.api.InteractionDialogImageVisual;
import com.fs.starfarer.api.campaign.JumpPointAPI;
import com.fs.starfarer.api.campaign.LocationAPI;
import com.fs.starfarer.api.campaign.OrbitAPI;
import com.fs.starfarer.api.campaign.PlanetAPI;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.SectorEntityToken;
import com.fs.starfarer.api.campaign.StarSystemAPI;
//import com.fs.starfarer.api.campaign.CargoAPI.CargoItemType;
//import data.scripts.world.FleetManager;
import java.awt.Color;
//import com.fs.starfarer.api.impl.campaign.ids.Conditions;
//import com.fs.starfarer.api.impl.campaign.ids.Submarkets;
//import com.fs.starfarer.api.impl.campaign.submarkets.StoragePlugin;

public class Anar {

    public void generate(SectorAPI sector) {
       
        StarSystemAPI system = sector.createStarSystem("Anar");
        system.getLocation().set(-6000, 7500);
        LocationAPI hyper = Global.getSector().getHyperspace();
       
        PlanetAPI anar = system.initStar("anar", "star_yellow", 600f);

        PlanetAPI anar1 = system.addPlanet("lumen", anar, "Lumen", "barren", 155, 55, 1000, 53);
        //anar1.setCustomDescriptionId("planet_lumen");
        //SectorEntityToken shadowPower = system.addOrbitalStation("lumen_solar", system.getEntityById("Lumen"), 155, 200, 53, "Lumen Solar Plant", "neutral");
       
        PlanetAPI anar2 = system.addPlanet("wallow", anar, "Wallow", "toxic", 20, 180, 2250, 222);
       
        PlanetAPI anar3 = system.addPlanet("euripides", anar, "Euripides", "planet_euripides", 245, 160, 3750, 381);
        PlanetAPI anar3A = system.addPlanet(null, anar3, "Aeschylus", "cryovolcanic", 235, 40, 500, 62);
        system.addRingBand(anar3, "misc", "rings1", 128f, 2, Color.white, 128f, 550, 40f);
        system.addRingBand(anar3, "misc", "rings1", 128f, 4, Color.white, 128f, 650, 60f);
        system.addRingBand(anar3, "misc", "rings1", 256f, 6, Color.white, 256f, 700, 80f);
        anar3.setCustomDescriptionId("planet_euripides");
        //anar3.setInteractionImage("illustrations", "nanshe_desert");
       
        SectorEntityToken shadowShipyards = system.addCustomEntity("prana_vayu", "Prana Vayu Shipyards", "station_side02", "shadow_industry");
        shadowShipyards.setCircularOrbitPointingDown(system.getEntityById("euripides"), 45, 400, 50);
        //shadowShipyards.setCustomDescriptionId("station_Prana");
       
        SectorEntityToken relay = system.addCustomEntity("anar_relay", // unique id
"Anar Relay", // name - if null, defaultName from custom_entities.json will be used
"comm_relay", // type of object, defined in custom_entities.json
"shadow_industry"); // faction
// synced orbit w/ Euripides
relay.setCircularOrbit( system.getEntityById("anar"), 240, 3650, 381);
       
        PlanetAPI anar4 = system.addPlanet("calleach", anar, "Calleach", "ice_giant", 235, 300, 8000, 766);
        system.addRingBand(anar4, "misc", "rings1", 256f, 3, Color.white, 256f, 1450, 40f);
        system.addRingBand(anar4, "misc", "rings1", 128f, 4, Color.white, 128f, 1550, 60f);
        system.addRingBand(anar4, "misc", "rings1", 128f, 2, Color.white, 128f, 1550, 80f);
        system.addRingBand(anar4, "misc", "rings1", 128f, 1, Color.white, 128f, 1600, 120f);
        PlanetAPI anar4a = system.addPlanet(null, anar4, "Cinderbox", "lava", 300, 60, 800, 88);
        PlanetAPI anar4b = system.addPlanet("theramin", anar4, "Theramin", "terran", 240, 120, 1200, 246);
        PlanetAPI anar4c = system.addPlanet("melancholia", anar4, "Melancholia", "cryovolcanic", 200, 80, 1500, 492);
       
        SectorEntityToken shadowResearchBase = system.addCustomEntity("gravitas", "Gravitas Research Post", "station_side03", "shadow_industry");
        shadowShipyards.setCircularOrbitPointingDown(system.getEntityById("theramin"), 45, 300, 50);
       
        system.addAsteroidBelt(anar, 600, 10000, 1400, 600, 400);
       
        //initShadowShipyardsCargo(shadowShipyards);
        //initResearchBaseCargo(shadowResearchBase);

        SectorEntityToken a3 = system.getEntityById("euripides");
JumpPointAPI jumpPoint = Global.getFactory().createJumpPoint("euripides_gate", "Euripides Gate");
OrbitAPI orbit = Global.getFactory().createCircularOrbit(a3, 0, 500, 30);
jumpPoint.setOrbit(orbit);
jumpPoint.setRelatedPlanet(a3);
       
        jumpPoint.setStandardWormholeToHyperspaceVisual();
        system.addEntity(jumpPoint);

        system.autogenerateHyperspaceJumpPoints(true, true);

        /*
        SHISpawnPoint shiSpawn = new SHISpawnPoint(sector, system, 5, 5, system.getEntityById("Euripides"));
        system.addSpawnPoint(shiSpawn);
        for (int i = 0; i < 3; i++) {
            shiSpawn.spawnFleet();
        }

        SectorEntityToken sdftoken = system.createToken(5, 5);
        ShadowyardsSDFSpawnPoint shisdfSpawn = new ShadowyardsSDFSpawnPoint(sector, system, 30, 1, sdftoken, shadowShipyards);
        system.addSpawnPoint(shisdfSpawn);
        spawnSHIDF(sector, system, shadowShipyards);

        StarSystemAPI corvus = Global.getSector().getStarSystem("Corvus");

        SectorEntityToken hegemonyStation = corvus.getEntityById("Orbital Station");
        AnarHegemonyPatrolSpawnPoint anarPatrolSpawn = new AnarHegemonyPatrolSpawnPoint(sector, corvus, 10, 5, hegemonyStation);
        corvus.addSpawnPoint(anarPatrolSpawn);
        for (int i = 0; i < 5; i++) {
            anarPatrolSpawn.spawnFleet();
        }

        AnarIndieSpawnPoint independentSpawn = new AnarIndieSpawnPoint(sector, system, 10, 15, shadowShipyards);
        system.addSpawnPoint(independentSpawn);
        for (int i = 0; i < 2; i++) {
            independentSpawn.spawnFleet();
        }

        system.addSpawnPoint(new SHIConvoySpawnPoint(sector, hyper, 12, 1, hyper.createToken(-5000, 7000), shadowShipyards));
        */
}

    /*private void spawnSHIDF(SectorAPI sector, StarSystemAPI system, SectorEntityToken location) {
        CampaignFleetAPI fleet = sector.createFleet("shadow_industry", "securityDetachment");
        try {
            FleetManager.createFleet(fleet, "SHI_securityDetachment");
        } catch (NoClassDefFoundError ex) {
            SHIVariantSelector.randomizeFleet(fleet);
        }
        system.spawnFleet(location, 400, 300, fleet);

        fleet.addAssignment(FleetAssignment.DEFEND_LOCATION, location, 1000000);
        fleet.setPreferredResupplyLocation(location);
    }*/   
}
[close]

Alright, I might have gotten by the above on my own; problem unrelated to the system gen.  It seems to have been confined to the economy jsons.

Of course, now I have a new problem.

Edit: nevermind, I'm an idiot and failed to notice a typo.  Seems to be working now.
« Last Edit: October 21, 2014, 07:46:27 PM by MShadowy »
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1759 on: October 21, 2014, 09:04:21 PM »

Also, where are the definition for specific market conditions? I haven't been able to suss them out.

If you're still looking for them, the market conditions definitions are in /data/campaign/market_conditions.csv

The actual scripts are in com.fs.starfarer.api.impl.campaign.econ (haven't looked at them, but I feel like the .csv gives you a pretty easy idea of what each one does in the meantime)
Logged

MShadowy

  • Admiral
  • *****
  • Posts: 911
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1760 on: October 21, 2014, 09:43:09 PM »

Actually, I've already checked the API.  The market details are not actually there.  I even looked into the jar just to see if they were present in there, but they do not appear to be.  The data is obviously coming from somewhere but it seems to be a complete mystery as to where that actually is.

Also, you misunderstand, my interest in the market details isn't to get more precise info on the market info, but to make custom market conditions.
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1761 on: October 21, 2014, 11:49:52 PM »

Hmmm... interesting. I was going to try that too at some point, I'll let you know if I make any progress in that direction.

Anyone else been getting this crash?

Code
5165 [Thread-5] ERROR com.fs.starfarer.combat.D  - java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at sound.K.<init>(Unknown Source)
at sound.public.<init>(Unknown Source)
at sound.OooO.super(Unknown Source)
at sound.OooO.super(Unknown Source)
at com.fs.starfarer.loading.OO0O.?0000(Unknown Source)
at com.fs.starfarer.loading.OO0O.o00000(Unknown Source)
at com.fs.starfarer.loading.SpecStore.super(Unknown Source)
at com.fs.starfarer.loading.SpecStore.do(Unknown Source)
at com.fs.starfarer.loading.SpecStore.if(Unknown Source)
at com.fs.starfarer.loading.void.o00000(Unknown Source)
at com.fs.super.A.?0000(Unknown Source)
at com.fs.starfarer.combat.D.super(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1762 on: October 22, 2014, 12:52:04 AM »

@Kazi: That's a very generic error, it can happen, for instance if there are blank lines in your
sim_opponents.csv
title_screen_variants.csv

or http://fractalsoftworks.com/forum/index.php?topic=8219.0

Where you have a copy of the mission java definition file in your game data folder as well as your JAR compiled.
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1763 on: October 22, 2014, 01:05:12 AM »

@Kazi: That's a very generic error, it can happen, for instance if there are blank lines in your
sim_opponents.csv
title_screen_variants.csv

or http://fractalsoftworks.com/forum/index.php?topic=8219.0

Where you have a copy of the mission java definition file in your game data folder as well as your JAR compiled.
hmmmm.... from the error mine appears to have something to do with sound. Although I'm not sure what, as I've literally changed almost nothing in that file...

Is there any way to tell where the error is coming from?
Logged

silentstormpt

  • Admiral
  • *****
  • Posts: 1060
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1764 on: October 22, 2014, 01:11:38 AM »

Sound is a json file, so,

check if theres an object {} that right now is an array [] for some reason.

NOTE: Just do a quick read here if you dont understand what i mean.
« Last Edit: October 22, 2014, 01:13:34 AM by silentstormpt »
Logged

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1765 on: October 22, 2014, 01:27:04 AM »

oh and Kazi, I think sometimes a missing comma at the end of a jason element can also cause this error. As for where it comes from, usually I look at the log file and look at the last files the game was loading before the crash.
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1766 on: October 22, 2014, 02:38:50 AM »

Okay Joao solved the problem over Skype. Turns out the JSON interpeter has gotten much, much stricter.

I can get into combat now, and the campaign is throwing traceable errors again (that I can actually fix!). Thanks for all your help!
« Last Edit: October 23, 2014, 02:46:04 AM by kazi »
Logged

Midnight Kitsune

  • Admiral
  • *****
  • Posts: 2856
  • Your Friendly Forum Friend
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1767 on: October 22, 2014, 03:02:44 AM »

Anyone know how to replace a ship with a skin to the new game creation? Like having an option that gives you a degraded lasher instead of a normal one?
Mainly what I want to know is how to word it in the rules.csv so it picks the skin
Edit: Here is what the info looks like:
Spoiler
$career = "trader"
NGCAddShip "cerberus_Starting"
AddText "Added Cerberus-class frigate" textFriendColor
NGCAddCargo RESOURCES regular_crew 30
NGCAddCargo RESOURCES supplies 20
AddText "Added 30 crew" textFriendColor
AddText "Added 20 supplies" textFriendColor
NGCAddCargo RESOURCES fuel 20
AddText "Added 20 fuel" textFriendColor
FireBest NGCStep2
[close]
Edit 2: Never mind, I figured it out
« Last Edit: October 22, 2014, 05:58:01 AM by Midnight Kitsune »
Logged
Help out MesoTroniK, a modder in need

2021 is 2020 won
2022 is 2020 too

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 25822
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1768 on: October 22, 2014, 11:28:47 AM »

Just to spread the word, documentation on rule scripting:
http://fractalsoftworks.com/forum/index.php?topic=8355.0
Logged

kazi

  • Admiral
  • *****
  • Posts: 714
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #1769 on: October 22, 2014, 11:51:44 PM »

okay, here's another one:

Code
32125 [Thread-5] ERROR com.fs.starfarer.combat.D  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.api.campaign.events.CampaignEventTarget.<init>(CampaignEventTarget.java:16)
at com.fs.starfarer.api.impl.campaign.CoreLifecyclePluginImpl.onNewGameAfterTimePass(CoreLifecyclePluginImpl.java:37)
at com.fs.starfarer.campaign.save.CampaignGameManager.super(Unknown Source)
at com.fs.starfarer.title.B.dialogDismissed(Unknown Source)
at com.fs.starfarer.ui.do.dismiss(Unknown Source)
at com.fs.starfarer.ui.impl.O0oO.dismiss(Unknown Source)
at com.fs.starfarer.campaign.save.J.actionPerformed(Unknown Source)

It looks like I'm getting through the economy generation, then Starsector tries to start a bounty on Jangala and that fails somehow.

It should do this:
Code
109785 [Thread-5] INFO  com.fs.starfarer.api.impl.campaign.events.SystemBountyEvent  - Starting bounty at market [Jangala], 2500 credits per frigate

No idea whats throwing the error though, it's as if Jangala doesn't exist.

*EDIT:
Turns out economy.json does not merge with a "mod-specific" one. You'll need a new economy.json with all of the stuff included in it.

Like this one:
Code
{
"version":2.0,

"initialStepsToRun":500,
"maxExoticUtilityAtRange":14000,
"defaultConnectionMult":1,
"defaultConnectionFlat":1,
"defaultTariff":0.3,

"starSystems":[
"rasht.json",
"askonia.json",
"corvus.json",
"valhalla.json",
"arcadia.json",
"magec.json",
"eos.json"
],

"map":"../starmap.json"
}
« Last Edit: October 23, 2014, 03:07:47 AM by kazi »
Logged
Pages: 1 ... 116 117 [118] 119 120 ... 769