Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 417 418 [419] 420 421 ... 710

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

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6270 on: April 07, 2020, 01:20:59 AM »

... nothing, apparently - I think it's just something I forgot to clean up out of aztlan.json. This is from before deciding to specify the special items preinstalled on an industry via this sort of array: ["orbitalworks", "pristine_nanoforge"],

Ah ok that makes sense, thanks. Ill remove it from my override so I don't get confused later on down the line.
Logged

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6271 on: April 07, 2020, 06:54:40 AM »

how does Starsector handle numeric array merging? Like string array are concatenated (see protrait) and value are overwriten. But a faction color is an array of numeric value, if I write a modfile with a  new color for lets say the hegemony, what happens?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6272 on: April 07, 2020, 08:57:27 AM »

Good question :) It's handled with a horrible hack. JSON arrays whose key names contain "color", "button", or start with "music_", are treated as values and are overwritten instead of being concatenated.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6273 on: April 07, 2020, 11:17:43 AM »

So I think income is capped to a positive total, which is why it only sometimes ignored the negative income I was applying.
Now, I tried applying a flat mod to the upkeep as per your suggestion, and this happened:


While it is definitely doing something (it would be 5k upkeep otherwise) most of the effect is ignored.
I am applying the upkeep via getUpkeep().modifyFlat().

edit: the final thing I could do would be to apply a mult mod that brings upkeep up to the total I need, but I'd like to avoid that as it might confuse people a lot.
« Last Edit: April 07, 2020, 11:26:33 AM by SirHartley »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6274 on: April 07, 2020, 12:57:38 PM »

Hmm - what's the issue? Everything I'm seeing looks like it could be right but I don't know what you're expecting to see.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6275 on: April 07, 2020, 01:09:09 PM »

Restoration docks have no exports, so the upkeep amount should be the full ~40.000 - but for some reason, it instead displays (and calculates) 6.000, which is not what I was expecting or what I need it to do.

It looks like I might be misunderstanding something here.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6276 on: April 07, 2020, 01:31:29 PM »

Possible that you didn't let it run a full month? Upkeep in the report is based on how long the upkeep has been that high, e.g. if you built the structure half a month ago, it'd show half the monthly upkeep there. If the upkeep is variable, then what you see in the report is pretty much just not going to match the tooltip, since the tooltip shows the current snapshot, while the report has the actual accumulated expenses (sampled 10 times per month).
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 #6277 on: April 07, 2020, 02:54:17 PM »

I *think* it needs to not be available "nearby" but I'm not 100% sure. You'd probably need to dig through ProcurementMissionIntel to figure it out for sure.

Ok I took a look at this in the API. I think you are correct in that:

Code
		for (MarketAPI curr : Misc.getMarketsInLocation(from.getContainingLocation())) {
//if (curr == from) continue;
if (curr.getPrimaryEntity() != null && from.getPrimaryEntity() != null) {
float dist = Misc.getDistance(curr.getPrimaryEntity().getLocation(), from.getPrimaryEntity().getLocation());
if (dist > 10000) continue;
}

- from doNearbyMarketsHave() checks for the selected commodity of the mission to be available in a sufficient quantity at all nearby markets relative to the candidate market once a commodity itself has been chosen. All those that have enough within that distance won't be chosen so the more efficient the campaigns systems are the less likely these types of missions will be available without some kind of dynamic interference. (It also won't choose hidden or player owned markets in general).

So deficits don't seem to matter - But!- if you have created your colonies to have the resources they need nearby regardless of faction (within 10000 in system) then likely no procurement missions will spawn there for that commodity.

Please correct any inaccuracies as this is a first pass. Just my take so far.  :)

What does this mean when it checks settings?

Code
		Global.getSettings().profilerBegin(this.getClass().getSimpleName() + ".pickCommodity()");

Or

Code
		Global.getSettings().profilerBegin(this.getClass().getSimpleName() + ".pickMarket()");

(And a side note)

Code
		WeightedRandomPicker<Float> durationPicker = new WeightedRandomPicker<Float>();
durationPicker.add(20f);
durationPicker.add(30f);
durationPicker.add(40f);
durationPicker.add(60f);

