Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 655 656 [657] 658 659 ... 711

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9840 on: April 30, 2023, 10:12:06 AM »

- A delay between the fleet spawning and doing the transition didn't seem to fix it. Although if I'm in hyperspace looking at the fleet when it spawns, the transition animation works correctly on both ends of the jump.
The workaround I ended up using was to add the fleet directly to the star system at [99999, 99999] and use the hyperspace transition to do an 'in-system jump' to the intended destination.

Hmm, that's a bit strange, since I think when random NPC fleets jump in-system - and the player had not seen them before up until that point - the animation still works. I wonder what the difference is.

-I ended up using a combat plugin to set the CR, yeah. Although I then ran into an interesting issue: setting CR (only in-combat? haven't tested) seems to barely do anything for a station's modules, as in when I set their CR to zero they could still use their shields and experienced no malfunctions, although fighter replacement rate was zero as expected.
EDIT: Getting and applying the CombatReadinessPlugin to the ships after setting their CR seems to do the job.

Ahh - looking at the code, the Ship class will apply the CombatReadinessPlugin effect only if the ship's peak time has run out, so that makes sense.


Anyway while I'm here, a bug report and a 'working as designed but I want to complain':
- When a fleet is generated with FleetParamsV3.flagshipVariantId specified, and that variant is a SHIP_WITH_MODULES (station_small_Standard will do), mousing over it in the campaign map CTDs. I guess you can't set a fleet member's variant to a ship with modules if it wasn't already one?
286701 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.ArrayIndexOutOfBoundsException: 1
java.lang.ArrayIndexOutOfBoundsException: 1
   at com.fs.starfarer.campaign.fleet.FleetMemberStatus.getStatus(Unknown Source)
   at com.fs.starfarer.ui.super.OoOO.o00000(Unknown Source)
   at com.fs.starfarer.ui.super.OoOO.o00000(Unknown Source)
   at com.fs.starfarer.ui.super.OoOO.new(Unknown Source)
   at com.fs.starfarer.campaign.ui.O0OO.o00000(Unknown Source)


Right, yeah - changing the number of modules on a FleetMember (either from zero, as in your case, or from e.g. 2 to 3) does not work/is not supported.

- I'm not sure that FleetFactoryV3.addCommanderAndOfficersV2 should override the fleet commander's rank and post ID (lines 1001-1002) if it's passed a premade commander in the params.

Looks like that's fixed in the in-dev version - there's an "if (params.commander == null) {" check before it does that.


What determines if a ship shows up for purchase on the regular, military, or black market screens?

I don't actually remember the details, but the code for this is all exposed in the implementations of the submarket plugins. IIRC the open market gets some of the faction's military ships but of lower quality. And the black market has pirate ships, plus some market-faction stuff, more if stability is low.

Also, I have ship designs in my default_ship_roles.json file. Do I also have to have those specific hull IDs in a blueprint that a fction can make or can ships in the default_ship_Roles.json still show up even of no faction has them listed as known?

You need to add it to the faction's known ships; you can take a look at just about any faction file for an example of how that's set up.
Logged

Ontheheavens

  • Commander
  • ***
  • Posts: 137
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9841 on: May 01, 2023, 03:28:45 AM »

I'm interested in the way in which shipbounds work. Are the bounds array points evaluated in the order they are listed, so by insertion order? Say I want to draw a representation of said bounds. Is attempting to avoid intersections altogether (for example, by triangulating the set of points via ear clipping or Delaunay algorithm) a mistake? (I think it is, looking at Paragon or Wasp).

I'm also interested in the way coordinates listed in shipfile work. Do I understand it correctly that a ship center is evaluated from 0,0 as a top left corner of ship sprite and then all the other points like bounds, weapon points and the like are evaluated from 0,0 as ship center?

Where can I gather more info about it, meaning the way in which shipfile is meant to be constructed and the way in which it is evaluated by game code?

Edit: also - how the case of 2 identical bound points is being handled? Should the shipfile never have bound point duplicates, or is it perfectly acceptable?
« Last Edit: May 01, 2023, 08:26:53 AM by Ontheheavens »
Logged
   

Ruddygreat

  • Admiral
  • *****
  • Posts: 525
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9842 on: May 01, 2023, 12:27:52 PM »

I'm also interested in the way coordinates listed in shipfile work. Do I understand it correctly that a ship center is evaluated from 0,0 as a top left corner of ship sprite and then all the other points like bounds, weapon points and the like are evaluated from 0,0 as ship center?

0,0 in the sprite is the bottom left, but yeah that's otherwise correct.

Where can I gather more info about it, meaning the way in which shipfile is meant to be constructed and the way in which it is evaluated by game code?

you can just Global.getSettings.loadJson() the .ship file path (conveniently gettable from the ship's spec), then use the various JSONObject methods to get the values from it, as far as I know the game does it like that as well.

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9843 on: May 02, 2023, 09:34:42 AM »

What makes a faction generate personal bounties? I'm making a new faction and can't seem to make it give bounties no matter what I try.

Logged
mmm.... tartiflette

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9844 on: May 02, 2023, 10:17:54 AM »

I'm interested in the way in which shipbounds work. Are the bounds array points evaluated in the order they are listed, so by insertion order? Say I want to draw a representation of said bounds. Is attempting to avoid intersections altogether (for example, by triangulating the set of points via ear clipping or Delaunay algorithm) a mistake? (I think it is, looking at Paragon or Wasp).

The order they're listed; I'm not sure what "insertion order" would mean here. Overlaps are definitely ok.

Where can I gather more info about it, meaning the way in which shipfile is meant to be constructed and the way in which it is evaluated by game code?

I'm not sure if any of the community ship editors are open-source, but if so: that might be a good way to go. The wiki might also have some stuff about it? Not sure, to be honest.

Edit: also - how the case of 2 identical bound points is being handled? Should the shipfile never have bound point duplicates, or is it perfectly acceptable?

... I don't remember offhand. I think it's *probably* handled, but not 100% sure.


What makes a faction generate personal bounties? I'm making a new faction and can't seem to make it give bounties no matter what I try.

Hmm - PersonBountyIntel.pickFaction() is probably the method you want to look at. Basically, it requires that the faction have a market meeting certain criteria, e.g. "not hidden" etc.
Logged

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9845 on: May 02, 2023, 10:50:14 AM »

What makes a faction generate personal bounties? I'm making a new faction and can't seem to make it give bounties no matter what I try.

Hmm - PersonBountyIntel.pickFaction() is probably the method you want to look at. Basically, it requires that the faction have a market meeting certain criteria, e.g. "not hidden" etc.

Got it! Turns out a plugin needs to be added with methods (I did ongameload and onnewgame) to add the faction id to "SharedData.getData().getPersonBountyEventData().isParticipating"). Thanks Alex!
Logged
mmm.... tartiflette

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9846 on: May 02, 2023, 12:07:04 PM »

Ahh, glad you got it! I forgot about that completely :)
Logged

