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: Codex Overhaul (05/11/24)

Pages: 1 ... 621 622 [623] 624 625 ... 714

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

Wyvern

  • Admiral
  • *****
  • Posts: 3805
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9330 on: November 02, 2022, 11:04:34 AM »

Fair enough, and thank you for taking a look! Here's your mini-mod; it makes resonator MRMs (and only resonator MRMs) mirror themselves when installed on the left side of a ship.

(I'd be inclined to suggest, as a possible quick & simple fix, adding a WeaponAPI.getOriginalSpec() method that, when someone calls ensureClonedSpec(), retains a reference to an original unmodified copy. Then use that when assembling the tooltip. ...But, well. I don't know what the actual code there looks like, and perhaps that's not actually quick or simple or even a relevant idea in the first place. Best of luck!)

Thank you, I really appreciate that! And, that's an excellent suggestion, I was caught up in making the tooltip render the mirrored weapon, but this is *way* simpler. Did it in about 5 minutes and verified that it works using your test mod :)

(Can I just say, this is super cool? I mean, I've seen this before and I think we've talked about some of the details, but it's just so neat that this is even possible and that it works so cleanly!)
You can! I'd even say you did. Also, thank you, and thank you for fixing this! (For now, I guess I just won't mirror asymmetrical missile launchers in turret mounts unless someone goes into a config file and checks off 'do this thing that breaks graphics in some tooltips'.)
Logged
Wyvern is 100% correct about the math.

Liral

  • Admiral
  • *****
  • Posts: 724
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9331 on: November 02, 2022, 11:43:42 AM »

(Sorry! There's only so much deep-dive digging I can reasonably do, especially when it's to do with stuff that's not in the API and is being used in complicated ways and isn't easy for me to reproduce etc etc etc. If I know something offhand or something jumps out, I'm happy to answer, but if I don't, this kind of thing can get inordinately time-consuming.)

Aw, ok.  I have added the try-catch block to a hotfix I released yesterday, keeping the crash from happening, and will inform the Scy author about the bug and ask him to help me narrow its possible causes.  If I find something clearer, I will let you know.

(Meanwhile, I of all modders should wish to leave you free to develop your next release because I am eagerly awaiting its API improvements to replace (at least some of) my black magic!  ;D)

Best wishes, Alex.  :)

vicegrip

  • Commander
  • ***
  • Posts: 201
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9332 on: November 04, 2022, 11:34:02 PM »

Is there a way to access the modid string of a hullmod from the hullmod's corresponding class file? For example if a hullmod has the id "advanced_reactor" is it possible to extract that string as a variable inside the AdvancedReactor class? I'm guessing it involves the HullModSpecAPI getId() method but I don't know how to call it properly.

Thanks for the help.

Ruddygreat

  • Admiral
  • *****
  • Posts: 529
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9333 on: November 05, 2022, 12:24:17 PM »

Is there a way to access the modid string of a hullmod from the hullmod's corresponding class file? For example if a hullmod has the id "advanced_reactor" is it possible to extract that string as a variable inside the AdvancedReactor class? I'm guessing it involves the HullModSpecAPI getId() method but I don't know how to call it properly.

Thanks for the help.

the id field in applyEffectsBeforeShipCreation & applyEffectsAfterShipCreation are the hullmod's id

Inventor Raccoon

  • Captain
  • ****
  • Posts: 452
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9334 on: November 05, 2022, 02:01:58 PM »

Is there a way to access the modid string of a hullmod from the hullmod's corresponding class file? For example if a hullmod has the id "advanced_reactor" is it possible to extract that string as a variable inside the AdvancedReactor class? I'm guessing it involves the HullModSpecAPI getId() method but I don't know how to call it properly.

Thanks for the help.
In addition to Ruddy's comment, BaseHullMod also includes a "spec" variable which is set to the HullModSpecAPI of the hullmod it belongs to. You can then grab that spec's ID with the method you mentioned.
Logged

WiC2021

  • Ensign
  • *
  • Posts: 18
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9335 on: November 05, 2022, 11:29:21 PM »

Does anyone know or have an example of a shipsystem that lets you choose where a pd_drone will spawn based on cursor position? Sort of like how the Doom mine strike works?

« Last Edit: November 06, 2022, 07:14:19 AM by WiC2021 »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24248
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9336 on: November 06, 2022, 05:06:59 PM »

(Apologies for the delay in responding, everyone! Been a busy couple of days with IRL stuff, not bad just busy.)

