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: Codex Overhaul (05/11/24)

Pages: 1 ... 163 164 [165] 166 167 ... 717

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

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2460 on: November 22, 2015, 10:33:13 AM »

Never modded starsector before.

Also, I hate Java (but I use it on my day work sometimes).

Still, what files I need to edit to change the market and economy? I am REALLY bothered the trading ins't more fun and want to meddle with it.

It is the only reason why I don't play this game more (the combat is awesome, in fact for now the strongest selling point, but for combat there is also lots of other interesting games, right now Mechwarrior Online that is grabbing my attention with slow action + editing your vehicle, thus trading, that I really love, would be the "dealbreaker").
Logged

Nimaniel

  • Ensign
  • *
  • Posts: 40
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2461 on: November 22, 2015, 01:11:08 PM »

Does the vanilla game generate the faction-relation restricted ships available for purchase based on the faction files in \starsector-core\data\world\factions ? (These files seem to be mainly for the faction fleet composition, but I haven't found what I'm looking for anywhere else.)

(I know this is not strictly speaking a mod-question, but if anyone knows the answer, it's you guys :)

I wanted to compile a short overview of ships that are faction "unique" (ignoring the fact that some of these can also appear on "independent" and "black" markets).

For example:

TT:
Medusa
Shade
Omen
etc.

But what I really want to figure out is how a set of available ships are generated at a given faction station.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24326
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2462 on: November 22, 2015, 01:26:00 PM »

Yeah, that's how they're generated; same process as picking a ship for a faction fleet. Weapons are generated the same way - it picks ships then strips them.
Logged

speeder

  • Captain
  • ****
  • Posts: 364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2463 on: November 22, 2015, 02:23:07 PM »

How I mod the economy and markets? What files I should look into?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24326
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2464 on: November 22, 2015, 03:45:33 PM »

Take a look here for a start:
http://fractalsoftworks.com/forum/index.php?topic=9689.0

Then there's data/campaign/econ/economy.json and the files referenced from it.

It's involved and not really suited for this thread as a general discussion of "how to mod the economy". Specific questions re: modding a specific thing would be a good fit, though.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4734
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2465 on: November 25, 2015, 05:34:25 AM »

How do I make a fleet not chase enemies around? MemFlags.MEMORY_KEY_TRADE_FLEET didn't seem to be sufficient.

(It was quite funny to see two mining fleets running down a pirate fleet, but also quite disconcerting)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24326
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2466 on: November 25, 2015, 12:10:13 PM »

How do I make a fleet not chase enemies around? MemFlags.MEMORY_KEY_TRADE_FLEET didn't seem to be sufficient.

(It was quite funny to see two mining fleets running down a pirate fleet, but also quite disconcerting)

It should do the job, mostly. But if the pirates attack them/cross their path, then they may give chase.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3033
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2467 on: November 25, 2015, 12:23:09 PM »

How do I make a fleet not chase enemies around? MemFlags.MEMORY_KEY_TRADE_FLEET didn't seem to be sufficient.

(It was quite funny to see two mining fleets running down a pirate fleet, but also quite disconcerting)

It should do the job, mostly. But if the pirates attack them/cross their path, then they may give chase.

I saw a TT Relief fleet attack a Hegemony Mercantile fleet in vanilla, which was also a bit disconcerting.
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2468 on: November 25, 2015, 12:35:59 PM »

Is it possible to direct the production from a Market Condition into a specific sub-market?

I have some "Intelligence Data Chips" in demand throughout the sector but I want to make them available only in a couple of sub-markets that require a high standing with the corresponding factions. Problem is, market conditions only dump them in all the sub-markets but the one I created for this. And when I tried to generate them by hand, they don't participate in the economy. I tried to remove them from all the other sub-markets in the "updateCargoPrePlayerInteraction()" but that made the whole market unavailable for some reason. I tried to do the same in the market condition but it didn't do anything.
Logged
 

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24326
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2469 on: November 25, 2015, 12:48:09 PM »

I tried to remove them from all the other sub-markets in the "updateCargoPrePlayerInteraction()" but that made the whole market unavailable for some reason.

That's the right way to go, yeah - that method decides what to take from the economy and put into the actual player-accessible submarket cargo. Don't know why it'd make the submarket unavailable, but I'd imagine some sort of bug in your code :)

