Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 325 326 [327] 328 329 ... 459

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17065
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4890 on: August 26, 2019, 09:59:51 AM »

OK, here's a weird issue.  What would stop a given Weapon from being stocked / created at a Market?

I have a "weapon" that costs 0 OPs and does some Special Stuff. 

When I force it into a Market's inventory via a restocking-script, all is well.  When I don't, it doesn't generate, even though it's Known to the Faction involved and some Variants require it to be built.  It isn't being stocked and those Variants never show up in the game.

Hmm - looking at the code, that might happen if the tier is set too high for what the submarket allows.


What's the best way to record FleetMemberAPI in Persistent Data?
And how to check "FleetMemberAPI" is no longer exists and remove it from the hashmap?

You basically can't - a FleetMemberAPI could be in a fleet, in storage somewhere, or referenced from some other script, either from core or from another mod. So it's impossible to tell if it has "ceased to exist" or not. The best you could do is check the player's fleet and colony storage.

Where could i find the recovery chance for derelicts? Do the cases in pickDerelictCondition from DerelictShipEntityPlugin affect that chance or is it only for loadout, dmods, etc.?

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 made a whole pack of custom images/flags for the player faction (in graphics/factions/custom). How do I make them show up in-game? I don't see the vanilla images referenced in the setting.json

They go into the player.faction file.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 4863
  • 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:22:38 AM »

@Alex:  the Tier is set to 0.  This is supposed to be a "pretty common item" for the Factions that have it in their KnownWeapons.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17065
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4892 on: August 26, 2019, 10:24:19 AM »

Hmm - try setting the OP to not 0, maybe? I'm not seeing anything that would cause that to not add the weapon but I seem to remember "0 op" being special in some way. Also make sure it's not SYSTEM etc.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 4863
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4893 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: 4863
  • naively breaking things!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4894 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 #4895 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: 17065
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4896 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 #4897 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: 17065
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4898 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 #4899 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 #4900 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 #4901 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: 581
  • jangala delenda est
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4902 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 #4903 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: 17065
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4904 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
Pages: 1 ... 325 326 [327] 328 329 ... 459