Yeah, they probably just don't know how to handle it. They DO avoid it though! They raise shields, phase away-but they never prioritize it above anything theyre fighting.
I thought the mines the volatile rift beam or whatever that omega weapon is called had this type of colissionclass, though? (It DOES spawn mines, right?)

Oh yeah, you're right about that. And they're CollisionClass.NONE, too. I don't honestly remember how it all works; it's possible there's a half-measures bandaid in the AI to make it work just well enough for that specific use case or some such. Also I think the AI considers not the mine but the time until and the specs of the actual explosion?

I'll make an API request to expose the nebula manager further in a bit (as well as the clouds themselves), maybe.

Thank you!

You can! I'd even say you did. Also, thank you, and thank you for fixing this! (For now, I guess I just won't mirror asymmetrical missile launchers in turret mounts unless someone goes into a config file and checks off 'do this thing that breaks graphics in some tooltips'.)

*thumbs up*

Does anyone know or have an example of a shipsystem that lets you choose where a pd_drone will spawn based on cursor position? Sort of like how the Doom mine strike works?

Nothing comes to mind for me, at least as far as vanilla goes.
Logged

vicegrip

  • Commander
  • ***
  • Posts: 201
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9337 on: November 09, 2022, 11:03:51 AM »

the id field in applyEffectsBeforeShipCreation & applyEffectsAfterShipCreation are the hullmod's id

Thanks, that was so obvious once you mentioned it.

I have another hullmod related question. I am trying to make a new hullmod that's similar to converted hangar with fewer restrictions. At its most basic it just adds an extra hangar slot to any ship, even those that already have hangar bays. Everything works except with this one edge case where if a ship has hangar bays, equips the hullmod, adds a new fighter to that bonus slot, then removes the hullmod, the OP cost for the new fighter won't get refunded. And if the hullmod is re-added the fighter will pop up again. Does anyone have a solution to this? In the case with ships that don't already have fighter slots the fighter removal step seems to be handled by something else besides the hullmod class.

Audax

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9338 on: November 09, 2022, 12:34:18 PM »

is it possible to add a custom damage texture to a ship on hit that disappears after sometime? was wondering if I could copy the disintigrator effect and modify it but not sure if its intended for that

alaricdragon

  • Commander
  • ***
  • Posts: 165
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9339 on: November 09, 2022, 06:03:46 PM »

hello once again all.
i have a question regarding the submarkets, and doing things to ships within said submarkets.
so adding a hullmod to a ship within a submarket, works fine. ican see it there when you look at the ship. moveing the ship to my fleet, it still says it has the hullmod. but if i open the retrofit screen of that ship, the hullmod vanishes. i have no idea what i am doing wrong.
i know its not the hullmod doing it, as if i add it in the retrofit screen, it works as intended.
hullmod is 0 op cost, and is unlocked and not hidden
here is the code i use to add the hullmod:
Code
List<FleetMemberAPI> ships = market.getSubmarket("AIRetrofit_ShipyardSubmarket").getCargo().getMothballedShips().getMembersListCopy();
for(FleetMemberAPI ship : ships){
ship.getVariant().addMod("AIRetrofit_ShipyardBase");
}
thank you all again for all the kind help you have been willing to give me in the past. -me
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24248
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9340 on: November 11, 2022, 12:45:20 PM »

I have another hullmod related question. I am trying to make a new hullmod that's similar to converted hangar with fewer restrictions. At its most basic it just adds an extra hangar slot to any ship, even those that already have hangar bays. Everything works except with this one edge case where if a ship has hangar bays, equips the hullmod, adds a new fighter to that bonus slot, then removes the hullmod, the OP cost for the new fighter won't get refunded. And if the hullmod is re-added the fighter will pop up again. Does anyone have a solution to this? In the case with ships that don't already have fighter slots the fighter removal step seems to be handled by something else besides the hullmod class.

I'm not sure if that specific thing is addressable or not, but IIRC "not having to worry about edge cases of a similar nature" is part of why CH only works on ships with no fighter bays.

is it possible to add a custom damage texture to a ship on hit that disappears after sometime? was wondering if I could copy the disintigrator effect and modify it but not sure if its intended for that

Hmm - I mean, you could do something like that, I'm sure! Just a question of how much OpenGL code you're willing to writ to stencil a decal onto the hull.

