Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 546 547 [548] 549 550 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8205 on: December 04, 2021, 01:27:24 PM »

So let's say I add a hullmod to the Diktat, and it changes ship builds enough I want them to use different variants for it.
1) Is there a way to prohibit the hullmod from being auto-fit on NPC ships?
2) Is there a way to make variants faction-exclusive? Or at least, only available to those who know the hullmod?

An example from luddic_church.faction:

"combatLarge":{
   "includeDefault":true,
   "dominator_Fighter_Support":50,
},

So you'd basically want to do this sort of thing for your custom variants you want the faction to use. Another part of the solution could be variantOverrides; here's an example from luddic_path.faction:

# variantOverrides restricts hulls to listed variants and adjusts their probability
"variantOverrides":{
   "enforcer_Overdriven":30,
   "hammerhead_Overdriven":30,
   "sunder_Overdriven":30,
},
Logged

IonDragonX

  • Admiral
  • *****
  • Posts: 816
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8207 on: December 04, 2021, 09:14:14 PM »

I've been trying to make a .SKIN file that moves a turret to a new location but haven't been successful. Is it impossible to move or am I doing it wrong?
Spoiler
"weaponSlotChanges":{
   "WS0018":{
      #"id": "WS0018",
      #"size": "SMALL",
      #"type": "BALLISTIC",
      #"mount": "TURRET",
      #"arc": 180,
      #"angle": 135,
      "location": [-65.5, 53],
   },
},
[close]
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8208 on: December 04, 2021, 09:20:07 PM »

Taking a quick look, slot location changes are not supported. If you're also making the original .ship, you could have multiple slots in it and have skins remove the ones they don't want, instead.

But if you're modifying an existing ship, I don't think there's a way to do this via the skin file. You could however do ShipHullSpecAPI.getWeaponSlotAPI(id).getLocation().set(x, y) - that should do the trick. Probably somewhere in ModPlugin.onApplicationLoad().
Logged

IonDragonX

  • Admiral
  • *****
  • Posts: 816
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8209 on: December 04, 2021, 10:57:27 PM »

Taking a quick look, slot location changes are not supported. If you're also making the original .ship, you could have multiple slots in it and have skins remove the ones they don't want, instead.
Thank you. This trick does work around the issue. I created an extra mount at the destination coordinate on the original .SHIP file but initialized it as decorative. (even in refit, the original can't see a thing) Then I changed that type in the .SKIN file to make it a useable weapon mount again. (and cut the mount I wanted) Now its just a matter of keeping the .VARIANT files from ever referencing a removed or decorative weapon mount.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8210 on: December 05, 2021, 10:22:06 AM »

Ah, nice! Using the deco mount is a good way to avoid having two skins (and never using the original). And yeah, making sure the slot ids are correct everywhere is going to be important :)
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8211 on: December 06, 2021, 11:05:02 AM »

