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 ... 490 491 [492] 493 494 ... 706

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

briansd9

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7365 on: May 06, 2021, 09:36:00 PM »

I'm making something to keep a log of all my fights:
 


Would the potentially unbounded amount of non-expiring intel items and stored data (each logged battle adds ~40 KB of XML, 5.7 MB in this save) be a performance concern?

Logged

Stealth

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7366 on: May 07, 2021, 03:57:29 AM »

,
« Last Edit: May 24, 2021, 06:42:41 AM by Stealth »
Logged
"it is what it is"  ~me every 30 seconds

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7367 on: May 08, 2021, 03:07:35 AM »

Is there any kind of weapon hint that allows a beam weapon to ignore range bonuses? Kind of like the cyroflamers "unaffectedByProjectileRangeBonuses" ?
Logged

Alex

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

Spoiler
If I check for Global.getSector().getPlayerFleet().getBattle() being null, is that a reliable way of ensuring the player fleet is not currently in combat when the script is running? Or is there a way to do that at all?

Context:
I'm testing out a skill that changes OP costs for bombers by adding/removing a hullmod. I am trying to prevent an exploit where the player sets his/her character on a ship, assigns the extra OP - and then assigns the character to another ship. I am handling this by simply removing all non-built in fighters (assuming clearing the list even does that) and returning the wings back to the player's inventory.

But! I don't want to do that if the player is switching flagships in combat because the AI ship would lose all the wings (is the theory). I only want this to occur if the player is in the refit screen - with the reasoning that once the battle is over the player character is in the same flagship as when the battle started even they switch ships during battle.


Warning: DO NOT TRY THIS!

*EDIT*

Errr, ok it looks like "apply" and "unapply" are both called when you change the piloted ship in the refit screen??

I have:                 ship.getVariant().clear();

under "unapply"

 - And when I switch ships it immediately clears the variant of the ship I'm switching to rather than the one I am switching from. So I'm pretty confused at this point haha.  ;D

*EDIT 2*
Ok yikes yeah the behavior is really inconsistent. Sometimes it calls:                ship.getVariant().removePermaMod("archeus_warship_bays_high");

 - and sometimes it doesn't. It also clears the variant but doesn't seem to update the UI or finalize things until moving to a different screen? So if I switch to a different ship with my character it clears the variant and adds the hullmod - if I immediately switch to another ship it sometimes preserves the variant and sometimes doesn't but it seems to consistently remove the hullmod.

However, if I switch to a ship and then go out of the refit screen then it finalizes the variant clear and updates the UI - but if I switch again it doesn't remove the hullmod.
[close]

Sorry for the late response - yeah, unapply() and apply() will both be called.

Just in general, this seems like a bad idea - I'd suggest trying to find a different way to express the skill. As, yeah, things that change OP costs based on what pilot is currently on the ship - that's asking for trouble, basically.

(I'm not sure why you'd be tracking/doing this *in combat*, though.)


I'm making something to keep a log of all my fights:
 
...

Would the potentially unbounded amount of non-expiring intel items and stored data (each logged battle adds ~40 KB of XML, 5.7 MB in this save) be a performance concern?

Cool! ... but, yeah, that'd be a huge problem. I mean, how many battles is the player going to have in a playthrough? For a longer one, the answer could easily be "hundreds" and then we're talking a huge amount of added savefile size, memory requirements, game save/load time, etc. I'd suggest limiting it to the last 10 battles or something (perhaps unless the player flags it as "important"), combined with trying to compress the per-battle data.


Is there any kind of weapon hint that allows a beam weapon to ignore range bonuses? Kind of like the cyroflamers "unaffectedByProjectileRangeBonuses" ?

