Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21); Blog post: Skill Changes, Part 2 (07/15/21)

Pages: 1 ... 325 326 [327] 328 329 ... 531

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

xenoargh

  • Admiral
  • *****
  • Posts: 4927
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4890 on: August 26, 2019, 10:40:33 AM »

Not SYSTEM / DECORATIVE.

Zero OP may be the problem.  Ah well, making them 1 won't really break what they do...
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 4927
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4891 on: August 26, 2019, 10:59:01 AM »

Confirmed:  0-OP weapons will not spawn in Markets.  Fixed, thank you, that was driving me nuts.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4892 on: August 26, 2019, 12:09:43 PM »

Modifiers go here:
ship.getMutableStats().getDynamic().getMod(Stats.INDIVIDUAL_SHIP_RECOVERY_MOD)

(See ReinforcedBulkheads, for example)

And the base chance is in settings.json, "baseShipRecoveryChance" and "baseOwnShipRecoveryChance"

The number is a probability, i.e. >=1 is 100% chanc to recover.

I actually did change the numbers in settings and reinforced bulkheads. Set them pretty low to see if it works (1%) chance and the random derelicts are still available for recovery pretty often. That's why I was wondering whether the baseShipRecoveryChance applies to them too or only to post-battle salvage. I think I remember finding a post a while ago about recovery being related to the ship being broken apart, although I don't know if this applies to battles only.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 19092
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4893 on: August 26, 2019, 12:14:48 PM »

Ah, right, what I said is post-battles only. The other stuff is actually not so easily moddable - each salvageable entity gets a "special" which is picked from a set of possibilities depending on the entity type. The specials range from "nothing" to "this ship is recoverable" (which is a possibility for ships, and for places where ships might be found in hangars etc, such as stations or ruins). The ratios of available specials in these cases are hardcoded in mod-accessible code, but actually replacing them would be a significant effort.

See:

com.fs.starfarer.api.impl.campaign.procgen.themes.SalvageSpecialAssigner

Looking at assignSpecialForBattleWreck(), for example (which is called for wrecks that spawn from fleets fighting each other), it looks like a 50/50 chance for recoverable or not.
Logged

Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4894 on: August 26, 2019, 12:35:35 PM »

Alright , thanks. Maybe I will try to get down to it some time.

And one more thing while i'm at it. If i wanted to modify the battle creator plugin, would it be enough to just extend the base BattleCreatorPluginImpl or would i have to do it the way nexerelin does, by creating it's own plugin and seting it up via PluginPick<BattleCreationPlugin>? Did the former and I'm not really seing any changes, so that's why I'm wondering.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 19092
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4895 on: August 26, 2019, 12:41:07 PM »

Right yes you need to do what Nex does here - otherwise your new plugin isn't being used by anything. Just extending a class doesn't really do anything aside from providing its functionality in your class; something has to create an object of your new class and use it. (In this case, the pickXXXPlugin method.)
Logged

Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4896 on: August 26, 2019, 12:49:03 PM »

Well, I was expecting as much. I was hoping for an easy way because I just want to increase the stand-off distance. Anyway, thank you very much.
Logged

TrashMan

  • Admiral
  • *****
  • Posts: 1314
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4897 on: August 26, 2019, 12:57:36 PM »

Getting this error if trying to start game without exerelin
Code
---------------------------
Starsector 0.9.1a-RC8
---------------------------
Fatal: Error compiling [data.scripts.SteelcladModPlugin]
Cause: File 'data/scripts/SteelcladModPlugin.java', Line 44, Column 44: Imported class "exerelin.campaign.SectorManager" could not be loaded
Check starsector.log for more info.

The odd bit is that I haven't changed my SteelcladModPlugin lately, and it worked without nex before
Every other mod I checked also has the same lines and basically the same code - all import exerelin.campaign.SectorManager;

Here is my file

Code
package data.scripts;

import com.fs.starfarer.api.BaseModPlugin;
import com.fs.starfarer.api.impl.campaign.shared.SharedData;
import com.fs.starfarer.api.Global;
import com.fs.starfarer.api.PluginPick;
import com.fs.starfarer.api.campaign.CampaignPlugin;
import exerelin.campaign.SectorManager;
import com.fs.starfarer.api.campaign.SectorAPI;
import com.fs.starfarer.api.campaign.CampaignPlugin;

import com.fs.starfarer.api.impl.campaign.ids.Ranks;
import com.fs.starfarer.api.impl.campaign.ids.Skills;
import com.fs.starfarer.api.campaign.econ.MarketAPI;
import com.fs.starfarer.api.characters.FullName.Gender;
import com.fs.starfarer.api.characters.PersonAPI;

import data.scripts.world.SteelcladGen;


public class SteelcladModPlugin extends BaseModPlugin {


    @Override
public void onApplicationLoad() throws ClassNotFoundException { 
           
        try {
            Global.getSettings().getScriptClassLoader().loadClass("org.lazywizard.lazylib.ModUtils");
        } catch (ClassNotFoundException ex) {
            String message = System.lineSeparator()
                    + System.lineSeparator() + "LazyLib is required to run at least one of the mods you have installed."
                    + System.lineSeparator() + System.lineSeparator()
                    + "You can download LazyLib at http://fractalsoftworks.com/forum/index.php?topic=5444"
                    + System.lineSeparator();
            throw new ClassNotFoundException(message);
        }         
    }

    @Override
    public void onNewGame() {
        initSC();
    }

    private static void initSC() {
        boolean haveNexerelin = Global.getSettings().getModManager().isModEnabled("nexerelin");
        if (!haveNexerelin || SectorManager.getCorvusMode()){
            new SteelcladGen().generate(Global.getSector());
            // Exerelin not found so continue and run normal generation code
        }
    }

