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 ... 492 493 [494] 495 496 ... 706

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

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7395 on: May 15, 2021, 04:45:31 AM »

Has DELIVER_CREW (and a bunch of other assignments I tried, including ORBIT_PASSIVE, FOLLOW and INTERCEPT) stopped working as a way to tell a fleet to go to player fleet in another star system?

Looks like it has, yeah - the AI no longer "knows" what location the player is in unless it's seen them jump. It freezing up when the player is in-system is a bug, though; fixed up that aspect of it.

If this is intended, what's the new assignment to order a fleet to go to player in a different system (preferably without stopping to engage random enemies along the way)?

I don't think any assignment would help; the only thing that comes to mind is creating a location token and making that stick to the player fleet via a script.
Thanks; worked something out with a location token.
Although it might be nice to have an easy way for fleets to cheat and know where the destination fleet is anyway, perhaps based on assignment type (the DELIVERs) or a memory flag?

Quote
- Can the Janus jump destination window be repurposed for another feature?
I believe so - IIRC it's a pretty configurable way to let the player pick some kind of entity. It's even possible to have multiple entities per star system; they're shown in a dropdown).

See: GateCMD.selectDestination() for the vanilla implementation of the plugin it takes.
Wow this is great, thanks! Only thing it needs is an arg to have the location highlight be configurable (possibly allowing multiple highlights) instead of always being at the player's current location, and maybe optionally drawing an arrow line (intel screen style) between them.

Quote
EDIT 2: Bug report. If you add a button to the TooltipMakerAPI created by a beginImageWithText call, the button doesn't respond to mouse input.