Big Bee

  • Commander
  • ***
  • Posts: 153
  • bugs are cool
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9847 on: May 02, 2023, 02:13:11 PM »

Hello! I've been having some trouble with adding a campaign system to my mod and saw this post about getting them to work without compiling anything with using vanilla systems as a base. I copied the Yma system as a starting point and took a look at the Periphery mod as Great Wound suggested to the original poster of that thread, with a data/world/generators.csv and all, but whenever I try to generate a sector, the game crashes and I get this popup.

popup image

[close]
error in log
25411 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.ClassCastException: data.scripts.world.systems.Calcari cannot be cast to com.fs.starfarer.api.campaign.SectorGeneratorPlugin
java.lang.ClassCastException: data.scripts.world.systems.Calcari cannot be cast to com.fs.starfarer.api.campaign.SectorGeneratorPlugin
   at com.fs.starfarer.loading.O00O.super(Unknown Source)
   at com.fs.starfarer.campaign.save.CampaignGameManager.o00000(Unknown Source)
   at com.fs.starfarer.title.TitleScreenState.dialogDismissed(Unknown Source)
   at com.fs.starfarer.ui.N.dismiss(Unknown Source)
   at com.fs.starfarer.ui.impl.K.dismiss(Unknown Source)
   at com.fs.starfarer.campaign.save.if.actionPerformed(Unknown Source)
   at com.fs.starfarer.ui.OoO0.buttonPressed(Unknown Source)
   at com.fs.starfarer.ui.oooO.Ò00000(Unknown Source)
   at com.fs.starfarer.ui.oooO.processInput(Unknown Source)
   at com.fs.starfarer.ui.V.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.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