    private void updateConditionSpecs() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }


   @Override
    public void onNewGameAfterEconomyLoad() {
        MarketAPI market = Global.getSector().getEconomy().getMarket("avalon");
        if (market != null) {
            PersonAPI admin = Global.getFactory().createPerson();
            admin.setFaction("VNS");
            admin.setGender(Gender.MALE);
            admin.setPostId(Ranks.POST_FACTION_LEADER);
            admin.setRankId(Ranks.FACTION_LEADER);
            admin.getName().setFirst("Gabriel");
            admin.getName().setLast("Algar");
            admin.setPortraitSprite("graphics/portraits/prt_vns_algar.png");

            admin.getStats().setSkillLevel(Skills.FLEET_LOGISTICS, 3);
            admin.getStats().setSkillLevel(Skills.PLANETARY_OPERATIONS, 3);
            admin.getStats().setSkillLevel(Skills.INDUSTRIAL_PLANNING, 3);

            market.setAdmin(admin);
            market.getCommDirectory().addPerson(admin, 0);
            market.addPerson(admin);
        }
    }

}


About the only difference I can see is that my code is not in a .jar
Logged

Salv

  • Lieutenant
  • **
  • Posts: 56
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4898 on: August 27, 2019, 09:26:45 AM »

How difficult would it be to modify deposit conditions modifiers. Considering I found them in the ResourceDepositCondition class, I suppose doing it in individual industry plugins is a no go?
Logged

Vayra

  • Admiral
  • *****
  • Posts: 627
  • jangala delenda est
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4899 on: August 27, 2019, 10:21:34 AM »

About the only difference I can see is that my code is not in a .jar

That's the issue - since your code is compiled at runtime, the exerelin script you import needs to "exist" at runtime. Which it doesn't. If you pre-compile your code with it as a library, then that's not an issue.
Logged
Kadur Remnant: http://fractalsoftworks.com/forum/index.php?topic=6649
Vayra's Sector: http://fractalsoftworks.com/forum/index.php?topic=16058
Vayra's Ship Pack: http://fractalsoftworks.com/forum/index.php?topic=16059

im gonna push jangala into the sun i swear to god im gonna do it

TrashMan

  • Admiral
  • *****
  • Posts: 1314
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4900 on: August 27, 2019, 11:19:44 AM »

So basically, by copying that SectorManager.java into my mod folder, it should work without Nex?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 19092
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4901 on: August 27, 2019, 03:55:41 PM »

How difficult would it be to modify deposit conditions modifiers. Considering I found them in the ResourceDepositCondition class, I suppose doing it in individual industry plugins is a no go?

You could do it there, or you could provide a different plugin for the conditions. It's hard to answer the question because there's a ton of different ways you could go about this and it all depends on what exactly you want to accomplish. It's all going to require code, though.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1306
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4902 on: August 27, 2019, 04:49:17 PM »

I've been trying to pinpoint the cause of this crash for a few days, since a few people (including me) initially thought it might be caused by starship legends. It seems to be caused by some error or omission in ship_data.csv. The stack trace makes me suspect that the crash occurs when ships with erroneous ship_data.csv entries are present at a market when the player interacts with it. So my question is; what missing or invalid entry could cause an NPE on line 48 of CRPluginImpl?
Code
	public void applyMaxCRCrewModifiers(FleetMemberAPI member) {
float maxCRBasedOnLevel = 0.7f;
------>         member.getStats().getMaxCombatReadiness().modifyFlat("crew skill bonus", maxCRBasedOnLevel, "Basic maintenance");

So basically, by copying that SectorManager.java into my mod folder, it should work without Nex?
SectorManager itself has other Nexerelin dependencies, so if you go that route you'll basically end up needing to bundle the entirety of Nex with your mod. If you can't reliably import SectorManager from a script, it sounds like the only option is to compile a jar.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 19092
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4903 on: August 27, 2019, 05:06:12 PM »

I've been trying to pinpoint the cause of this crash for a few days, since a few people (including me) initially thought it might be caused by starship legends. It seems to be caused by some error or omission in ship_data.csv. The stack trace makes me suspect that the crash occurs when ships with erroneous ship_data.csv entries are present at a market when the player interacts with it. So my question is; what missing or invalid entry could cause an NPE on line 48 of CRPluginImpl?
Code
	public void applyMaxCRCrewModifiers(FleetMemberAPI member) {
float maxCRBasedOnLevel = 0.7f;
------>         member.getStats().getMaxCombatReadiness().modifyFlat("crew skill bonus", maxCRBasedOnLevel, "Basic maintenance");

After looking at the code a fair bit: the only way I could see this happening is if something called member.setVariant(null, X, X); on one of the getCargo().getMothballedShips() of the submarket. That would cause the stats to be null and ... well, hmm. Testing that out produces a different crash, ugh. So I actually don't know, it's a weird one - doesn't make sense how it would happen. All the ways I can think of seem to crash earlier in other ways.

If there's a save where this is readily reproducible and you could upload the mod folder, I'd be happy to take a look.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 3340
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4904 on: August 27, 2019, 05:08:44 PM »

Quote
So basically, by copying that SectorManager.java into my mod folder, it should work without Nex?
SectorManager itself has other Nexerelin dependencies, so if you go that route you'll basically end up needing to bundle the entirety of Nex with your mod. If you can't reliably import SectorManager from a script, it sounds like the only option is to compile a jar.
Could also use some other way to detect non-random sector mode; e.g. checking if Jangala or the Corvus system exist.

Next version of Nex might just set a flag in Sector memory.
Logged
Pages: 1 ... 325 326 [327] 328 329 ... 531