Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 658 659 [660] 661 662 ... 710

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

TalRaziid

  • Lieutenant
  • **
  • Posts: 64
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9885 on: May 17, 2023, 03:45:43 PM »

Hey folks, can anyone guide me through how to add a new commodity to the game that will be produced by Heavy Industry?
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3021
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9886 on: May 17, 2023, 04:18:40 PM »

hey all, its me again. with 3 more questions:
1) how do i add a special item to a sub-markets cargo?
2) how do i save data to a special item? (so the data on it is save persistent)

Roider's Union HQ submarket does both of these (src/scripts/campaign/submarkets/Roider_UnionHQSubmarketPlugin). It is basically just getting the submarket's cargo and adding a special item to it.

Code: java
getCargo().addSpecial(new SpecialItemData(Roider_Items.UNION_HQ_BP, Roider_Industries.UNION_HQ), 1);
Note that you need to avoid adding it multiple times as the market updates. My impl removes it each update before adding it.

Also special item data is limited to one String.


Hey folks, can anyone guide me through how to add a new commodity to the game that will be produced by Heavy Industry?

Best I can tell you is to take a look at the resource deposit market condition plugin because adding commodities to existing industries is a pain.
Logged

PCCL

  • Admiral
  • *****
  • Posts: 2016
  • still gunnyfreak
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9887 on: May 17, 2023, 08:28:54 PM »

What property defines a ship as "disabled"? And is there a method on the API where we can interact with that? Specifically, I'm trying to "revive" a ship that's dead by setting its hull level above zero and removing the "disabled" effect. I tried "setHulk(false)" but that doesn't seem to do the trick.
Logged
mmm.... tartiflette

sajberhippien

  • Ensign
  • *
  • Posts: 12
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9888 on: May 17, 2023, 10:42:56 PM »

Having never modded the game, but having some experience modding other games, would it be a lot of work to learn how to make a mod that simply customizes SP costs for various vanilla actions? Basically, I wanna adjust SP costs so that the things I find myself almost always spending points on get more expensive, while slightly increasing general SP gains (but I know how to do the latter by looking at this mod).

Most of the guides and tools seem directed at 'content mods', on adding weapons and ships, on spriting etc but I've no interest in that.

TBC, I'm not asking in the 'minor questions' thread in the hopes of getting a full guide on how to do this, I just wanna know if the learning curve is too high for it to be worth bothering with. And obviously, if it's not possible to mod such changes to the base game, I'd love to know that as well.

Thanks!
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9889 on: May 18, 2023, 03:37:20 AM »

How are you supposed to use checkbox (TooltipMakerAPI.addCheckbox) in intel? It has no data property (like Button or AreaButton does), so it will not fire IntelInfoPlugin.buttonPressConfirmed method.

Also, thank you for the row pressed functionality! I see `IntelInfoPlugin.tableRowClicked` which makes me wonder whether you just forgot about `Object data` for checkbox (preferable, since addCheckbox returns ButtonAPI which implies same behaviour as other ButtonAPI objects), or meant to add `IntelInfoPlugin.checkboxClicked` instead.
Logged

float

  • Captain
  • ****
  • Posts: 267
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9890 on: May 18, 2023, 09:31:25 AM »

Noticed some odd behavior with the shieldHit parameter of OnHitEffectPlugin.onHit. If the damage amount is 0, shieldHit is always false regardless of whether the projectile actually hit shields or not. And if the damage amount is less than 1, there seems to be a random chance of shield hits not registering as shield hits, specifically if the projectile is fading when it hits. I wonder if this is intended behavior. Is shieldHit checking to see if the target's flux was raised by the shot instead of checking if the projectile is within range and inside the shield's arc?
Logged

YerRob

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9891 on: May 18, 2023, 01:08:47 PM »

How does the game load multiple sprites with the same name and path?
More specifically, if im using a skin pack that, for example, turns a purple ship into a yellow one, will the game keep both sprites in memory, or only the last loaded in?
Cause if it keeps both loaded in, then that would mean skin pack mods are horrible for Vram
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9892 on: May 18, 2023, 06:08:42 PM »