The lowest duration here is a little too low, imo. (I didn't thoroughly check whether this gets modified later like, say, the commodity size requested which later gets modified by market size, etc.) I've found that sometimes it's all but impossible to complete the mission in that short an amount of time if the RNG is right. It makes these less appealing than the bar missions- both because the reward is less and the difficulty can be higher due to the variance. Just some pondering.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6278 on: April 07, 2020, 08:27:57 PM »

Just real quick - this:
Global.getSettings().profilerBegin(this.getClass().getSimpleName() + ".pickCommodity()");

Takes some performance metrics and prints them to the log if running in dev mode when the game exits. Possibly this also requires holding down some key? I forget. Basically it's performance debugging related code and can safely be ignored, except that every profilerBegin() must be matched with a profilerEnd(), so if you happen to be copy-pasting core code to use elsewhere, just removing all these is your best bet.
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 #6279 on: April 07, 2020, 11:57:25 PM »

Just real quick - this:
Global.getSettings().profilerBegin(this.getClass().getSimpleName() + ".pickCommodity()");

Takes some performance metrics and prints them to the log if running in dev mode when the game exits. Possibly this also requires holding down some key? I forget. Basically it's performance debugging related code and can safely be ignored, except that every profilerBegin() must be matched with a profilerEnd(), so if you happen to be copy-pasting core code to use elsewhere, just removing all these is your best bet.
Thanks! This is really helpful! I can now rule this out as an obfuscated calculation. The recent economy update has been really great, btw. It is much easier to create diverse economics without getting hamstrung by food shortages, etc.
« Last Edit: April 08, 2020, 12:17:40 AM by Morrokain »
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6280 on: April 08, 2020, 02:29:39 AM »

Possible that you didn't let it run a full month? Upkeep in the report is based on how long the upkeep has been that high, e.g. if you built the structure half a month ago, it'd show half the monthly upkeep there. If the upkeep is variable, then what you see in the report is pretty much just not going to match the tooltip, since the tooltip shows the current snapshot, while the report has the actual accumulated expenses (sampled 10 times per month).

That was what I was missing - expenses on month end are fractioned by economy tick.
Adding the flat amounts to the current economy report works like a charm, thank you!
Logged

King Alfonzo

  • Admiral
  • *****
  • Posts: 683
  • -- D O C T O R --
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6281 on: April 08, 2020, 04:32:24 AM »

I'm afraid I've hit something too ambitious for my abilities.

What I'm trying to do is make a right click system that can be overwritten by a hullmod that adds a shield. I've tried to make a dummy 'makeshift shield' hullmod that can be installed on the ship, and the hullmod has:

Code
	public void applyEffectsAfterShipCreation(ShipAPI ship, String id) {
ship.setShield(ShieldType.FRONT, 0.6f, 1.4f, SHIELD_ARC);
}

This however doesn't work. I'm looking at the code, and I'm wondering: is it actually possible to swap out a phase cloak / right-click system for a shield via hullmod? And if there is, may I ask how?

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6282 on: April 11, 2020, 04:52:43 PM »

Hello Alex, I am putting in a hullmod that should not be installed on any ship's modules so I used this method. It seems that modded ships like the Cathedral (from SWP) aren't affected by this and I'm able to attach it on the Cathedral's modules. Are there any plans to make a vanilla ship with modules, so a way to block hullmods on modules can be implemented?
Code
package data.scripts.hullmods;

import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.BaseHullMod;
import org.apache.log4j.Logger;

public class CHM_commissioned2 extends BaseHullMod {
    private static Logger LOG = Global.getLogger(CHM_commissioned2.class);

    @Override
    public boolean isApplicableToShip(ShipAPI ship) {
        if (ship.getParentStation() != null) {
            LOG.info("What is my AHHHHHHHHHHHHHHHHHHHHHHHHHHHH:" + ship.getParentStation().getId());
        }
        return (ship.getParentStation() == null);
    }
    /*@Override
    public boolean isApplicableToShip(ShipAPI ship) {
        return !(ship.getParentStation() != null);
    }*/
    @Override
    public String getUnapplicableReason(ShipAPI ship) {
        return "Trying to install this on a module? First of all...";
    }
}

ctuncks

  • Commander
  • ***
  • Posts: 127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6283 on: April 12, 2020, 05:08:03 AM »

Two quick questions

1: Is it possible to make a Hullmod that add extra logistic slots to the ship it's installed in?

2: Is it possible to make a Hullmod cost credits to install, possibly unrecoverable (Ie you pay to put it in, but don't get it back if you uninstall it)
Logged

Sordid

  • Captain
  • ****
  • Posts: 313
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6284 on: April 12, 2020, 06:31:49 AM »

How do you make the game start battles with the view zoomed out all the way? I see no reason to ever zoom in, and having to zoom out at the start of every single battle is getting a bit tiresome.
Logged
Pages: 1 ... 417 418 [419] 420 421 ... 710