Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 455 456 [457] 458 459 ... 462

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6840 on: October 12, 2020, 09:24:19 AM »

There's no event for it, so the easiest thing to do would be to have a script that periodically checks to see if playerFleet.getContainingLocation() has changed. Depending on the check interval and what you need, this *could* miss a quick jump out and back into the same system; to never miss that you'd need to check every frame. Which, with the check being so cheap - a simple == - should still be alright provided it's done carefully.
Logged

Ed

  • Captain
  • ****
  • Posts: 438
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6841 on: October 12, 2020, 09:39:04 AM »

I got a problem on my mod, my Wurg bar event is not showing up on long campaigns, but if i start a new game and get the requirements filled with console command it does work

What could be stopping the event from appearing?
Logged
Check out my ships

RustyCabbage

  • Commander
  • ***
  • Posts: 127
  • put shield shunts on your capitals
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6842 on: October 12, 2020, 04:05:40 PM »

Is there a way to get the same inflated fleet using only the DefaultFleetInflaterParams.seed and the variant IDs of the original uninflated ships? If not, what other information is required?

I've tried saving those values using writeTextFileToCommon and later recreating them by making a new CampaignFleetAPI fleet with the same members and original variants, but then the inflated variants end up different even with the same seed.

EDIT: Got it, the ships also needed to have the same ship name.
« Last Edit: October 12, 2020, 04:19:26 PM by RustyCabbage »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6843 on: October 12, 2020, 04:37:23 PM »

I got a problem on my mod, my Wurg bar event is not showing up on long campaigns, but if i start a new game and get the requirements filled with console command it does work

What could be stopping the event from appearing?

If your getBarEventTimeoutDuration() was super long, that might do it. Nothing much else comes to mind, though. Hmm - you could try putting some breakpoints in BarEventManager to see what's going on.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6844 on: October 12, 2020, 04:37:39 PM »

EDIT: Got it, the ships also needed to have the same ship name.

(Nice!)
Logged

RustyCabbage

  • Commander
  • ***
  • Posts: 127
  • put shield shunts on your capitals
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6845 on: October 12, 2020, 10:40:13 PM »

It seems that MissionDefinitionAPI.initMap can only make battlespaces with heights and widths that are multiples of 1000 pixels - do I have that right?

For instance, if I try to create a battlespace with 9000 height and width via api.initMap(-4500f, 4500f, -4500f, 4500f), it will only create a battlespace with 8000 pixels in height and width.

I guess the followup would be whether or not that is intended behavior. It certainly makes the tactical map prettier, but it seems like it's less intuitive than, say, the positive part rounding up and the negative part rounding down, or something to that effect.
« Last Edit: October 12, 2020, 10:42:26 PM by RustyCabbage »
Logged

Jaghaimo

  • Commander
  • ***
  • Posts: 110
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6846 on: October 13, 2020, 09:03:07 AM »

I have an BaseIntelPlugin that uses large description, and can grow in size. It simply uses panel given by the callee and adds many UI elements (panel.createUIElement, add something in resulting TooltipMakerAPI like one button or paragraph, finally addUIElement). It all works nicely until I reach defined height, at which point next "rows" spill over: https://i.imgur.com/XTa1Fyb.png
Pseudocode:
Code
public void createLargeDescription(CustomPanelAPI panel, float width, float height) {
  TooltipMakerAPI tooltip = panel.createUIElement(...);
  tooltip.addButton(...);
  panel.addUIElement(tooltip).inTL(0, height+10);
}

I tried adding an outer element, that would have custom panel, and then use that custom panel to add elements, which works fine: https://i.imgur.com/7QcelBd.png
Pseudo code:
Code
    public void createLargeDescription(CustomPanelAPI panel, float width, float height) {
        TooltipMakerAPI outer = panel.createUIElement(width, height, true);
        CustomPanelAPI inner = panel.createCustomPanel(width, height, new ButtonHandlerFactory());
        TooltipMakerAPI tooltip = panel.createUIElement(...);
        tooltip.addButton(...);
        inner.addUIElement(tooltip).inTL(0, height+10);
        inner.getPosition().setSize(width, height+10);
        outer.addCustom(inner, 0);
        panel.addUIElement(outer).inTL(0, 0);
}
Unfortunately, now no Button callbacks are handled now. I looked into CustomUIPanelPlugin, but processEvents events are low level, and from what I see I'd have to be looking at mouse clicks and comparing it with the location the actual buttons are rendered on intel screen... Or I could make a class for each button and implement CustomUIPanelPlugin, thus letting it handle own callbacks. Which means rewriting most of my row-col rendering logic, which by itself is fine unless there is something easier.
Is there an easier way to get a scroll on panel or am I forced to use customPanel and redoing part of my render logic?
Logged
Stellar Logistics - courier services
Hyperspace Network - information services

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6847 on: October 13, 2020, 09:42:32 AM »

It seems that MissionDefinitionAPI.initMap can only make battlespaces with heights and widths that are multiples of 1000 pixels - do I have that right?

For instance, if I try to create a battlespace with 9000 height and width via api.initMap(-4500f, 4500f, -4500f, 4500f), it will only create a battlespace with 8000 pixels in height and width.

I guess the followup would be whether or not that is intended behavior. It certainly makes the tactical map prettier, but it seems like it's less intuitive than, say, the positive part rounding up and the negative part rounding down, or something to that effect.

Honestly, this is one of those where I'll go with "whichever way it works is what's intended". I'm not sure if -4500 etc actually results in a battlefield being that size and just the visible map grid being smaller, or if it gets rounded, but regardless, I'd say it looks like only multiples of 1000 are supported.