Having never modded the game, but having some experience modding other games, would it be a lot of work to learn how to make a mod that simply customizes SP costs for various vanilla actions? Basically, I wanna adjust SP costs so that the things I find myself almost always spending points on get more expensive, while slightly increasing general SP gains (but I know how to do the latter by looking at this mod).
A bunch of story point costs (well, the bonus XP values at least) are in settings.json's bonusXP table; also note the three values above it for a few actions that cost multiple points.
Mods may have story point events in code that aren't accessible in this way however.

How are you supposed to use checkbox (TooltipMakerAPI.addCheckbox) in intel? It has no data property (like Button or AreaButton does), so it will not fire IntelInfoPlugin.buttonPressConfirmed method.
You've likely already worked this out, but for an intel plugin, best I can come up with is storing the checkbox in a transient collection and having a 'confirm' button or somesuch that checks their states (or checking in advance() I guess).
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9893 on: May 19, 2023, 11:59:15 AM »

Sorry I haven't had much time to respond here while working on the hotfixes!

Does MEMORY_KEY_ALLOW_PLAYER_BATTLE_JOIN_TOFF actually do anything?

If any fleet on a side has this flag in memory, the player can join that side without having their transponder be on. There are iirc other considerations too, but e.g. in vanilla it's used to allow the player to join battles on the side of pirates in a system where you have a deal with the station king - without requiring you to be non-hostile with pirates - and it works.


How does    ShipAPI.setLayer(CombatEngineLayers layer)  work with modules?

it looks like it works but modules will still render beneath the weapons of the parent ship? Is that expected behavior?

Yeah, this is expected behavior. Station weapons render above all of their modules; otherwise there's some weirdness with e.g. armor modules rendering above guns of the modules they protect, etc.


BaseHubMission.triggerSpawnShipGraveyard seems to have an NPE (stacktrace from Java 17, but also happens on 8 )

Thank you, fixed! Looks like it was related to it trying to spawn civilian-type derelicts for factions that didn't have any civilian ships.


1) how do i add a special item to a sub-markets cargo?
2) how do i save data to a special item? (so the data on it is save persistent)
3) is it possible to change the credit cost of special items on a per stack basis?
thanks all for responding to my silly questions again.

1) Using SubmarketPlugin.getCargo()
2 & 3) You can't; the game treats items of the same type as completely interchangeable

Also special item data is limited to one String.

That's technically true but writing actual custom data to that is not a good idea, I don't think? ... unless that causes the game to not stack those items with each other anymore? Hmm. Maybe I'm wrong here.


What property defines a ship as "disabled"? And is there a method on the API where we can interact with that? Specifically, I'm trying to "revive" a ship that's dead by setting its hull level above zero and removing the "disabled" effect. I tried "setHulk(false)" but that doesn't seem to do the trick.

I'm not sure that's doable. It'd need its AI set, and probably the owner set to 0 or 1 (hulks have owner == 100). Also the battle will have recorded that ship as being disabled, so you'd need to handle whatever post-battle effects of that.


Having never modded the game, but having some experience modding other games, would it be a lot of work to learn how to make a mod that simply customizes SP costs for various vanilla actions? Basically, I wanna adjust SP costs so that the things I find myself almost always spending points on get more expensive, while slightly increasing general SP gains (but I know how to do the latter by looking at this mod).

Most of the guides and tools seem directed at 'content mods', on adding weapons and ships, on spriting etc but I've no interest in that.

TBC, I'm not asking in the 'minor questions' thread in the hopes of getting a full guide on how to do this, I just wanna know if the learning curve is too high for it to be worth bothering with. And obviously, if it's not possible to mod such changes to the base game, I'd love to know that as well.

Thanks!

Hi! The costs are not all externalized in one place and iirc certain ones are hardcoded (such as the cost to elite a skill or to respec, I think), so it'd be a mixed bag.