Well, and I wouldn't *remove* them from other submarkets in that method - rather, it should only add them in it for the markets you want.

I should probably add a "do not auto-put this into tradeable cargo" tag to commodities to make this sort of thing easier...
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2470 on: November 25, 2015, 01:17:50 PM »

Well at first I did this:

Code: Java
    @Override
    public void updateCargoPrePlayerInteraction() {

        if (!okToUpdateCargo()) return;        
        CargoAPI cargo = getCargo();        
        cargo.addCommodity("SCY_intelChip", sinceLastCargoUpdate*Global.getSector().getAllFactions().size()*MAX_INTEL_PER_FACTION*(market.getStabilityValue()/20));
        sinceLastCargoUpdate = 0f;
   }

But while it generated the items in the submarket, they did not appear in the market info and neither seemed to participate in the economy.

That's why I created the Condition for this :

Code: java
    @Override
    public void apply(String id) {   
            market.getDemand(Commodities.REGULAR_CREW).getDemand().modifyFlat(id, SCY_spyGuild_crew);
            market.getDemand(Commodities.REGULAR_CREW).getNonConsumingDemand().modifyFlat(id, SCY_spyGuild_crew * ConditionData.CREW_MARINES_NON_CONSUMING_FRACTION);
            float crewDemandMet = market.getDemand(Commodities.REGULAR_CREW).getClampedAverageFractionMet();

            market.getDemand(Commodities.HAND_WEAPONS).getDemand().modifyFlat(id, SCY_spyGuild_weapons * crewDemandMet);
            market.getDemand(Commodities.SUPPLIES).getDemand().modifyFlat(id, SCY_spyGuild_suplies * crewDemandMet);

            float stability = market.getStabilityValue()/10;
            float factions = Global.getSector().getAllFactions().size()/6;
            market.getCommodityData("SCY_intelChip").getSupply().modifyFlat(id,
                            SCY_spyGuild_intel
                            * crewDemandMet
                            * stability
                            * factions
            );  
   }

With the sub market update looking like this to avoid spilling the chips everywhere:

Code: java
    @Override
    public void updateCargoPrePlayerInteraction() {
        if (!okToUpdateCargo()) return;
        
        CargoAPI cargo = getCargo();    
        
        float chips=0;
        for (SubmarketAPI sm : market.getSubmarketsCopy()){
            if (sm != submarket){
                List<CargoStackAPI> stacks = sm.getCargo().getStacksCopy();
                for (CargoStackAPI s : stacks){
                    if (s.getCommodityId().equals("SCY_intelChip")){
                        chips += s.getSize();
                        sm.getCargo().removeItems(s.getType(), s.getData(), s.getSize());
                        break;
                    }                    
                }                
                sm.getCargo().removeEmptyStacks();
            }
        }
        
        cargo.addCommodity("SCY_intelChip", chips);        
        
        cargo.sort();
        cargo.removeEmptyStacks();  
        
        sinceLastCargoUpdate = 0f;
   }

But this gives me an empty screen when I try to get to the market (nothing on the screen but the interaction image and the menus to the bottom)
« Last Edit: November 25, 2015, 01:20:11 PM by Tartiflette »
Logged
 

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24326
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2471 on: November 25, 2015, 01:49:52 PM »

But this gives me an empty screen when I try to get to the market (nothing on the screen but the interaction image and the menus to the bottom)

Real quick: this means there's an exception, probably during running one of the rule commands, and a stack trace should be in the log.
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2472 on: November 25, 2015, 02:26:00 PM »