How to load the custom font?
I found that there is an api called "setParaFont" in TooltipAPI, how to use the parameter if I want to use my own font(Haven't try it yet)
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8212 on: December 06, 2021, 11:09:11 AM »

IIRC loading an entirely custom font is not supported, aside from the one case of "defaultFont" in settings.json - but that overrides the standard font.
Logged

Obsidian Actual

  • Commander
  • ***
  • Posts: 105
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8213 on: December 06, 2021, 07:41:34 PM »

Greetings again,

Been doing some API reading a bit, and I can see (from several hullmods and SurveyPluginImpl.class) that it is possible to modify the Commodities requirements for surveying via getSurveyCostReductionId():

Code
stats.getDynamic().getMod(Stats.getSurveyCostReductionId(Commodities.CREW)).modifyFlat(id,REDUCTION_GOES_HERE);

(Odd how only SUPPLIES and HEAVY_MACHINERY have a hard minimum of five units...)


Can't seem to find a counterpart for Salvaging though. I'd imagine there is a similar way to modify Commodities requirements for either or both the post-combat salvage dialog and derelict/debris/exploration salvage dialog?

NO SIR I AM DEFINITELY NOT AN AI JUST A SOLO STARFARER CONTEMPLATING ESCHEWING FLESHY CREW FOR AN ARMY OF ROBOTIC DRONES TO AVOID PAYING WAGES AS WELL AS REDUCING LIFE SUPPORT REQUIREMENTS
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8214 on: December 06, 2021, 08:13:47 PM »

There is not a dynamic way to modify those via stats, actually - sorry!
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 #8215 on: December 08, 2021, 12:04:13 AM »

I'm trying to create random bounty fleets without a market, but for some reason I cannot manage to set their quality in any way. The ships are always pristine regardless of the values for quality, qualityMod, qualityOverride, averageSMods. I tried to force the values to 0, force the fleet to inflate, to deflate, etc to no avail.

Code: java
    private static CampaignFleetAPI generateRandomFleet(String factionId, float qualityOverride, String fleetType, float fleetPoints, float freightersAndTankersFraction ) {
       
        FleetParamsV3 params = new FleetParamsV3(
                null, //Fake market are actually not needed, one will be created by the FleetFactory
                new Vector2f(),
                factionId,
                qualityOverride, //this is supposed to everride the default fleet quality without market of 0.5
                fleetType,
                fleetPoints*(1-freightersAndTankersFraction),
                fleetPoints*(freightersAndTankersFraction/3),
                fleetPoints*(freightersAndTankersFraction/3),
                fleetPoints*(freightersAndTankersFraction/3),
                0f, 0f,
                0 //DO NOT SET A QUALITY MOD, it is added to the market quality
        );
       
        params.ignoreMarketFleetSizeMult = true;
        params.maxNumShips = 50;
        params.modeOverride = FactionAPI.ShipPickMode.PRIORITY_THEN_ALL;
       
        //add S mods?
        if(qualityOverride>1){
            params.averageSMods = Math.round(qualityOverride-1);
        } else {
            params.averageSMods=0;
        }
//        params.quality=0;
//        params.qualityMod=0;
//        params.qualityOverride=null;
       
        CampaignFleetAPI tempFleet = FleetFactoryV3.createFleet(params);
        if (tempFleet==null || tempFleet.isEmpty()) {
            log.warn("Failed to create procedural Support-Fleet");
            return null;
        }
//        tempFleet.inflateIfNeeded();
//        tempFleet.deflate();
//        tempFleet.forceSync();
//        tempFleet.updateFleetView();
       
        return tempFleet;
    }

If it is relevant, I'm generating an empty fleet, then adding to it a specific Flagship, specific escort ships, then filling the rest with randomly generated ships taken from that tempFleet.
« Last Edit: December 08, 2021, 12:22:05 AM by Tartiflette »
Logged
 

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8216 on: December 08, 2021, 08:13:32 AM »

Is there a way to have two weapons get disabled/repaired at the same time?

Alternatively, is there a way to have a weapon both be a beam and produce projectiles (that do separate damage)?

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8217 on: December 08, 2021, 10:39:35 AM »

I'm trying to create random bounty fleets without a market, but for some reason I cannot manage to set their quality in any way. The ships are always pristine regardless of the values for quality, qualityMod, qualityOverride, averageSMods. I tried to force the values to 0, force the fleet to inflate, to deflate, etc to no avail.

...

If it is relevant, I'm generating an empty fleet, then adding to it a specific Flagship, specific escort ships, then filling the rest with randomly generated ships taken from that tempFleet.

First thing I'd try is spawning tempFleet to make sure it's getting the quality you want.

Also, make sure that your empty fleet does not have an inflater - unless you want it to have one, of course. But the inflater is responsible for adding d-mods and s-mods. So either you'd inflate() tempFleet and add ships to your empty fleet and make sure the empty fleet has no inflater (which is less efficient because those custom variants would exist always, instead of being inflated from shared stock variants when needed), or you could add uninflated fleet members from tempFleet and set an inflater on your empty fleet with the desired DefaultFleetInflaterParams (which includes ship quality). The simplest way to do this would probably be to just the inflater from tempFleet, which would have its parameters set based on what you passed into FleetFactoryV3.

Is there a way to have two weapons get disabled/repaired at the same time?

Alternatively, is there a way to have a weapon both be a beam and produce projectiles (that do separate damage)?

I can't think of any way to sync it up like that, and there'd be many potential UI issues. I think your best bet might be to have it be a beam weapon, with the projectile spawning happening in its BeamEffectPlugin.
Logged

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8219 on: December 09, 2021, 01:50:07 AM »

Is there any way to get the (turret/hardpoint)GunSprite of a weapon (aka the recoil sprite)?
The API for WeaponSpec has    
getHardpointSpriteName()
and
getHardpointUnderSpriteName()

But I dont see anything for the barrel.../recoil sprite
Logged
Pages: 1 ... 546 547 [548] 549 550 ... 710