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 ... 488 489 [490] 491 492 ... 706

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

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7335 on: April 28, 2021, 10:46:18 AM »

Is there an easy way to check if a missile that hasn't been armed yet (the stage where you fire it but it basically bounces off stuff) has collided with something?

[...]

lol, this is brilliant. well, it works well enough, and checking if angular velocity is like 5 is enough to trigger reliably. Thanks!

I believe the angular velocity is in degrees/second, so 5°/s is actually not very much. I'd say somewhere around 90-180 starts counting as very high.


Not sure, sorry!


I might have to get an IDE running on my Windows machine then...
Thanks anyways =)


ship.getMutableStats().getAutofireAimAccuracy().getModifiedValue()

Range is something like -0.5 to 1.

1f means aim at the correct predicted point. 0 means assume shots are twice as fast as they actually are, so, lag behind the target a bit.

Of note: the vanilla autofire AI will improve its aim with time spent firing on the same target.

Awesome, that helps a lot! Thanks!
So, essentially,
Code
virtualProjectileSpeed = actualProjectileSpeed * (2-targetLeading)
I might use
Code
virtualProjectileSpeed = actualProjectileSpeed * (1.5 - targetLeading/2)
though, as my AIs are specific Fighters-Only and Missile-Only AIs and I feel like it makes sense that if your gunners only have to focus on one type of target they'll do a slightly better job at it.

Funnily enough, I hadn't even though of heavily encouraging weapons to stick to the same target. Turns out, when you do, weapons spend a lot less time erratically turning around and a lot more time actually firing xD

Hmm - are you mixing up acceleration and speed, maybe? The acceleration is a fixed value. The speed has a current and maximum value. Well, the speed doesn't really have a current value, the velocity does...
Ok, I guess I was just thinking too complicated xD
In "real world" physics, acceleration is the time-derivative of the velocity (in the same way that the velocity is the time derivative of the location) and thus a variable vector. But I agree, that's probably overkill for a (non-racing) game engine.
But that still answers my question: I think I simply won't include the acceleration into my target leading calculations xD

Thanks a bunch for all your answers! That certainly did help!

Edit: I pulled a sneaky edit on my post :P
« Last Edit: April 28, 2021, 11:15:49 AM by DesperatePeter »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7336 on: April 28, 2021, 10:59:34 AM »

Is there a way to add XP to marines in storage, that don't already have XP?

Like, when I have 200 marines with zero XP in cargo, I toss them in Jangala's storage, then call the following:
Code: java
runcode MarketAPI market = Global.getSector().getCampaignUI().getCurrentInteractionDialog().getInteractionTarget().getMarket();
com.fs.starfarer.api.impl.PlayerFleetPersonnelTracker.getInstance().getDroppedOffAt("marines", market.getPrimaryEntity(), market.getSubmarket("storage"), true).data.addXP(10000);
the stored marines still have no rank icons, and they dilute the XP of any marines I have in my own fleet.
But if it works if I earn some XP for those marines before storing them, they become elite after running that code.

Hmm, I'm not sure - that seems like it should work. Maybe put a breakpoint in getRankIconName() and see what's going wrong there?

Also: might be worth calling .update() after doing addXP(). I'm not 100% on the specifics, this was a while ago.