[close]

I had a quick look and compared the modded system to mine and added "import com.fs.starfarer.api.campaign.SectorGeneratorPlugin;" in the same place, assuming that said plugin not being imported was the problem, but apparently I get the issue regardless of whether or not it's there? Sorry if this is a kinda obvious issue, I'm admittedly not very knowledgeable about programming.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9848 on: May 03, 2023, 08:38:31 AM »

The way you're doing it, you'll want to have your class be declared like this:

public class Calcari implements SectorGeneratorPlugin
Logged

Big Bee

  • Commander
  • ***
  • Posts: 153
  • bugs are cool
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9849 on: May 03, 2023, 09:20:57 AM »

The way you're doing it, you'll want to have your class be declared like this:

public class Calcari implements SectorGeneratorPlugin

That solved it, thank you!

And what'd you know, the other modded system I had a look at for reference also had that, and I simply missed it...
Logged

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9850 on: May 03, 2023, 12:49:59 PM »

What’s the best way to call a function at the very end of a battle? Specifically, I’d like to modify the CR of every single ship left on the field as the battle ends. Is there a simple trigger for that somewhere?

EDIT: a function that checks the boolean "Global.getCombatEngine().isCombatOver()" seems serviceable. However, the script doesn't run when I claim victory via esc instead of letting the battle end naturally... Does anyone have better suggestions?
« Last Edit: May 06, 2023, 02:03:15 PM by PCCL »
Logged
mmm.... tartiflette

Ontheheavens

  • Commander
  • ***
  • Posts: 137
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9851 on: May 05, 2023, 10:19:37 AM »

@Alex What's going on here?

Spoiler
Code
383713 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NoSuchMethodError: com.fs.starfarer.api.ui.TooltipMakerAPI.addImageWithText(F)V
java.lang.NoSuchMethodError: com.fs.starfarer.api.ui.TooltipMakerAPI.addImageWithText(F)V
at forgprod.abilities.interaction.panel.components.Sidebar.addFrameBox(Sidebar.java:77)
at forgprod.abilities.interaction.panel.components.Sidebar.createFrame(Sidebar.java:64)
at forgprod.abilities.interaction.panel.components.Sidebar.create(Sidebar.java:39)
at forgprod.abilities.interaction.panel.ControlPanelAssembly.addComponents(ControlPanelAssembly.java:79)
at forgprod.abilities.interaction.panel.ControlPanelAssembly.renderPanel(ControlPanelAssembly.java:72)
at forgprod.abilities.interaction.ControlPanelPlugin.init(ControlPanelPlugin.java:28)
at forgprod.abilities.interaction.wrappers.ControlDialogDelegate.init(ControlDialogDelegate.java:29)
at com.fs.starfarer.ui.newui.return.<init>(Unknown Source)
at com.fs.starfarer.ui.newui.classsuper.showCustomVisualDialog(Unknown Source)
at forgprod.abilities.interaction.wrappers.ControlInteractionPlugin.optionSelected(ControlInteractionPlugin.java:41)
at forgprod.abilities.interaction.wrappers.ControlInteractionPlugin.init(ControlInteractionPlugin.java:32)
at com.fs.starfarer.ui.newui.classsuper.o?0000(Unknown Source)
at com.fs.starfarer.ui.newui.classsuper.<init>(Unknown Source)
at com.fs.starfarer.ui.newui.classsuper.<init>(Unknown Source)
at com.fs.starfarer.campaign.CampaignState.showInteractionDialog(Unknown Source)
at forgprod.abilities.ForgeProductionAbility.pressButton(ForgeProductionAbility.java:116)
[close]

Here is the relevant code:

