Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95a is out! (03/26/21); Blog post: A Tale of Two Tech Levels (05/28/21)

Pages: 1 ... 490 491 [492] 493 494 ... 509

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

Morrokain

  • Admiral
  • *****
  • Posts: 1778
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7365 on: May 05, 2021, 03:54:42 PM »

1) I know WeaponSpecAPI is shared among all weapons of that spec. But I can't remember if WeaponAPI is - or if that is unique to the WeaponSlotAPI of the ShipAPI.

In other words, if I iterate through WeaponAPIs on a ship under the apply method of a skill, will it only affect that ship's weapons?

2) "apply" from implementing ShipSkillEffect is only ran once at the start of combat correct? It's not run every frame is it?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 18688
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7366 on: May 05, 2021, 04:00:04 PM »

Is there any way for a mod to interact with the ship refit screen (specifically the weapon group settings)?

I searched the API Doc but didn't find anything promising.

Ideally, I would like to add another GUI-element to that screen. But being able to listen for InputEvents and having access to the FleetMember-API would also do.

I don't believe this is possible, at least not easily. I don't *think* the information as to what fleet member is selected for refit is exposed at all.

Does Reinforced Bulkheads make enemy ships always recoverable? Without story points?

It should, but there've been some reports of "always recoverable" ships ending up in story recovery; not sure what might be going wrong there but it could also affect this sometimes.

1) I know WeaponSpecAPI is shared among all weapons of that spec. But I can't remember if WeaponAPI is - or if that is unique to the WeaponSlotAPI of the ShipAPI.

In other words, if I iterate through WeaponAPIs on a ship under the apply method of a skill, will it only affect that ship's weapons?

2) "apply" from implementing ShipSkillEffect is only ran once at the start of combat correct? It's not run every frame is it?

1) A WeaponAPI is made for the ship.
2) Neither! It's run whenever the ship's captain changes. So for example if you transfer command.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 1778
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7367 on: May 05, 2021, 04:04:41 PM »

1) A WeaponAPI is made for the ship.
2) Neither! It's run whenever the ship's captain changes. So for example if you transfer command.

Ah thanks and that answers my third question too - which was do I have to unapply WeaponAPI changes? - looks like is a definite yes.  :)
Logged

Retry

  • Captain
  • ****
  • Posts: 402
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7368 on: May 05, 2021, 09:41:30 PM »

Hello, once again I find myself trying to be too clever for my own good.

I'm currently trying to experiment with a hullmod that converts Phase Ships into conventional omni-shielded warships, where the stats of the shield is dependent on the stats of the original phase cloak.  I'm not entirely sure if it's actually feasible in practice (in terms of gameplay balance), but that's why I want to try it out.

I know going from shielded to phase is practically impossible since that requires glow sprites that normal ships don't have, but I've been having issues with getting the omni-shield part working in the first place, so I'm beginning to wonder if it's just my lack of experience or if going from phase->shields is also impossible.

I currently want to try making the shield's upkeep directly dependent on the ship's original cloak upkeep as the shield upkeep, use activation cloak cost efficiency (which is Activation Cost/Vent Rate iirc?) as part of a function to calculate shield efficiency, and the cloak cooldown time (or some other metric) to calculate shield arc (which doesn't matter much in Vanilla but might be relevant with mod-added ships).

The relevant part of the script is below, in the "ApplyEffectsAfterShipCreation" section:



(The exact formulas used for the shield attributes are WIP)

When used on an actual phase ship, it looks like this:



Some of the values look odd, but the new system stats in the UI appear as if it were a shielded vessel now.  However, the ship still functions like a phase ship when tested in battle; right clicking causes the modified Afflictor to phase instead of activate a shield despite the presence of the hullmod.  I thought it had something to do with the ridiculous flux upkeep from my messed-up formula, but when I switched it manually to a reasonable number (ex: 0.5f -> 50% shield dissipation), the Afflictor still Phases instead of Shields.  The shield part not working at all is currently the biggest roadblock, I'm not sure what I'm overlooking here, could I get a few pointers on how to get that part functioning (if it's possible at all)?

Additionally to that, is there a way to grab the base value (unmodified by officers, other hullmods, caps/vents, scripted battlefield shenanigans, etc) of attributes off a ship, such as:
-Phase Activation Cost & Phase Upkeep
-Flux Dissipation (can't find anything in the FluxTrackerAPI or ShipAPI, perhaps I'm looking in the wrong place?)
-Phase Cooldown (iirc there's a skill that reduces this, and I'd prefer that skills or hullmods not accidentally buff (or nerf) the shield conversion)
-[OPTIONAL] Getting the efficiencies directly, if possible (a lot of the ship.csv data for phase stuff is written as ratios already, so that'd allow me to simplify stuff slightly if I can pull them)

The current method I'm using from the ShipAPI grabs the current flux stats, which means currently means when I adjust certain attributes by, say, adding flux or vents, the shield's efficiency will change with it, which is extremely amusing but not intentional.  I was hoping there was a better way that I'm overlooking to do this, which is less volatile to external changes from other hullmods and officers?
Logged

ElPresidente

  • Commander
  • ***
  • Posts: 151
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7369 on: May 06, 2021, 12:43:43 AM »

I'm encountering several weird issues while fixing up an abandoned mod.

Namely, SOME ships cost 0CP to deploy in combat, despite having a defined Fleet Point cost and not being civillian. I checked, double-checked and tripple-checked the hull file and the ship_data and I can't find anything that would cause this.

Another issue is that a ship that should spawn with a built-in weapon does not. No errors, and I can see the weapon equipped on the ship in the codex. However, in actual combat the mount is empty. Weird.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 1778
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7370 on: May 06, 2021, 02:41:07 PM »

I'm encountering several weird issues while fixing up an abandoned mod.

Namely, SOME ships cost 0CP to deploy in combat, despite having a defined Fleet Point cost and not being civillian. I checked, double-checked and tripple-checked the hull file and the ship_data and I can't find anything that would cause this.

Make sure that "supplies/rec" is not 0 in ship_data. That is what determines DP - not fleet points. The weapon thing I'm not sure about. Maybe a script is at work there? Or also check for a skin file changing built in weapons if that were to exist.



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.
« Last Edit: May 06, 2021, 03:38:41 PM by Morrokain »
Logged

briansd9

  • Ensign
  • *
  • Posts: 19
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7371 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: 45
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7372 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

  • Captain
  • ****
  • Posts: 326
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7373 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: 18688
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7374 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: 2038
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7375 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

  • Captain
  • ****
  • Posts: 326
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7376 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: 18688
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7377 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: 670
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7378 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

shoi

  • Captain
  • ****
  • Posts: 326
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7379 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
Pages: 1 ... 490 491 [492] 493 494 ... 509