hello once again all.
i have a question regarding the submarkets, and doing things to ships within said submarkets.
so adding a hullmod to a ship within a submarket, works fine. ican see it there when you look at the ship. moveing the ship to my fleet, it still says it has the hullmod. but if i open the retrofit screen of that ship, the hullmod vanishes. i have no idea what i am doing wrong.
i know its not the hullmod doing it, as if i add it in the retrofit screen, it works as intended.
hullmod is 0 op cost, and is unlocked and not hidden
here is the code i use to add the hullmod:
Code
List<FleetMemberAPI> ships = market.getSubmarket("AIRetrofit_ShipyardSubmarket").getCargo().getMothballedShips().getMembersListCopy();
for(FleetMemberAPI ship : ships){
ship.getVariant().addMod("AIRetrofit_ShipyardBase");
}
thank you all again for all the kind help you have been willing to give me in the past. -me

I'm not sure about the specific reason for the particular issue, but if you're going to make changes to a variant, you *need* to make sure that its VariantSource is REFIT and not e.g. STOCK. Otherwise you're going to change a global variant and affect all ships using it.

Basically, the process would be to make a copy of the variant using clone(), making changes to the copy, and setting the fleet member's variant to the copy. See the uses of ShipVariantAPI.clone() for some examples of code doing that.
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 529
  • Seals :^)
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9341 on: November 11, 2022, 01:52:33 PM »

Is there a way to get every loaded spriteAPI?
Getting worrily in-depth on a silly mod idea that'll let players "paint" in the combat layer w/ some opengl & allowing them to paste stickers arbitrarily through some extra menu would be a fun additon, though not essential well, none of it is but y'know.

Wyvern

  • Admiral
  • *****
  • Posts: 3805
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9342 on: November 11, 2022, 02:47:42 PM »

Is there any way to ensure a cloned ShipVariantAPI object from a MutableShipStatsAPI object?

For context: I'm trying to make a hullmod that replaces any vulcan cannons on fighters carried by a ship with fancy laser guns.

This means making a hullmod that implements applyEffectsToFighterSpawnedByShip(), which gives me a ShipAPI object for the fighter I'm working with.

ShipAPI has 'cloneVariant' and 'getVariant' methods, but making changes via ship.getVariant().addWeapon() does not actually change the fighters on the field.

If, instead, I get the ShipVariantAPI object via ShipAPI.getMutableStats().getVariant(), then changes I make apply... but they apply to all fighters on the field, rather than just the ones I tried to make changes to.

And/or, is there some other way I should be trying to do this?
Logged
Wyvern is 100% correct about the math.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24248
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9343 on: November 11, 2022, 03:31:55 PM »

Is there a way to get every loaded spriteAPI?
Getting worrily in-depth on a silly mod idea that'll let players "paint" in the combat layer w/ some opengl & allowing them to paste stickers arbitrarily through some extra menu would be a fun additon, though not essential well, none of it is but y'know.

I don't... think so?

Is there any way to ensure a cloned ShipVariantAPI object from a MutableShipStatsAPI object?

For context: I'm trying to make a hullmod that replaces any vulcan cannons on fighters carried by a ship with fancy laser guns.

This means making a hullmod that implements applyEffectsToFighterSpawnedByShip(), which gives me a ShipAPI object for the fighter I'm working with.

ShipAPI has 'cloneVariant' and 'getVariant' methods, but making changes via ship.getVariant().addWeapon() does not actually change the fighters on the field.

If, instead, I get the ShipVariantAPI object via ShipAPI.getMutableStats().getVariant(), then changes I make apply... but they apply to all fighters on the field, rather than just the ones I tried to make changes to.

And/or, is there some other way I should be trying to do this?

Hmm, I don't think that's going to work - the variant it's using for "what weapons are on the ship" (etc) is being passed around as a parameter in some internal methods, so you can't really get at that and change what it points to.

I'm not sure what the best way to do this might be. Perhaps spawning new fighters and quietly replacing the existing ones with them, from a script? It seems tricky, regardless.
Logged

Silveressa

  • Ensign
  • *
  • Posts: 23
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #9344 on: November 13, 2022, 02:33:15 AM »

Just wondering where the values for the fluff text and actual scripts are for the "deal with prisoners" skill/ability?

(Working on a mod that gives the option of trying to recruit prisoners either as crew or marines for credits, instead of torturing them into serving you.)
Logged
Pages: 1 ... 621 622 [623] 624 625 ... 714