Spoiler
Code
    private static void addFrameBox(TooltipMakerAPI sidebarFrame, float width) {
        TooltipMakerAPI sidebarBoxContainer = sidebarFrame.beginImageWithText(null, 2f);
        Color baseBoxColor = Misc.interpolateColor(PanelConstants.DARK_PLAYER_COLOR,
                PanelConstants.BRIGHT_PLAYER_COLOR, 0.5f);
        Color boxColor = Misc.scaleColorOnly(baseBoxColor, 0.9f);
        sidebarBoxContainer.addAreaCheckbox("", null, PanelConstants.PLAYER_COLOR,
                boxColor, PanelConstants.PLAYER_COLOR,
                width, 503, 0f);
        sidebarBoxContainer.getPrev().getPosition().setXAlignOffset(-245f);
        sidebarFrame.addImageWithText(2f);
    }
[close]

Tried to comment one such line - seems like the problem is universal for addImageWithText() methods.

The signature of method did change from void to UIPanel -
Code
UIPanelAPI addImageWithText(float pad);
, but I fail to see how that could be of issue since the call never used a return value earlier. The exception complains about no such method, but it is clearly there - perhaps signature mismatch is the culprit? If so, how do I deal with it?

Edit: right, it's the signature mismatch:

Code
   L5
    LINENUMBER 77 L5
    ALOAD 0
    FCONST_2
    INVOKEINTERFACE com/fs/starfarer/api/ui/TooltipMakerAPI.addImageWithText (F)V (itf)
   L6

Tried to delete the jar and rebuild - not so fast, Intellij uses .class files to quick build. Need to delete the whole /out folder, and voila:

Code
   L5
    LINENUMBER 77 L5
    ALOAD 0
    FCONST_2
    INVOKEINTERFACE com/fs/starfarer/api/ui/TooltipMakerAPI.addImageWithText (F)Lcom/fs/starfarer/api/ui/UIPanelAPI; (itf)
    POP
   L6

Edit 2: Looking right now through updated TooltipMakerAPI methods I catch myself really appreciating work on the methods and changes that were added this update. It really is heartwarming to see. Thanks for your hard work - I am sure you as well will appreciate the result in the form of the new glorious content that will be created using these new possibilities.
« Last Edit: May 06, 2023, 09:49:40 AM by Ontheheavens »
Logged
   

Big Bee

  • Commander
  • ***
  • Posts: 153
  • bugs are cool
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9852 on: May 06, 2023, 06:59:51 AM »

Is there a way to combine "heatseeker" and "MIRV" behaviours for missiles?
Logged

SiriusClean

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9853 on: May 06, 2023, 04:32:21 PM »

Hello,

i have a weird problem with my custom faction.
The Faction uses my custom ship and weapon set,
but only spawns ships with no weapons.

If i enable the base_bp in the .FACTION file,
only the vanilla ships will spawn with weapons and then only with vanilla weapons equipped.
Every custom ship, weapon and variant is working normaly in simulation
and can be used by the player in campaign with no problems.
I checked my files and compared them with some other mod files(diableavionics,XhanEmpire, etc.),
but i couldnt find the cause of that problem.