Did you call .setForceProcessInput(true) on that TooltipMakerAPI?
That makes the button react to mouse input, but clicking it does nothing, in that IntelInfoPlugin.buttonPressConfirmed etc. don't get called.
(I considered working around this by putting it in a custom panel whose plugin would handle the input, but wasn't sure how to do the intel confirmation prompts)

Might be related to the bug reported for 0.9.1 where buttons within a custom panel didn't do anything?

Tried adding a ship to the game and came out with this error, wanted to see if anyone had any pointers as to what i've done wrong

at com.fs.util.Object.Object(Unknown Source)
   at com.fs.util.Object.Ô00000(Unknown Source)
   at com.fs.graphics.TextureLoader.String(Unknown Source)
   at com.fs.graphics.TextureLoader.super(Unknown Source)
   at com.fs.graphics.TextureLoader.super(Unknown Source)
   at com.fs.graphics.TextureLoader.super(Unknown Source)
   at com.fs.graphics.H.o00000(Unknown Source)
   at com.fs.starfarer.loading.ResourceLoaderState.init(Unknown Source)
   at com.fs.state.AppDriver.begin(Unknown Source)
   at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher.o00000(Unknown Source)
   at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
At a guess, your ship sprite hasn't been assigned correctly.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7396 on: May 15, 2021, 10:16:30 AM »

So if officer_manager is commented out in the events.json

Does that mean officer_manager can no longer be touched or is there an alternative way? A pity if so.  :-\

It's just added as a script now.

Although it might be nice to have an easy way for fleets to cheat and know where the destination fleet is anyway, perhaps based on assignment type (the DELIVERs) or a memory flag?

Hmm - if you set FleetAIFlags.SEEN_TARGET_JUMPING_FROM in the fleet's memory, to the ID of the current containingLocation, that may do the trick. But as soon as it jumped, it'd need to be re-set.

Wow this is great, thanks! Only thing it needs is an arg to have the location highlight be configurable (possibly allowing multiple highlights) instead of always being at the player's current location, and maybe optionally drawing an arrow line (intel screen style) between them.

Made a note.

Quote
EDIT 2: Bug report. If you add a button to the TooltipMakerAPI created by a beginImageWithText call, the button doesn't respond to mouse input.

Did you call .setForceProcessInput(true) on that TooltipMakerAPI?
That makes the button react to mouse input, but clicking it does nothing, in that IntelInfoPlugin.buttonPressConfirmed etc. don't get called.
(I considered working around this by putting it in a custom panel whose plugin would handle the input, but wasn't sure how to do the intel confirmation prompts)

Might be related to the bug reported for 0.9.1 where buttons within a custom panel didn't do anything?

Ah yes, you're right! The fix there only applied CustomPanelAPI.createUIElement(), not TMAPI.beginImageWithText(). Basically these just needed to pass through the button action listener; fixed it up.
Logged

Special_Eddies

  • Ensign
  • *
  • Posts: 2
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7397 on: May 15, 2021, 11:17:40 AM »

Wasn't that but i figured it out, i was making a phase vessel and didn't realize that it needed glow images, so i made them for the ship, now it works perfectly

thanks for the assist though, now once i get home im gonna draw up some ship sprites and use what i make
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7398 on: May 16, 2021, 02:20:25 PM »

Is there some way to modify a fighters target (for either attacking or defending)? I tried setting it via their ShipAPIs with fighter.setShipTarget(otherShip.getShipTarget();, to seemingly no effect.
« Last Edit: May 16, 2021, 03:10:08 PM by shoi »
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 #7399 on: May 16, 2021, 03:25:23 PM »

Is it possible to do something like the Breach OnHitEffect with a BeamEffectPlugin?

Looking at the source it seems like it would be, but I'm wondering about the difference between when onHit is called vs advance. Specifically, onHit seems like it would be called once while advance is called the entire time the beam is firing.

Should I perform the armor calculation throughout the entire duration of the beam to have the same effect?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7400 on: May 16, 2021, 06:20:45 PM »

Is there some way to modify a fighters target (for either attacking or defending)? I tried setting it via their ShipAPIs with fighter.setShipTarget(otherShip.getShipTarget();, to seemingly no effect.

Hmm - you might try setting AIFlags.CARRIER_FIGHTER_TARGET in ship.getAIFlags(). I'm not 100% sure whether that would get overridden by the AI or not, though.

Is it possible to do something like the Breach OnHitEffect with a BeamEffectPlugin?

Looking at the source it seems like it would be, but I'm wondering about the difference between when onHit is called vs advance. Specifically, onHit seems like it would be called once while advance is called the entire time the beam is firing.

Should I perform the armor calculation throughout the entire duration of the beam to have the same effect?

I mean, it depends on what exactly you want to do! It's definitely possible. You might want to code it to only proc when the beam damage ticks, though.
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7401 on: May 16, 2021, 06:49:44 PM »

Is there some way to modify a fighters target (for either attacking or defending)? I tried setting it via their ShipAPIs with fighter.setShipTarget(otherShip.getShipTarget();, to seemingly no effect.

Hmm - you might try setting AIFlags.CARRIER_FIGHTER_TARGET in ship.getAIFlags(). I'm not 100% sure whether that would get overridden by the AI or not, though.

Is it possible to do something like the Breach OnHitEffect with a BeamEffectPlugin?

Looking at the source it seems like it would be, but I'm wondering about the difference between when onHit is called vs advance. Specifically, onHit seems like it would be called once while advance is called the entire time the beam is firing.

Should I perform the armor calculation throughout the entire duration of the beam to have the same effect?

I mean, it depends on what exactly you want to do! It's definitely possible. You might want to code it to only proc when the beam damage ticks, though.

How would I set the target? Would I use

setFlag(ShipwideAIFlags.AIFlags flag, float duration, java.lang.Object custom)

With custom being  the CombatEntity?
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 #7402 on: May 16, 2021, 06:54:41 PM »

Sorry to double post, but this is separate enough from the earlier inquiry to warrant it I think:

I've been digging into the skills code for a bit now, and something really confuses me about the implementation of edits to MutableShipStatsAPI from either the ship itself or its equipped wings.

Notably: Strike Commander edits stats directly from apply and unapply at level 2 and 4 respectively. Normally, this applies to the officered ShipAPI directly and not the wings. An example of an alternate implementation to impact wings would be something like:

Code
            ShipAPI ship = null;
            if (stats.getEntity() instanceof ShipAPI) {
                ship = (ShipAPI) stats.getEntity();
            } else {
                return;
            }
            for (ShipAPI fighter : getFighters(ship)) {
                if (fighter.isHulk()) continue;
                MutableShipStatsAPI fStats = fighter.getMutableStats();

                fStats.getDamageToFighters().modifyMult(id, DAMAGE_MULT);
                fStats.getDamageToMissiles().modifyMult(id, DAMAGE_MULT);
                fStats.getDamageToCruisers().modifyMult(id, DAMAGE_MULT);
                fStats.getDamageToCapital().modifyMult(id, DAMAGE_MULT);
            }

So why do some skills only effect the ship itself and some only effect the wings? The implementation seems the same. I must be missing something, but I've tested the behavior and it holds true to the description.



I mean, it depends on what exactly you want to do! It's definitely possible. You might want to code it to only proc when the beam damage ticks, though.

Basically I want to replace the effects of High Scatter Amplifier to increase beam damage to armor directly rather than just damage. I would base this off of the beams dps per fire. So outside of the obvious edits to the damage calculation, I was wondering how often I would have to call the calculation from BeamEffectPlugin. I'm assuming every time advance is called but I haven't tested out any implementations yet.

(For instance, setForceHardFlux(true) only needs to be called once afaik. I'd think this would be different but I'm not 100% sure.)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7403 on: May 16, 2021, 07:00:37 PM »

How would I set the target? Would I use

setFlag(ShipwideAIFlags.AIFlags flag, float duration, java.lang.Object custom)

With custom being  the CombatEntity?

That sounds right, yeah.

So why do some skills only effect the ship itself and some only effect the wings? The implementation seems the same. I must be missing something, but I've tested the behavior and it holds true to the description.

See for example point_defense.skill:

{"type":"SHIP", "script":"com.fs.starfarer.api.impl.campaign.skills.PointDefense$Level1"},
{"type":"SHIP", "script":"com.fs.starfarer.api.impl.campaign.skills.PointDefense$Level2"},
{"type":"SHIP_FIGHTERS", "script":"com.fs.starfarer.api.impl.campaign.skills.PointDefense$Level1"},
{"type":"SHIP_FIGHTERS", "script":"com.fs.starfarer.api.impl.campaign.skills.PointDefense$Level2"},

Note how it's even able to apply the same effect both to the ship and to its fighters.
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 #7404 on: May 16, 2021, 07:48:47 PM »

See for example point_defense.skill:

{"type":"SHIP", "script":"com.fs.starfarer.api.impl.campaign.skills.PointDefense$Level1"},
{"type":"SHIP", "script":"com.fs.starfarer.api.impl.campaign.skills.PointDefense$Level2"},
{"type":"SHIP_FIGHTERS", "script":"com.fs.starfarer.api.impl.campaign.skills.PointDefense$Level1"},
{"type":"SHIP_FIGHTERS", "script":"com.fs.starfarer.api.impl.campaign.skills.PointDefense$Level2"},

Note how it's even able to apply the same effect both to the ship and to its fighters.

Ah ok that makes more sense thanks! I was looking in the wrong file (stats script itself) and probably originally thought that was more for category reference purposes and/or description related things.
Logged

HungwellHamburger

  • Ensign
  • *
  • Posts: 7
    • View Profile
Thoughts on salvage and how it should be balanced.
« Reply #7405 on: May 16, 2021, 08:32:57 PM »

Would it be possible to limit or prohibit a player from salvaging stations, ships, planetary ruins, etc. based on acquired knowledge and beliefs or whatever, which I was thinking could be handled in the same way as blueprints, or acquired directly through player skills in the appropriate trees.
My thinking was that it makes little sense that your average scavver knows his way around high-tech ships well enough to not destroy the more delicate bits, and a Pather would be more inclined to blow it to bits then accept it for their own use. This could be extended to faction ships, where someone commissioned to a specific faction knows how to disengage self-destruct protocols or whatever. In the reverse, a white-glove TT exec wouldn't stoop to feeding off of pirate scrap, and would likely blow it up due to having no familiarity with jury-rigged starship gear.

I'm currently working on ways of making pure scavenger runs more white-knuckle, starting with experimenting with everything Derelict, that's something I could conceivably do on my own starting out and pounding my head against a wall, but I dont know how to answer the first questions and this one; Would players even find this fun?

EDIT: Its occured to me that alot of these could be player RP choices for those disciplined enough to follow them, so I suppose the question is whether or not this could be made interesting in a gameplay sense, my thought is yes. Although to make this question more appropriate for the thread...

Can individual nodes in the skill tree be treated as branching trees, programatically speaking, each one a mini-skill tree dedicated to the main node. It could use story points or literally any other rebalance of skill points. The actual selection could be handled in the same way that officer promotions are handled.
« Last Edit: May 18, 2021, 12:21:11 PM by HungwellHamburger »
Logged

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7406 on: May 17, 2021, 06:38:05 AM »

Hello Alex, just wanted to verify a changed mechanic here.

Submarket contents are refreshed when player docks via "updateCargoPrePlayerInteraction". In 0.9.1a the submarket was considered "stale" if it last has updated in previous months (even if it was visited on the last day of the month). In 0.95a this seems to be behaving differently, and each market has been given its own cooldown. It seems to be updating circa 30 days after last update has happened which is a great change.

Is this correct, and what is the grace period between the updates?

Just read more of BaseSubmarketPlugin - all is there.
« Last Edit: May 17, 2021, 08:07:43 AM by Jaghaimo »
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 #7407 on: May 17, 2021, 03:54:41 PM »

Is it possible to do something like the Breach OnHitEffect with a BeamEffectPlugin?

I have this mostly working as intended (I think anyway - haven't tested all the beams just the mining laser) with one major problem. It will still damage the armor through shields when the beam is hitting a shield. I also haven't checked what happens when the beam is damaging multiple targets at once since it passes through fighters and missiles.

Anyway, how do I acquire the boolean that determines whether the damage this tick of advance was on a shield? It is passed into the OnHitEffectPlugin's onHit method: boolean shieldHit but not BeamEffectPlugin.

I've already checked the beam target's ShieldAPI and nothing seems useful there. Can I somehow get it from the combat engine? Not very familiar with it other than adding custom data.


Nvm there is a section of the TachyonLanceEffect that does this since it can penetrate shields. Back to testing then.  :)

Full code so far:
Spoiler
public class ArcheusBeamHardFluxEffect implements BeamEffectPlugin {

   private boolean done = false;

    private static final Logger LOG = Global.getLogger(ArcheusBeamHardFluxEffect.class);
   
   public void advance(float amount, CombatEngineAPI engine, BeamAPI beam) {

        if (beam.getSource().getVariant().hasHullMod("archeus_high_scatter_amp")) {
            dealArmorDamage(beam, amount);
        }

      if (done) return;
      beam.getDamage().setForceHardFlux(true);
      done = true;
   }

    public static void dealArmorDamage(BeamAPI beam, float amount) {
        CombatEngineAPI engine = Global.getCombatEngine();
        ShipAPI target;
        Vector2f point;
        if (beam.getDamageTarget() instanceof ShipAPI){
            target = (ShipAPI) beam.getDamageTarget();
        } else {
            LOG.info("Target wasn't a ship.");
            return;
        }
        if (beam.didDamageThisFrame()) {
            point = beam.getTo();
        } else {
            LOG.info("Beam did not do damage this frame.");
            return;
        }

        boolean hitShield = target.getShield() != null && target.getShield().isWithinArc(beam.getTo());
        if (hitShield) return;

        ArmorGridAPI grid = target.getArmorGrid();
        int[] cell = grid.getCellAtLocation(point);
        if (cell == null) return;

        int gridWidth = grid.getGrid().length;
        int gridHeight = grid.getGrid()[0].length;

        float damageTypeMult = DisintegratorEffect.getDamageTypeMult(beam.getSource(), target);

        // Damage this round of 'advance' multiplied by the High Scatter Amplifier hullmod's bonus multiplier.
        // This way the bonus to the beam's armor penetration scales based upon the original stat.
        // This prevents the hullmod from being more valuable on kinetic beams than standard beams due to a flat bonus.
        // Assumption: HE beams like the Terminator would have already destroyed the armor cell in the majority of cases. Bonus impact low.
        float bonusDamageBeforeAdjustments = beam.getDamage().computeDamageDealt(amount) * ArcheusHighScatterAmp.ARMOR_DAMAGE_MULTIPLIER;

        // Apply damage over nearby armor cells.
        float damageDealt = 0f;
        for (int i = -2; i <= 2; i++) {
            for (int j = -2; j <= 2; j++) {
                if ((i == 2 || i == -2) && (j == 2 || j == -2)) continue; // skip corners

                int cx = cell[0] + i;
                int cy = cell[1] + j;

                if (cx < 0 || cx >= gridWidth || cy < 0 || cy >= gridHeight) continue;

                float damMult = 1/30f;
                if (i == 0 && j == 0) {
                    damMult = 1/15f;
                } else if (i <= 1 && i >= -1 && j <= 1 && j >= -1) { // S hits
                    damMult = 1/15f;
                } else { // T hits
                    damMult = 1/30f;
                }

                float armorInCell = grid.getArmorValue(cx, cy);
                float damage = bonusDamageBeforeAdjustments * damMult * damageTypeMult;
                damage = Math.min(damage, armorInCell);
                if (damage <= 0) continue;

                target.getArmorGrid().setArmorValue(cx, cy, Math.max(0, armorInCell - damage));
                damageDealt += damage;
            }
        }

        if (damageDealt > 0) {
            if (Misc.shouldShowDamageFloaty(beam.getSource(), target)) {
                engine.addFloatingDamageText(point, damageDealt, Misc.FLOATY_ARMOR_DAMAGE_COLOR, target, beam.getSource());
            }
            target.syncWithArmorGridState();
        }
    }
}
[close]
Logged

Retry

  • Captain
  • ****
  • Posts: 420
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7408 on: May 17, 2021, 09:20:51 PM »

Is there a way to arbitrarily adjust weapon RoF to specific weapons through a hullmod, but without blanket changes via applyEffectsBeforeShipCreation stat change?

I'm trying to make a hullmod whose effects should only apply to energy projectile weapons, and not touch beams whatsoever.  There's mutable stats that separate Beam and Energy weapons for the purpose of damage and flux consumption, but not for Rate of Fire.  I found a way to set arbitrarily ammo charge rates using advanceInCombat (projectile-based charge weapons like Autopulse receive a reduced charge rate, while beam-based Burst PD is unaffected), but I don't know if I can do base Fire Rate from a similar method?  If I use getEnergyRoFMult().modifyMult in applyEffectsBeforeShipCreation instead, the charge rate for burst Beams like Phase Lance will be impacted, which is not desired.

(Sorry, code's a bit of a mess; it's been a long day)
Logged

shoi

  • Admiral
  • *****
  • Posts: 650
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7409 on: May 17, 2021, 11:41:57 PM »

Is there any way to change the location of a launch bay in combat? Like making a fighter wing (appear) to take off/land somewhere other than its mother ship?
Logged
Pages: 1 ... 492 493 [494] 495 496 ... 706