Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 ... 646 647 [648] 649 650 ... 706

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

ctuncks

  • Commander
  • ***
  • Posts: 117
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9705 on: March 16, 2023, 08:11:33 PM »

Hmm - weapon.getSpec().getTurnRate()? This will not include the effect of stuff like Advanced Turret Gyros etc; if you really needed that you could compute the value using the relevant turn rate stat for the weapon.

I should have added I already tried that methodology, it did not work.

This is what I got attempting to write it out manually and if I tried to compile it after I get this:

I went and had a look inside of WeaponSpecAPI and there's no entry for getTurnRate in there only get/setTurnRateStr which is just the string entry for turn rate if I'm correct.

For context I want to make a hullmod that can set the PD tag to True if a number of conditions are met and one of those is a base turn speed of X or higher.

Logged

rogerbacon

  • Commander
  • ***
  • Posts: 142
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9706 on: March 17, 2023, 06:27:34 AM »

Is it possible to modify the AI vs AI auto-combat logic? For example, if I want to make the combats last longer or bias  fights that include an AI fleet from the player's faction.
Logged

JAL28

  • Commander
  • ***
  • Posts: 217
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9707 on: March 17, 2023, 08:20:50 AM »

Does anyone know how to make a module turn around properly? I tried putting axial rotation and anchor rotation on it but it refuses to turn around like the shield modules on high tech stations

also how to make ship visual appear before obtaining a ship? like how bar missions do it, preferably without using mem flags
« Last Edit: March 17, 2023, 08:35:49 AM by JAL28 »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9708 on: March 18, 2023, 10:14:29 AM »

I went and had a look inside of WeaponSpecAPI and there's no entry for getTurnRate in there only get/setTurnRateStr which is just the string entry for turn rate if I'm correct.

Ah! Must only be in the dev version at this point; it'll be available in the next release.


Is it possible to modify the AI vs AI auto-combat logic? For example, if I want to make the combats last longer or bias  fights that include an AI fleet from the player's faction.

You could provide your own implementation of BattleAutoresolverPluginImpl that could do that. To make the combat last longer - I don't think you could modify the time between "rounds" but you could have your plugin's resolve() method do less damage to each fleet so the overall battle would be longer.

Does anyone know how to make a module turn around properly? I tried putting axial rotation and anchor rotation on it but it refuses to turn around like the shield modules on high tech stations

Hmm. I'd suggest copy-pasting the shield module and making incremental changes to see what's making it not work in your case, then.

also how to make ship visual appear before obtaining a ship? like how bar missions do it, preferably without using mem flags

Take a look at the HandMeDownFreighter class, the callAction() method specifically.
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9709 on: March 18, 2023, 12:59:00 PM »

is there a way to make a mine not collide with anything but still register as a danger to the AI?
Looking at the reality disruptor, it's got almost everything I want there, but since it uses a ROCKET type projectile it can't decelerate to it's top speed
(or could I just use a PHASE_CHARGE type proj w/ no collision class & copy the rest from the reality disruptor?)

ctuncks

  • Commander
  • ***
  • Posts: 117
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9710 on: March 18, 2023, 04:38:41 PM »

Ah! Must only be in the dev version at this point; it'll be available in the next release.

Cheers, I can just put the idea on the backburner for now then.
Logged

Weavy

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9711 on: March 19, 2023, 03:43:18 PM »

Hey so I want to make an UI mod, just have the player's portrait show up in the event screen, like when you're talking to someone, any time you make text decisions basically.
Have no ideea where to start though.
Logged

bananana

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9712 on: March 19, 2023, 04:22:25 PM »

question
is it possible to somehow embed into TooltipMakerAPI or CustomPanelAPI an inventory item (be it a commodity, a special item, or a weapon), so that it would behave the same way as it does in the inventory on hover, display the native popup info tooltip (and not a manually recreated copy thereof)?
or maybe embed a 1x1 cell of loot cargo window, and put a specified item in there?
something similar to how addShipList works
« Last Edit: March 19, 2023, 04:28:39 PM by bananana »
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9713 on: March 19, 2023, 08:18:41 PM »

could you add a setter for wing size launched from a launch bay?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9714 on: March 21, 2023, 08:36:21 AM »

is there a way to make a mine not collide with anything but still register as a danger to the AI?
Looking at the reality disruptor, it's got almost everything I want there, but since it uses a ROCKET type projectile it can't decelerate to it's top speed
(or could I just use a PHASE_CHARGE type proj w/ no collision class & copy the rest from the reality disruptor?)

I think so, yeah. Also, I believe ROCKET *would* decelerate to its top speed.

Hey so I want to make an UI mod, just have the player's portrait show up in the event screen, like when you're talking to someone, any time you make text decisions basically.
Have no ideea where to start though.

Not sure offhand how you'd do that without changing literally every interaction where you want that to happen, hmm.



question
is it possible to somehow embed into TooltipMakerAPI or CustomPanelAPI an inventory item (be it a commodity, a special item, or a weapon), so that it would behave the same way as it does in the inventory on hover, display the native popup info tooltip (and not a manually recreated copy thereof)?
or maybe embed a 1x1 cell of loot cargo window, and put a specified item in there?
something similar to how addShipList works

Hmm - have you tried TooltipMakerAPI.showCargo()? It's intended as the addShipList() equivalent for cargo.


could you add a setter for wing size launched from a launch bay?