Ah, I don't believe so. For the cryoflamer, btw, it's "unaffectedByProjectileSpeedBonuses", not range. (Reason that's there is increased projectile speed ruins the visual cohesion of the flame...)
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3010
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7369 on: May 09, 2021, 04:26:23 PM »

Is it possible to tell an AI fleet to search for a salvage entity like it does for the player who breaks contact?
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7370 on: May 10, 2021, 11:34:18 AM »


Ah, I don't believe so. For the cryoflamer, btw, it's "unaffectedByProjectileSpeedBonuses", not range. (Reason that's there is increased projectile speed ruins the visual cohesion of the flame...)

whoops, broke my own weapon. Thanks for letting me know!

Also, with Reserve Deployment: what makes the replacement rate instantly decrease on use of the ship system( Ex. When I used it with two claw lpcs at 100% replacement rate reduces it by 25%, to 75%)?
Code
	public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
ShipAPI ship = null;
if (stats.getEntity() instanceof ShipAPI) {
ship = (ShipAPI) stats.getEntity();
} else {
return;
}

if (effectLevel == 1) {
for (FighterLaunchBayAPI bay : ship.getLaunchBaysCopy()) {
if (bay.getWing() == null) continue;

bay.makeCurrentIntervalFast();
FighterWingSpecAPI spec = bay.getWing().getSpec();

int addForWing = getAdditionalFor(spec);
int maxTotal = spec.getNumFighters() + addForWing;
int actualAdd = maxTotal - bay.getWing().getWingMembers().size();
actualAdd = Math.min(spec.getNumFighters(), actualAdd);
if (actualAdd > 0) {
bay.setFastReplacements(bay.getFastReplacements() + addForWing);
bay.setExtraDeployments(actualAdd);
bay.setExtraDeploymentLimit(maxTotal);
bay.setExtraDuration(EXTRA_FIGHTER_DURATION);
}
}
}
}
Is bay.makeCurrentIntervalFast() basically "do this instantly" and the replacement time needed to spawn the extra craft just occurs super fast, hence the immediate drop?
Logged

Alex

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

Is it possible to tell an AI fleet to search for a salvage entity like it does for the player who breaks contact?

Not directly - you'd have to write a custom assignment.

Also, with Reserve Deployment: what makes the replacement rate instantly decrease on use of the ship system( Ex. When I used it with two claw lpcs at 100% replacement rate reduces it by 25%, to 75%)?

It looks like you're looking at old code somehow. The latest code has this bit in it:
float rate = Math.max(minRate, bay.getCurrRate() - RATE_COST);
bay.setCurrRate(rate);
Logged

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7372 on: May 10, 2021, 11:50:28 AM »


Ah, I don't believe so. For the cryoflamer, btw, it's "unaffectedByProjectileSpeedBonuses", not range. (Reason that's there is increased projectile speed ruins the visual cohesion of the flame...)

whoops, broke my own weapon. Thanks for letting me know!

Also, with Reserve Deployment: what makes the replacement rate instantly decrease on use of the ship system( Ex. When I used it with two claw lpcs at 100% replacement rate reduces it by 25%, to 75%)?
Code
	public void apply(MutableShipStatsAPI stats, String id, State state, float effectLevel) {
ShipAPI ship = null;
if (stats.getEntity() instanceof ShipAPI) {
ship = (ShipAPI) stats.getEntity();
} else {
return;
}

if (effectLevel == 1) {
for (FighterLaunchBayAPI bay : ship.getLaunchBaysCopy()) {
if (bay.getWing() == null) continue;

bay.makeCurrentIntervalFast();
FighterWingSpecAPI spec = bay.getWing().getSpec();

int addForWing = getAdditionalFor(spec);
int maxTotal = spec.getNumFighters() + addForWing;
int actualAdd = maxTotal - bay.getWing().getWingMembers().size();
actualAdd = Math.min(spec.getNumFighters(), actualAdd);
if (actualAdd > 0) {
bay.setFastReplacements(bay.getFastReplacements() + addForWing);
bay.setExtraDeployments(actualAdd);
bay.setExtraDeploymentLimit(maxTotal);
bay.setExtraDuration(EXTRA_FIGHTER_DURATION);
}
}
}
}
Is bay.makeCurrentIntervalFast() basically "do this instantly" and the replacement time needed to spawn the extra craft just occurs super fast, hence the immediate drop?
For some reason your code is missing the reduce rate part. Are you using up to date API library reference?

And yes it immediately spawns current fighter. For this ship system it’s a one-off effect to force the set fast spawn able to spawn immediately, otherwise the additional fighters can only be spawned after current under construction fighter gets deployed.
Logged


Since all my mods have poor reputation, I deem my efforts unworthy thus no more updates will be made.

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7373 on: May 10, 2021, 02:30:44 PM »

haha, embarassing. I have an 0.91 install in the same directory as 0.95 and I probably opened up the working folder for it instead of the latest version. Thanks, either way!
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7374 on: May 10, 2021, 03:51:12 PM »

Sorry for the late response - yeah, unapply() and apply() will both be called.

Just in general, this seems like a bad idea - I'd suggest trying to find a different way to express the skill. As, yeah, things that change OP costs based on what pilot is currently on the ship - that's asking for trouble, basically.

(I'm not sure why you'd be tracking/doing this *in combat*, though.)

Np at all I know you are likely super busy after a new release.

And yeah I definitely came to that conclusion due to all the complications after implementing it. I might technically be able to get it to work, but the downsides (such as clearing variants which would be annoying/tedious for the player) make it not at all worth it.

The combat part was just because of the script being ran when a player switched flagships in combat. Its intended runtime was for the refit screen, but I was trying to make sure I accounted for all places it ran. Well, unless I'm misunderstanding something and there would be an obviously better way to do this or something like that.

I'm just going to have to come up with a different bonus of some kind.
Logged

ermacia91

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7375 on: May 11, 2021, 12:44:07 PM »

I am looking for a way to modify the way the Trade UI behaves (like adding a button for moving all objects, autosort, etc.). Has anyone been able to understand how is the UI being handled? Can't wrap my head around it, honestly.
Logged

ermacia91

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7376 on: May 11, 2021, 12:45:35 PM »

Also, is there a way to make the game very verbose about the actions for better understanding of its moving parts?
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7377 on: May 11, 2021, 01:22:58 PM »

I am looking for a way to modify the way the Trade UI behaves (like adding a button for moving all objects, autosort, etc.). Has anyone been able to understand how is the UI being handled? Can't wrap my head around it, honestly.
All UI is non-moddable (in obfuscated code, you are in for lots of pain if you want to play with it anyway). You can add listeners and perform some action in the background (see Grand Colonies), or implement some actions using Intel UI (see my mod, in signature), or use interaction plugin for dialog-based actions.

Also, is there a way to make the game very verbose about the actions for better understanding of its moving parts?
Edit `data/config/settings.json` and enable dev mode.
Logged

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7378 on: May 11, 2021, 01:31:51 PM »

How does the game handle replacement rate of a bay if I explicitly set it to below minimum?
Does it just bounce back magically? Or does it simply stop dropping from lost fighter ticks?

I ask this because in my Modern Carriers mod there is a hullmod Load Balancer that shifts the replacement rates around different bays. It strucks me when I think of the possibility of deliberately leaving a empty bay to fuel other bays’ replacement rate. If the game allows replacement rate lower than minimum for regular bays, there is some incentive to sacrifice a bay for other bays to remain peak replacement using such hull mod and provide some interesting strategies.
Logged


Since all my mods have poor reputation, I deem my efforts unworthy thus no more updates will be made.

ermacia91

  • Ensign
  • *
  • Posts: 3
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7379 on: May 11, 2021, 04:20:37 PM »

I was able to create a mod that autosorts my stuff with EveryFrameScript - would you be interested in using it?
Logged
Pages: 1 ... 490 491 [492] 493 494 ... 706