@Jaghaimo: ahh, that's a bug! It came up a bit back, and is fixed for the next release. I mean, the part about button callbacks not getting called if it's added to an outer element - which would indeed be the "right" way to handle this, if it worked. My apologies!
Logged

shoi

  • Commander
  • ***
  • Posts: 159
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6848 on: October 14, 2020, 07:27:27 PM »

Basically, I wanted to create a more aggressive type of support wing that doesn't hide behind carrier and also doesn't fly directly on top of enemy because they won't survive. On top of that, ships don't seem to use fighter ability like targeting feed on support fighter if all wings consist of them ( intentional?)

So I set the support wing to bomber type, so they will immediately try to reload when ammo runs out instead of loitering like fighters do, and set engagement range to very low value (<1000)

It seems that AI recognizes that they have to get close to use the wings, so no problems there, but is there anything i'd be breaking doing this otherwise?
Would this cause any issue with a ship that has different bombers/fighters with different engage distance, and if I leave the support tag will autofit still assign the wing as if it were a support-type one despite having BOMBER role ?
« Last Edit: October 14, 2020, 10:08:41 PM by shoi »
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 1518
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6849 on: October 14, 2020, 08:32:07 PM »

Basically, I wanted to create a more aggressive type of support wing that doesn't hide behind carrier and also doesn't fly directly on top of enemy because they won't survive. On top of that, ships don't seem to use fighter ability like targeting feed on support fighter( intentional?)

So I set the support wing to bomber type, so they will immediately try to reload when ammo runs out instead of loitering like fighters do, and set engagement range to very low value (<1000)

It seems that AI recognizes that they have to get close to use the wings, so no problems there, but is there anything i'd be breaking doing this otherwise?
Would this cause any issue with a ship that has different bombers/fighters with different engage distance, and if I leave the support tag will autofit still assign the wing as if it were a support-type one despite having BOMBER role ?

Anyone chime in and correct me if this is inaccurate, but I seem to remember that the low range will will likely cause other wings to not be sent out even if they have higher range - though this could have been fixed since I last encountered it. The carrier will wait until all wings can attack unless it is being threatened while REGROUP is active.

Autofit should consider it a support wing, yes, the role only affects how hullmods/skills/ship systems affect it and how the AI uses the wing during a strike.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 17257
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6850 on: October 15, 2020, 11:44:09 AM »

On top of that, ships don't seem to use fighter ability like targeting feed on support fighter if all wings consist of them ( intentional?)

That sounds like a bug, made a note - thanks!

I'm unsure about whether low range will make other wings not get sent out - that may indeed be the case if it's not SUPPORT.
Logged

shoi

  • Commander
  • ***
  • Posts: 159
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6851 on: October 15, 2020, 01:23:10 PM »

Thanks guys  :)

I tested with disparate engagement ranges, and it seems to work fine. It seemed like the fighters with shorter range actually move further out when paired with another wing that has higher engagement range, but im not 100% sure thats what I actually was seeing.

Last question for now - is there a way to dynamically assign a fighter wing to an arbitrary ship? I was looking at the FighterWing API, and there is an option to set an owner, but it accepts an int. Is owner in this context the side, like player/enemy/ally ?
« Last Edit: October 15, 2020, 05:53:34 PM by shoi »
Logged

SirHartley

  • Captain
  • ****
  • Posts: 272
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6852 on: October 15, 2020, 03:44:10 PM »

i'm trying to prohibit building specific Vanilla Structures/Industries on a planet.
I'll take super dodgy solutions at this point, since I'm kinda running out of options :/
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 1518
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6853 on: October 15, 2020, 03:56:37 PM »

i'm trying to prohibit building specific Vanilla Structures/Industries on a planet.
I'll take super dodgy solutions at this point, since I'm kinda running out of options :/

Iirc I don't think this is possible as industry hardcap/structure hardcap mechanics (not the amount in the case of industries, just the build prevention mechanics) is hardcoded and not exposed. I've never tried before, though, so I very well could be wrong.

You could try procedurally removing the structure if it exists, refunding the player, and giving them an intel alert explaining what happened, but preventing building specifically from the structure interface is currently impossible, I believe.
Logged

Jaghaimo

  • Commander
  • ***
  • Posts: 110
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #6854 on: October 16, 2020, 04:19:16 AM »

My take on that would be for your mod to extend the base industry you want to prohibit, then replace base industry with your extended class (data/campaign/industry.csv). Then override isAvailableToBuild() with your logic.
Example: com.fs.starfarer.api.impl.campaign.econ.impl.Farming
Code
package i.hate.farms;

import com.fs.starfarer.api.impl.campaign.econ.impl.Farming;

public class MyFarming extends Farming {
   @Override
   public boolean isAvailableToBuild() {
      return false;
   }
}
And in your data/campaing/industries.csv:
Code
farming,Farming,15,60,,1,,,"farming, industry, rural",,graphics/icons/industry/farming.png,i.hate.farms.MyFarming,"Agriculture is a trade and technology as old as civilization itself; for thousands of cycles Humanity has harnessed the power of natural, modified, and artificial biological machines for sustenance. So it has always been, so it shall be so long as humans are human.",200

This is all theoretical code...
« Last Edit: October 16, 2020, 04:21:27 AM by Jaghaimo »
Logged
Stellar Logistics - courier services
Hyperspace Network - information services
Pages: 1 ... 455 456 [457] 458 459 ... 462