Sorry! Not that simple, unfortunately. Your best bet might be something like how ReserveWingStats does it but with a very very long duration for the replacement fighters... and probably tracking the number of fighters with a script and fudging things as needed. Not 100% sure on the details or whether this could be *quite* made to emulate more fighters in a wing, though.
Logged

Weavy

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9715 on: March 21, 2023, 09:42:16 AM »


Hey so I want to make an UI mod, just have the player's portrait show up in the event screen, like when you're talking to someone, any time you make text decisions basically.
Have no ideea where to start though.

Not sure offhand how you'd do that without changing literally every interaction where you want that to happen, hmm.


Wow that sounds like it'd be a lot of work. Thanks for the answer
I don't know much about gui technology honestly, so I was hoping it was gonna be something simple, like a base template file for the event screen where you could just plug in components and it'd render them conditionally, like asp
Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9716 on: March 21, 2023, 10:01:25 AM »

could you add a setter for wing size launched from a launch bay?

Sorry! Not that simple, unfortunately. Your best bet might be something like how ReserveWingStats does it but with a very very long duration for the replacement fighters... and probably tracking the number of fighters with a script and fudging things as needed. Not 100% sure on the details or whether this could be *quite* made to emulate more fighters in a wing, though.

i was actually looking to decrease the amount of fighters in a wing. thanks though, going to stick with reducing launch bays to 1 and just having a less potent effect.
Logged

bananana

  • Commander
  • ***
  • Posts: 226
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9717 on: March 21, 2023, 05:44:27 PM »

Hmm - have you tried TooltipMakerAPI.showCargo()? It's intended as the addShipList() equivalent for cargo.
i did, and it works, and i was using it quite a lot before asking
however, unlike addShipList, it does not produce an info tooltip on mouse hover
unless there's some extended option or method to allow that
nor does it allow to choose the icon size
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Ontheheavens

  • Commander
  • ***
  • Posts: 134
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9718 on: March 22, 2023, 10:11:08 AM »

Having some issues with my mod and thought it might be of some interest.
Spoiler
Spoiler
70396 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.ClassCastException: com.fs.starfarer.campaign.BaseLocation$LocationToken cannot be cast to com.fs.starfarer.campaign.BaseCampaignEntity
java.lang.ClassCastException: com.fs.starfarer.campaign.BaseLocation$LocationToken cannot be cast to com.fs.starfarer.campaign.BaseCampaignEntity
   at com.fs.starfarer.campaign.BaseLocation.getEntityById(Unknown Source)
   at fleetjour.scripts.panel.Common.findTargetEntity(Common.kt:85)
[close]

What basically happens is that I fetch SectorEntityToken ID of the system's center through getCenter(); store this ID in field of my class, and then fetch SectorEntityToken by this ID through public SectorEntityToken getEntityById(String var1).

BUT. If the star system in question is a nebula, it has LocationToken as its center, while getEntityById method has this code:

Code
        if (this.idToEntity.containsKey(var1)) {
            BaseCampaignEntity var2 = (BaseCampaignEntity)this.idToEntity.get(var1);
            if (var2.getContainingLocation() != null && var2.getContainingLocation().getAllEntities().contains(var2)) {
                return var2;
            }
        }
[close]
And that is the source of my crash right there, since LocationToken doesn't cast to BaseCampaignEntity. The question is: is this a vanilla implementation shortcoming or am I simply doing it wrong? I'm able to get rid of the crash by retrieving star of the system instead of its center, so it's nothing major - just putting this out there.

A little follow-up for these damned nebulas and their goddamned LocationToken centers: Misc.getDistanceToPlayerLY() produces NPE when passed nebula center SET in unexplored system and player fleet SET sitting in another star system.

Spoiler
Code
104820 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.api.util.Misc.getDistanceToPlayerLY(Misc.java:594)
at fleetjour.scripts.panel.EntitySelectorPanel.shouldNotDisplayByDistance(EntitySelectorPanel.kt:176)
at fleetjour.scripts.panel.EntitySelectorPanel.createEntitiesSelector(EntitySelectorPanel.kt:135)
at fleetjour.scripts.panel.WriterPanelAssembly.renderEntitiesContainer(WriterPanelAssembly.kt:186)
at fleetjour.scripts.panel.WriterPanelAssembly.assemblePanel(WriterPanelAssembly.kt:94)
at fleetjour.scripts.EntryWriter.createLargeDescription(EntryWriter.kt:96)
[close]

Not asking anything since I can probably solve this by cramming more checks in the code, just thought this could be worth looking at.

Edit: examination with a debugger reminded me that I'm actually working here with a nebula's star, and ID of said star, when passed as an argument to the infamous getEntityByID(), returns null. In other words, idToEntity HashMap of the nebula does not contain the object that is held in the "star" field of the nebula star system instance.

The more I look at this, the more I get a feeling that this is me making some stupid mistake. Wouldn't turn down a help.

Edit 2: managed to butcher my way through the issue with obscene amounts of dirty checks, though I'm sure it will break eventually because of some case I did not foreseen. What's unfortunate is that I cannot make it any less hacky because API seems to behave in... remarkable ways.
« Last Edit: March 22, 2023, 11:28:51 AM by Ontheheavens »
Logged
   

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9719 on: March 22, 2023, 06:16:50 PM »

Get the nebula's center, not its star, then get the hyperspace anchor, then get LY dist of that to the player.
Logged
Pages: 1 ... 646 647 [648] 649 650 ... 706