Ok, I guess I was just thinking too complicated xD
In "real world" physics, acceleration is the time-derivative of the velocity and thus a variable vector (e.g., if you drive a car and push the accelerator pedal to the max, your linear acceleration is higher than if you only push it 50%. Similarly, if you turn your steering wheel, you have a lateral acceleration, even if your linear speed doesn't change).
But that still answers my question: I think I simply won't include the acceleration into my target leading calculations xD
Thanks!

Yep!  (And, well, it's tough to press a keyboard button at 50% :) )
Logged

charmingthree

  • Ensign
  • *
  • Posts: 9
  • doomer zoomer
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7337 on: April 28, 2021, 11:55:53 AM »

don't know if this is the right place to ask but I've been wondering: would it be feasible to break up the worlds of the Independent faction into their own respective polities? or would it break the balance of the game if there's suddenly, like, nine more factions?
Logged

briansd9

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7338 on: April 29, 2021, 04:30:56 AM »

Is there a way to get the number of crew lost after a battle? Preferably on a per-ship basis, but per battle side would be OK too.

I've tried monitoring FleetMemberAPI.getCrewFraction(), but the value is the same before and after a battle.

I have found FleetEncounterContextPlugin.DataForEncounterSide.getCrewLossesDuringLastEngagem ent() in the API, but the only way I've found to get there is via BaseCampaignEventListener.reportEncounterLootGenerated(FleetEncounterContextPlugin plugin, CargoAPI loot), which seems not guaranteed to be called (no loot generated if you lose - is this correct?)
« Last Edit: April 29, 2021, 07:43:33 AM by briansd9 »
Logged

lethargie

  • Commander
  • ***
  • Posts: 183
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7339 on: April 29, 2021, 10:40:34 AM »

im trying to spawn a muzzle flash on a weapon from another weapon.

engine.spawnMuzzleFlashOrSmoke(weapon.getShip(),
                    weapon.getSlot(),
                    muzzleSource2,
                    counter,
                    weapAngle + currentAngle);

where weapon is the weapon calling advance on a everyframeeffect and muzzlesource2 is the weaponSpecApi of another weapon that has the same turret/barrel offset. On a hardpoint the flash seems to line up properly, but turreted has the muzzle flash with a strong offset from the actual position. Why?
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7340 on: April 30, 2021, 08:23:55 AM »

Figured out my problem with the marine XP, needed to set the personnel data's num as well as its XP.

New question: What would be the best way to make a faction (Remnants, specifically) chase a transponder-off, hostile player without knowing who the player is? Setting pirateBehavior flag in the faction file looks like it'd do the job, but with a bunch of side effects.

(This came up recently because Nex lets players be neutral or friendly to Remnants. Which works fine except when a player triggers a TransmitterTrapSpecial, which is currently bugged and doesn't actually make the responding fleet low-rep-impact.)

don't know if this is the right place to ask but I've been wondering: would it be feasible to break up the worlds of the Independent faction into their own respective polities? or would it break the balance of the game if there's suddenly, like, nine more factions?
Well, you'd need to do a lot of work to keep the subfactions synced in terms of blueprints they know, their relations with other factions, etc. etc. Really more work than I think it's worth without proper base game support.
(There's a 4chan mod that experimented with this, but I don't know how much progress it made)
« Last Edit: April 30, 2021, 08:26:32 AM by Histidine »
Logged

DesperatePeter

  • Commander
  • ***
  • Posts: 167
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7341 on: April 30, 2021, 10:08:53 AM »

Is it possible to somehow figure out which Ship has been selected in the Command UI (TAB-Key in Combat)?

Is it okay to redistribute the starfarer .jars? I was thinking about creating a Docker to build mods in the CI.
« Last Edit: April 30, 2021, 01:08:04 PM by DesperatePeter »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7342 on: April 30, 2021, 01:28:22 PM »

Is there a way to get the number of crew lost after a battle? Preferably on a per-ship basis, but per battle side would be OK too.

I've tried monitoring FleetMemberAPI.getCrewFraction(), but the value is the same before and after a battle.

I have found FleetEncounterContextPlugin.DataForEncounterSide.getCrewLossesDuringLastEngagem ent() in the API, but the only way I've found to get there is via BaseCampaignEventListener.reportEncounterLootGenerated(FleetEncounterContextPlugin plugin, CargoAPI loot), which seems not guaranteed to be called (no loot generated if you lose - is this correct?)

Hmm - you know what, I'm not actually sure. That is, I think you're right about the loot method not being called on defeat, but as to how to get at this, nothing comes to mind.

im trying to spawn a muzzle flash on a weapon from another weapon.

engine.spawnMuzzleFlashOrSmoke(weapon.getShip(),
                    weapon.getSlot(),
                    muzzleSource2,
                    counter,
                    weapAngle + currentAngle);

where weapon is the weapon calling advance on a everyframeeffect and muzzlesource2 is the weaponSpecApi of another weapon that has the same turret/barrel offset. On a hardpoint the flash seems to line up properly, but turreted has the muzzle flash with a strong offset from the actual position. Why?

Hmm - probably because the slot type of weapon and muzzleSourc2 doesn't match up? Hardpoints and turrets have different fire offsets.

New question: What would be the best way to make a faction (Remnants, specifically) chase a transponder-off, hostile player without knowing who the player is? Setting pirateBehavior flag in the faction file looks like it'd do the job, but with a bunch of side effects.

(This came up recently because Nex lets players be neutral or friendly to Remnants. Which works fine except when a player triggers a TransmitterTrapSpecial, which is currently bugged and doesn't actually make the responding fleet low-rep-impact.)

Hmm - am I missing something? Or did you mean "non-hostile"? Because I'm fairly sure they already chase transponder-off hostile players.


Is it possible to somehow figure out which Ship has been selected in the Command UI (TAB-Key in Combat)?

I don't think it's possible.

Is it okay to redistribute the starfarer .jars? I was thinking about creating a Docker to build mods in the CI.

Thank you for asking - ah, it's not ok, sorry.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7343 on: April 30, 2021, 06:39:52 PM »

New question: What would be the best way to make a faction (Remnants, specifically) chase a transponder-off, hostile player without knowing who the player is? Setting pirateBehavior flag in the faction file looks like it'd do the job, but with a bunch of side effects.

(This came up recently because Nex lets players be neutral or friendly to Remnants. Which works fine except when a player triggers a TransmitterTrapSpecial, which is currently bugged and doesn't actually make the responding fleet low-rep-impact.)

Hmm - am I missing something? Or did you mean "non-hostile"? Because I'm fairly sure they already chase transponder-off hostile players.
Yeah, they chase, but this is because they know who the player is. I want to make them no longer know the player's identity but continue to chase.
(Well, I don't think this is possible without side effects or manually issuing fleet assignments. Is it?)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7344 on: April 30, 2021, 08:43:21 PM »

Aaaah, right! Forgot about that, long time since I'd set that up. I don't think this is easily doable, no, but it's possible I'm not thinking of some combination of flags that would do it.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7345 on: May 01, 2021, 07:59:58 AM »

I'd like to alter the description of things (ship initially). Got the descriptionId from the ship hull, get the actual Description from Global.getSettings.getDescription, modify using setters and... nothing.

8 years ago the answer was no, is this possible (or could be made possible) now?

https://fractalsoftworks.com/forum/index.php?topic=7144
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7346 on: May 01, 2021, 10:05:20 AM »

Hmm - it seems like generally-speaking using setters for the text members should work (i.e. setText1() etc) but setting the type/id would absolutely not. I'm not sure exactly what you're trying to do - there are lots of possibilities here, i.e. I think what you're doing sounds very different than what the thread talks about? - so, need more info.
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7347 on: May 01, 2021, 11:49:34 AM »

I want to append a text to ship descriptions (as displayed when hovering over it in submarkets, or codex, etc.). I have a hull mod id, so:
        Description desc = Global.getSettings().getDescription(id, Type.SHIP); // is not null so I got it
And add my text to it:
        desc.setText1("Text 1"); desc.setText2("Text 2"); desc.setText3("Text 3");

And... NOW IT WORKED. Ah, only text1 is used in ship description ("Text 2" and "Text 3" does not show), and I was trying to use text3 before.
« Last Edit: May 01, 2021, 11:52:13 AM by Jaghaimo »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7348 on: May 01, 2021, 11:55:57 AM »

Ah! Yeah, which of those are used are specific to the description in question, they have a different meaning depending on context. (For example for weapons, text3 (I think?), if present, shows a "quote-style" description, that sort of thing.)
Logged

Sallymoronic

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7349 on: May 02, 2021, 01:26:27 AM »

Hello, new. Been messing around with a mod (BSG Revived) since I got the game. Adding the ships into my own game using the wikis modding guide. I've managed to get the ships to show as blueprints, the weapons as well. I can spawn the ships using their variants and they come fully locked and loaded. I have the ability to construct them at my colonies but my issue is the game isnt reading the variant files (more accurately I messed up somewhere and it *cant* read them) so these ships are included in patrol fleets but show as having no armament. I have the ships in the default_shiproles, that file is in the folders its meant to be in. Got the ship_data sorted, wings as well. Weapons_data, a-ok as far as I can see. I tagged all relevant ships and weapons as rare_bp rather than the bsg_bp tag it originally came with because I wasnt including the original mods faction in my universe.

And umm...dunno really, gone through all the ships in the shipeditor, made sure the variants are all lined up nice and neat. Sorry if this is a rambling mess, I havent ever fiddled with the guts of a mod (or made one) before. Any pointers would be helpful!
Logged
Pages: 1 ... 488 489 [490] 491 492 ... 706