mmmh, it hang at
Code: java
                    if (s.getCommodityId().equals("SCY_intelChip")){      
 

in
Code: java
float chips=0;
        for (SubmarketAPI sm : market.getSubmarketsCopy()){
            if (sm != submarket){
                List<CargoStackAPI> stacks = sm.getCargo().getStacksCopy();
                if (!stacks.isEmpty()){
                    for (CargoStackAPI s : stacks){
                        if (s.getCommodityId().equals("SCY_intelChip")){
                            chips += s.getSize();
                            sm.getCargo().removeItems(s.getType(), s.getData(), s.getSize());
                            break;
                        }                    
                    }      
                }
                sm.getCargo().removeEmptyStacks();
            }
        }

Spoiler
Code
java.lang.NullPointerException
at data.scripts.campaign.submarkets.SCY_intelligenceMarket.updateCargoPrePlayerInteraction(SCY_intelligenceMarket.java:57)
at com.fs.starfarer.campaign.ui.T.<init>(Unknown Source)
at com.fs.starfarer.coreui.f.<init>(Unknown Source)
at com.fs.starfarer.coreui.f.<init>(Unknown Source)
at com.fs.starfarer.ui.newui.J$5.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.newui.J.setCurrentTab(Unknown Source)
at com.fs.starfarer.ui.newui.J.setCurrentTab(Unknown Source)
at com.fs.starfarer.ui.newui.T.showCoreInternal(Unknown Source)
at com.fs.starfarer.ui.newui.T.showCore(Unknown Source)
at com.fs.starfarer.api.impl.campaign.rulecmd.OpenCoreTab.execute(OpenCoreTab.java:39)
at com.fs.starfarer.campaign.rules.super.execute(Unknown Source)
at com.fs.starfarer.campaign.rules.ooOO.runScript(Unknown Source)
at com.fs.starfarer.api.impl.campaign.rulecmd.FireBest.applyRule(FireBest.java:97)
at com.fs.starfarer.api.impl.campaign.rulecmd.FireBest.execute(FireBest.java:47)
at com.fs.starfarer.api.impl.campaign.rulecmd.FireBest.fire(FireBest.java:53)
at com.fs.starfarer.api.impl.campaign.RuleBasedInteractionDialogPluginImpl.fireBest(RuleBasedInteractionDialogPluginImpl.java:176)
at com.fs.starfarer.api.impl.campaign.RuleBasedInteractionDialogPluginImpl.optionSelected(RuleBasedInteractionDialogPluginImpl.java:208)
at com.fs.starfarer.ui.newui.T$1.o00000(Unknown Source)
at com.fs.starfarer.ui.newui.super.actionPerformed(Unknown Source)
at com.fs.starfarer.ui.h.o00000(Unknown Source)
at com.fs.starfarer.ui.null.processInput(Unknown Source)
at com.fs.starfarer.ui.U.o00000(Unknown Source)
at com.fs.starfarer.BaseGameState.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$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
[close]

[EDIT] LazyWizzard solved this for me, I had to check is s was a commodity stack.
« Last Edit: November 25, 2015, 03:04:27 PM by Tartiflette »
Logged
 

gruberscomplete

  • Captain
  • ****
  • Posts: 253
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2473 on: November 26, 2015, 07:39:28 PM »

So I really can't figure out where I went wrong. Can anyone help?

ship hull spec not found
« Last Edit: November 28, 2015, 11:49:56 AM by gruberscomplete »
Logged
Click here for FREE ships!               Plentysector               Robots With Souls

gruberscomplete

  • Captain
  • ****
  • Posts: 253
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #2474 on: November 28, 2015, 11:49:40 AM »

can anyone help me please?
Logged
Click here for FREE ships!               Plentysector               Robots With Souls
Pages: 1 ... 163 164 [165] 166 167 ... 717