.FACTION:
Spoiler
Code
{
id:"hive_fleet",
"color":[107,142,35,255],

"baseUIColor":[107,142,35,255],
"secondaryUIColor":[255,255,255,255],
"secondarySegments":2,
"darkUIColor":[107,142,35,255],
"gridUIColor":[107,142,35,255],

"displayName":"Hive",
"displayNameWithArticle":"the Hive",

"logo":"graphics/factions/hive_fleet.png",
"crest":"graphics/factions/crest_hive_fleet.png",

"shipNamePrefix":"QG",

    "shipNameSources":{
"SPACE":1,
"JAPANESE":1,
},
"names":{
"myth":1,
"JAPANESE":1,
},

# variantOverrides restricts hulls to listed variants and adjusts their probability
"variantOverrides":{
},

# multiplier for how often hulls show up in the faction's fleets
"hullFrequency":{
"tags":{
},
"hulls":{
},
},
# ships the faction gets access to when importing S&W out-of-faction
"shipsWhenImporting":{
"tags":["hive_full_bp"],
"hulls":[
"hive_hunter",
"hive_swarmer",
"hive_breeder",
"hive_queen",
"hive_novus",
"hive_strikus",
"hive_feeder",
"hive_galioth",
],
},
"knownShips":{
"tags":["hive_full_bp"],
"hulls":[
"hive_hunter",
"hive_swarmer",
"hive_breeder",
"hive_queen",
"hive_novus",
"hive_strikus",
"hive_feeder",
"hive_galioth",

],
},
# listing ships here will make the faction mostly use them even if other hulls become available
"priorityShips":{
"tags":[],
"hulls":[
],
},
"knownFighters":{
"tags":["hive_full_bp"],
"fighters":[

],
},
"priorityFighters":{
"tags":[],
"fighters":[],
},
"knownWeapons":{
"tags":["hive_full_bp","base_bp"],
"weapons":[
"hive_horngun_small",
"hive_reaper_gun",
"hive_mutagen_lance",
"hive_stinger_af",
"hive_viper_launcher",
"hive_hydra_cannon",
"hive_zerg_launcher",
],
},
"priorityWeapons":{
"tags":[],
"weapons":[],
},
"knownHullMods":{
"tags":["base_bp"],
"hullMods":[
"turretgyros",
"armoredweapons",
"augmentedengines",
"autorepair",
"expanded_deck_crew",
"magazines",
"missleracks",
"heavyarmor",
"insulatedengine",
"targetingunit",
"nav_relay",
"operations_center",
"fluxbreakers",
"surveying_equipment",
"efficiency_overhaul",
"escort_package",
"assault_package",
"converted_fighterbay",
],
},
[close]

Maybe somebody can help me with that?

edit:

The ships will spawn with the variant hullmods and names but nothing more.

default_ship_roles.json:
Spoiler
Code
{
"combatSmallForSmallFleet":{
"hive_strikus_fleet_standard":10,
"hive_swarmer_patrol":4,
"hive_swarmer_heavy_support":8,
"hive_novus_light_support":8,
},

"combatSmall":{
"hive_strikus_fleet_standard":10,
"hive_swarmer_patrol":6,
"hive_swarmer_heavy_support":4,
"hive_novus_light_supression":2,
"hive_novus_light_support":12
},

"combatMedium":{
"hive_hunter_fleet_standard":10,

},

"combatLarge":{
"hive_galioth_siege_support":6

},

"combatCapital":{
},

"combatFreighterLarge":{
"hive_feeder_supply_ship":10
},

"freighterSmall":{
},

"tankerSmall":{
},

"civilianRandom":{
},

"carrierSmall":{
},

"personnelMedium":{
},

"carrierMedium":{
"hive_breeder_fleet_standard":10
},

"carrierLarge":{
},

"carrierCapital":{
"hive_queen_fleet_standard":10
},
}
[close]

hive_swarmer_heavy_support.variant:
Spoiler
Code
{
  "variantId": "hive_swarmer_heavy_support",
  "hullId": "hive_swarmer",
  "displayName": "Hive Swarmer Support",
  "goalVariant": true,
  "fluxCapacitors": 0,
  "fluxVents": 7,
  "permaMods": [],
  "hullMods": [
    "armoredweapons",
    "auxiliarythrusters",
    "hardened_subsystems",
    "missleracks"
  ],
  "weaponGroups": [
    {
      "autofire": true,
      "mode": "LINKED",
      "weapons": {
        "WS0001": "hive_horngun_small"
      }
    },
    {
      "autofire": false,
      "mode": "LINKED",
      "weapons": {
        "WS0003": "hive_stinger_af",
        "WS0004": "hive_stinger_af"
      }
    },
    {
      "autofire": true,
      "mode": "LINKED",
      "weapons": {
        "WS0002": "hive_reaper_gun",
        "WS0005": "hive_reaper_gun",
        "WS0006": "hive_reaper_gun"
      }
    }
  ],
  "modules": [],
  "wings": []
}
[close]





« Last Edit: May 06, 2023, 04:42:07 PM by SiriusClean »
Logged

Lukas04

  • Captain
  • ****
  • Posts: 372
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9854 on: May 06, 2023, 09:22:36 PM »

Is there a way to mark a created battle as a simulation?
To make sure that ships used in it dont suffer real damage & have the button for leaving the sim available.
Logged
My Mods
Pages: 1 ... 655 656 [657] 658 659 ... 711