How are you supposed to use checkbox (TooltipMakerAPI.addCheckbox) in intel? It has no data property (like Button or AreaButton does), so it will not fire IntelInfoPlugin.buttonPressConfirmed method.
You've likely already worked this out, but for an intel plugin, best I can come up with is storing the checkbox in a transient collection and having a 'confirm' button or somesuch that checks their states (or checking in advance() I guess).

This is definitely an oversight, fixed. (Leaving the original methods as @Deprecated.)


Noticed some odd behavior with the shieldHit parameter of OnHitEffectPlugin.onHit. If the damage amount is 0, shieldHit is always false regardless of whether the projectile actually hit shields or not. And if the damage amount is less than 1, there seems to be a random chance of shield hits not registering as shield hits, specifically if the projectile is fading when it hits. I wonder if this is intended behavior. Is shieldHit checking to see if the target's flux was raised by the shot instead of checking if the projectile is within range and inside the shield's arc?

That parameter is just checking if the damage to shields was >0.


How does the game load multiple sprites with the same name and path?
More specifically, if im using a skin pack that, for example, turns a purple ship into a yellow one, will the game keep both sprites in memory, or only the last loaded in?
Cause if it keeps both loaded in, then that would mean skin pack mods are horrible for Vram

I think (depending on how this is done, I suppose), the game probably won't even try to load the original sprite and will only load the new one. But that really depends on what you mean by "skin pack" etc.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3021
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9894 on: May 19, 2023, 06:36:15 PM »

Also special item data is limited to one String.

That's technically true but writing actual custom data to that is not a good idea, I don't think? ... unless that causes the game to not stack those items with each other anymore? Hmm. Maybe I'm wrong here.

IDK, I have not tried to exploit it. Ship blueprints do not stack and IIRC they are the same item with different data.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9895 on: May 19, 2023, 08:41:35 PM »

Yeah, that's definitely a point. I wonder if this could be made to work for e.g. something like survey data that's aware of what planet it's for, etc, hmm.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9896 on: May 20, 2023, 06:06:27 AM »

Thanks Alex!

Two new things:


This is probably working as designed but still annoyed me trying to track it down: CustomUIPanelPlugin.buttonPressed doesn't get called if the button is inside a nested panel that doesn't have its own plugin. So the innermost button-holding panels all need to have the code to handle the button press, whereas in my existing implementation I can just have the outermost panel handle all presses and the dumb element holder panels can be dumb element holder panels.
Some testing
My plugin:
Code: java
public class TestCustomUIPanelPlugin extends BaseCustomUIPanelPlugin {

    protected String name;

    public TestCustomUIPanelPlugin(String name) {
        this.name = name;
    }

    @Override
    public void buttonPressed(Object buttonId) {
        log.info(String.format("Button %s pressed picked up by panel plugin %s", buttonId, name));
    }
}

Test code 1:
Code: java
	public static void panelTest(InteractionDialogAPI dialog) {
VisualPanelAPI vp = dialog.getVisualPanel();
CustomUIPanelPlugin plugin = new TestCustomUIPanelPlugin("Outer");
CustomPanelAPI panel = vp.showCustomPanel(600, 800, plugin);

TooltipMakerAPI tooltip = panel.createUIElement(400, 96, false);
tooltip.addButton("test", "my button ID", 60, 24, 3);
panel.addUIElement(tooltip).inTL(0, 0);
}
Result: "Button my button ID pressed picked up by panel plugin Outer"
OK, fine

Test code 2: Instead of adding the button to the outer panel, we nest it inside another panel:
Code: java
		CustomUIPanelPlugin plugin2 = new TestCustomUIPanelPlugin("Inner");
boolean usePlugin2 = true;
CustomPanelAPI subPanel = panel.createCustomPanel(400, 96, usePlugin2 ? plugin2 : null);
panel.addComponent(subPanel).inTL(0, 0);

TooltipMakerAPI tooltip = subPanel.createUIElement(400, 96, false);
tooltip.addButton("test", "my button ID", 60, 24, 3);
subPanel.addUIElement(tooltip).inTL(0, 0);
Result: "Button my button ID pressed picked up by panel plugin Inner"
Actually causes some problems for my current code, but fine, this is valid.

Test code 3: Same as before, but we set usePlugin2 to false, so the inner panel has no plugin.
Result: (no log message)
[close]
Button presses seem to already be able to propagate "upwards" or such, e.g. an intel plugin can pick them up even if the button is in a custom panel. Perhaps this functionality should be applied here as well?


How is the base repair rate of ships determined? I feel like its interaction with supplies-to-recover stats results in some potentially 'screwy', in unpredictable ways, behavior re. repair costs.

Here I have a Facet with seemingly modest damage that costs 265 supplies to repair. It has a 5% CR/deployment and 20% CR recovery/day, so it burns four times its deploy cost just for one day of repairs, multiplied by 5.52 days. This makes the thing a noob trap!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9897 on: May 20, 2023, 10:55:44 AM »

This is probably working as designed but still annoyed me trying to track it down: CustomUIPanelPlugin.buttonPressed doesn't get called if the button is inside a nested panel that doesn't have its own plugin. So the innermost button-holding panels all need to have the code to handle the button press, whereas in my existing implementation I can just have the outermost panel handle all presses and the dumb element holder panels can be dumb element holder panels.
...
Button presses seem to already be able to propagate "upwards" or such, e.g. an intel plugin can pick them up even if the button is in a custom panel. Perhaps this functionality should be applied here as well?

Hmm, yeah, it might make sense to do that; I'll keep it in mind!

(Perhaps obvious, but kind of the "standard" solution to keeping the innermost panels "dumb" would be to provide them with a plugin that's just a wrapper around your base plugin and passes through the buttonPressed() call. This is more or less equivalent to passing in an ActionListener or whatever to a button, in typical UI code architecture...)


How is the base repair rate of ships determined? I feel like its interaction with supplies-to-recover stats results in some potentially 'screwy', in unpredictable ways, behavior re. repair costs.

Here I have a Facet with seemingly modest damage that costs 265 supplies to repair. It has a 5% CR/deployment and 20% CR recovery/day, so it burns four times its deploy cost just for one day of repairs, multiplied by 5.52 days. This makes the thing a noob trap!


It's just this, in settings.json:
"baseRepairRateFrigate":10,
"baseRepairRateDestroyer":7,
"baseRepairRateCruiser":5,
"baseRepairRateCapital":3,

So the cost per day ends up being real high because of the 5% CR/deployment and the high recovery rate. Those stats would not line up like that if this was intended for player use, naturally!
Logged

YerRob

  • Ensign
  • *
  • Posts: 9
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9898 on: May 20, 2023, 01:46:21 PM »


How does the game load multiple sprites with the same name and path?
More specifically, if im using a skin pack that, for example, turns a purple ship into a yellow one, will the game keep both sprites in memory, or only the last loaded in?
Cause if it keeps both loaded in, then that would mean skin pack mods are horrible for Vram

I think (depending on how this is done, I suppose), the game probably won't even try to load the original sprite and will only load the new one. But that really depends on what you mean by "skin pack" etc.

Thank you, with skin pack i meant the ones where you just overwrite the ship graphics with another one by using the same paths and names, similarly to diable avionic's skin packs.
Good to know that the game skips overwritten images, here i was doing some nonsense shell script folder merging in worries of vram issues.
Logged

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 231
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9899 on: May 21, 2023, 12:26:21 PM »

How does one force a specific intel plugin to open?

Global.getSector().campaignUI.showCoreUITab(CoreUITabId.INTEL, intel) only opens the intel screen. I'd use IntelUIAPI.selectItem() but I don't know how to get a intel UI instance.
Logged
Pages: 1 ... 658 659 [660] 661 662 ... 710