Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 508 509 [510] 511 512 ... 710

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

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7635 on: June 28, 2021, 04:43:53 AM »

question
i have 2 small missile weapons with unlimited ammo - one for HE damage and one for KN - both have DO_NOT_AIM, DO_NOT_CONSERVE hints
i have a ship that can mount three small missile hardpoints and one universal turret
that ship has mounted 2 KN small missiles and one HE - all in the same group, linked
when ship is on autopilot it will only ever fire _one_ missile weapon at a time, and at about 50% of it's max fire rate
but as soon as i take control of the ship those three weapons all start to fire at maximum fire rate
why does this happen ?
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Cyan Leader

  • Admiral
  • *****
  • Posts: 718
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7636 on: June 28, 2021, 04:47:42 AM »

Is there an easy way to make the player be able to make unlimited permanent hullmods while limiting the number on AI fleets?
Logged

presidentmattdamon

  • Commander
  • ***
  • Posts: 249
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7637 on: June 28, 2021, 05:39:45 PM »

i have a hullmod that depends on some FleetMemberAPI values, and to get that i would usually use MutableShipStatsAPI.getFleetMember(). when i added a "affectsOPCosts" override set to true, the method applyEffectsBeforeShipCreation was called twice, and the second time has a MutableShipStatsAPI that doesn't have a fleet member assigned to it. (as a side note: i'm pretty sure this MutableShipStatsAPI object is the one that you can find under ShipVariantAPI.getStatsForOpCosts())

is there a way to easily get the fleetmember that doesn't involve looping through every single ship in a fleet and its variant and all of its modules' variants to look for a specific MutableShipStatsAPI object? if i have the hullmod on a lot of ships (tried with 8 ) the game noticably hitches whenever these hullmods run applyEffectsBeforeShipCreation because of the method.

this is what i needed to do as a result, and what also causes the hitching
Spoiler
Code
if(stats.getFleetMember() != null)
            return stats.getFleetMember();

        if(stats.getEntity() instanceof ShipAPI) {
            ShipAPI ship = (ShipAPI) stats.getEntity();
            if(ship.getFleetMember() != null) {
                return ship.getFleetMember();
            }
        }

        FleetMemberAPI fm = null;
        for(FleetMemberAPI member : Global.getSector().getPlayerFleet().getFleetData().getMembersListCopy()) {
            if(member.isFighterWing()) continue;

            if(member.getStats() == stats) {
                fm = member;
            } else if (member.getVariant().getStatsForOpCosts() != null) {
                if (member.getVariant().getStatsForOpCosts() == stats) {
                    fm = member;
                } else if (member.getVariant().getStatsForOpCosts().getEntity() != null && member.getVariant().getStatsForOpCosts().getEntity() == stats.getEntity()) {
                    fm = member;
                }
            }

            if(fm != null) break;

            if (member.getVariant().getModuleSlots() != null && !member.getVariant().getModuleSlots().isEmpty()) {
                for(String variantId : member.getVariant().getModuleSlots()) {
                    ShipVariantAPI variant = member.getVariant().getModuleVariant(variantId);
                    if(variant.getStatsForOpCosts() == stats) {
                        fm = member;
                    } else if (member.getVariant().getStatsForOpCosts().getEntity() != null && stats.getEntity() == variant.getStatsForOpCosts().getEntity()) {
                        fm = member;
                    }

                    if(fm != null) break;
                }
            }

            if(fm != null) break;
        }
[close]

i'm having an issue now where the fleet screen shows i have free OP after applying the hullmod through a dialog, but clicking into the refit screen does not show the free OP
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7638 on: June 29, 2021, 09:26:36 AM »

Is there any way to change characteristics of a wing in combat, such as reducing wing size?
I can do it using applyEffectsBeforeShipCreation, but only with the wingspec which affects every LPC

I think you *might* be able to use bay.setExtraDeploymentLimit(<negative value>). That may not work, though - if it doesn't then you probably can't.

Also, is it possible to give a ship fighter AI? It seems like part of what's needed for the FighterAI constructor is obfuscated
(The parameters are, IIRC, Ship, and .. 'L') so i'm guessing this is a no, but figured i'd double check

I don't think so, and if you could, that'd cause all sorts of problems. For example it wouldn't avoid ship collisions, might try to find a carrier to land on, and so on.

question
i have 2 small missile weapons with unlimited ammo - one for HE damage and one for KN - both have DO_NOT_AIM, DO_NOT_CONSERVE hints
i have a ship that can mount three small missile hardpoints and one universal turret
that ship has mounted 2 KN small missiles and one HE - all in the same group, linked
when ship is on autopilot it will only ever fire _one_ missile weapon at a time, and at about 50% of it's max fire rate
but as soon as i take control of the ship those three weapons all start to fire at maximum fire rate
why does this happen ?

I'm not really clear on what you're saying - what do you mean by "all start to fire at maximum fire rate"? Like... they wouldn't just do that on their own, so maybe you mean you're able to fire them that way?

Regardless, though, hmm... if the group is linked and you're 100% sure of that, the only way for one of the weapons to fire individually is if the group is on autofire. But that wouldn't explain why it's firing at half the rate - though exactly when it fires would be up to the autofire AI at that point. However, it should be easy for you to see whether the group is on autofire, what group the ship AI has selected, and so on. There's a lot more info here to be had.

Is there an easy way to make the player be able to make unlimited permanent hullmods while limiting the number on AI fleets?

Change "maxPermanentHullmods" to something high! For AI fleets, it's not limited by that value but rather by some directives at fleet creation.


i have a hullmod that depends on some FleetMemberAPI values, and to get that i would usually use MutableShipStatsAPI.getFleetMember(). when i added a "affectsOPCosts" override set to true, the method applyEffectsBeforeShipCreation was called twice, and the second time has a MutableShipStatsAPI that doesn't have a fleet member assigned to it. (as a side note: i'm pretty sure this MutableShipStatsAPI object is the one that you can find under ShipVariantAPI.getStatsForOpCosts())

is there a way to easily get the fleetmember that doesn't involve looping through every single ship in a fleet and its variant and all of its modules' variants to look for a specific MutableShipStatsAPI object? if i have the hullmod on a lot of ships (tried with 8 ) the game noticably hitches whenever these hullmods run applyEffectsBeforeShipCreation because of the method.

this is what i needed to do as a result, and what also causes the hitching

Hmm - have you considered just bailing out if stats.getFleetMember() and stats.getEntity() both return null? IIRC that would only happen in some edge cases and it's more of a safety precaution to check for this rather than a case where it's required for things to work.

(I'm not sold on this code causing hitching, btw, especially not if we're just talking about the player's fleet. The code you've pasted just isn't doing a substantial amount of work - it *might* be a problem if like several hundred ships in non-player-fleets all had this mod and had it applied at the same time, but otherwise? It's hard to see.

It's just looping over the ships in the player's fleet, and doing a bit of additional looping within that only for ships with modules, and that just wouldn't amount to much. I mean, I still wouldn't do that without a good reason! But the game does tons of things much heavier than this every frame.)


i'm having an issue now where the fleet screen shows i have free OP after applying the hullmod through a dialog, but clicking into the refit screen does not show the free OP

Not sure about this one. I vaguely recall running into something similar myself in the last month or so and (probably?) fixing it but the details escape me.
Logged

Pariah

  • Ensign
  • *
  • Posts: 1
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7639 on: June 29, 2021, 12:36:52 PM »

I'm in the process of making some simple hulls that broke today. They worked fine yesterday, however today for some reason it kept crashing. I eventually stripped my mod back down to one hull and then it started to work again. I then slowly added everything back in and it still all worked. I couldn't find anything wrong with it and I didn't delete anything so I don't know what happened. If anyone has any ideas as to what I may have or may not have done that would be appreciated. As I am worried that its going to happen again.
Logged

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7640 on: June 29, 2021, 12:52:16 PM »

I'm not really clear on what you're saying - what do you mean by "all start to fire at maximum fire rate"? Like... they wouldn't just do that on their own, so maybe you mean you're able to fire them that way?

Regardless, though, hmm... if the group is linked and you're 100% sure of that, the only way for one of the weapons to fire individually is if the group is on autofire. But that wouldn't explain why it's firing at half the rate - though exactly when it fires would be up to the autofire AI at that point. However, it should be easy for you to see whether the group is on autofire, what group the ship AI has selected, and so on. There's a lot more info here to be had.
case A: i'm piloting ship personally, have group1 selected, the missile weapons are in group2 with autofire enabled - all three of them fire constantly as soon as the target in range
case B: i'm not piloting the ship, it is deployed under ai control. the missile weapons are in group2 with autofire enabled. only one weapon is firing at a time, as you can see on video: https://streamable.com/4ankxz
ignore the weird ship behavior otherwise, it has been since identified to not be the cause, but i can't record another vid
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7641 on: June 29, 2021, 12:59:46 PM »

Autofire behavior is identical between player and AI controlled ships, unless I suppose there's a custom weapon AI involved? In theory that'd also be the same but it's possible that one could be coded to behave differently if on a player ship.

What you want to look at is the ship info widget - in the bottom left - that shows the currently selected weapon group, group autofire status, etc. I kind of suspect that the AI turns off autofire and the group is not in fact linked; not much else comes to mind to explain this behavior. Well, again, apart from and odd custom autofire AI.


I'm in the process of making some simple hulls that broke today. They worked fine yesterday, however today for some reason it kept crashing. I eventually stripped my mod back down to one hull and then it started to work again. I then slowly added everything back in and it still all worked. I couldn't find anything wrong with it and I didn't delete anything so I don't know what happened. If anyone has any ideas as to what I may have or may not have done that would be appreciated. As I am worried that its going to happen again.

Hmm - not enough info to say conclusively! If you're compiling hullmods with an IDE/some kind of build process, it's possible that doing a clean build would have also resolved this. Otherwise, from experience, it sounds like one of your assumptions is wrong somewhere - either you weren't changing what was actually being used at one point, or the state it's in now is not the same as the state it was in when it wasn't working, etc.

Edit: *how* it broke would also be useful information...
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7642 on: June 29, 2021, 01:13:16 PM »

Autofire behavior is identical between player and AI controlled ships, unless I suppose there's a custom weapon AI involved? In theory that'd also be the same but it's possible that one could be coded to behave differently if on a player ship.
Didn't you say earlier the AI doesn't use autofire for missiles? In which case it would be a different AI, no?

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7643 on: June 29, 2021, 01:16:15 PM »

What you want to look at is the ship info widget - in the bottom left - that shows the currently selected weapon group, group autofire status, etc. I kind of suspect that the AI turns off autofire and the group is not in fact linked; not much else comes to mind to explain this behavior. Well, again, apart from and odd custom autofire AI.
yes, that's the problem, with ai turning off autofire
what i don't understand is why, and how to fix it
in the video it is literally sitting on top of target, why won't it fire?

Autofire behavior is identical between player and AI controlled ships, unless I suppose there's a custom weapon AI involved?
i can guarantee there is none, that's too complex for me to do
« Last Edit: June 29, 2021, 01:18:20 PM by passwalker »
Logged
Any and ALL sprites i ever posted on this forum are FREE to use. even if i'm using them myself. Don't ever, EVER ask for permission, or i will come to your home and EAT YOUR DOG!!!
i do NOT want to see my name appear in the credits section of any published mod and will consider it a personal insult.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7644 on: June 29, 2021, 01:24:22 PM »

Didn't you say earlier the AI doesn't use autofire for missiles? In which case it would be a different AI, no?

Not normally! But if there's some kind of very high ammo or ammo-regenerating missile, it might (not 100% sure offhand) - or if it's a missile weapon that has a type of BALLISTIC, for example.

Regardless, though that doesn't say whether it'd be a different kind of AI or not, since the weapon autofire AI would only come into play once the ship AI decides to turn the group on autofire...


What you want to look at is the ship info widget - in the bottom left - that shows the currently selected weapon group, group autofire status, etc. I kind of suspect that the AI turns off autofire and the group is not in fact linked; not much else comes to mind to explain this behavior. Well, again, apart from and odd custom autofire AI.
yes, that's the problem, with ai turning off autofire
what i don't understand is why, and how to fix it
in the video it is literally sitting on top of target, why won't it fire?

... ah! It might've helped if that was, you know, the actual question to begin with :)

Checking the code, it looks like it doesn't autofire missile weapons unless they've 1) got >20 ammo *and* 2) they're unguided. I think the reason for the second condition is larger-capacity (but not unlimited) guided missile weapons would fire all the time and get used up quickly. Let me add a check for it also having unlimited ammo, so that those would be ok to autofire regardless.

Your best bet might be to add tags like STRIKE, USE_VS_FRIGATES and rely on the AI manually firing the linked group.

Edit: another option would be a script that turns autofire on for that group every frame, thus mostly overriding the autofire manager for the ship AI, which only runs this a couple of times a second.
Logged

Yunru

  • Admiral
  • *****
  • Posts: 1560
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7645 on: June 29, 2021, 01:46:39 PM »

Checking the code, it looks like it doesn't autofire missile weapons unless they've 1) got >20 ammo *and* 2) they're unguided. I think the reason for the second condition is larger-capacity (but not unlimited) guided missile weapons would fire all the time and get used up quickly. Let me add a check for it also having unlimited ammo, so that those would be ok to autofire regardless.
Would it be possible to also have an external override for that, for use in things in the vein of the missile auto forge?

Edit: On a related note, is there a way to add tags to a weapon via hullmod?

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7646 on: June 30, 2021, 12:07:30 AM »

What can mess with a Ship's BreakProb to be 100% guaranteed? I need a wing that self-destructs to break into 4 pieces, but no matter how much numbers I put in BreakProb it will sometimes just refuse to split apart.

shoi

  • Admiral
  • *****
  • Posts: 658
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7647 on: June 30, 2021, 03:20:04 AM »

Is there any API hook to return what ship is selected/if a ship is selected in the command UI?
(the one where you can issue orders/retreat..not sure if that's the right name for it)

edit: also, ships with fighter bays but no carrier tag - do they default to COMBAT_CARRIER behavior?
« Last Edit: June 30, 2021, 12:08:13 PM by shoi »
Logged

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7648 on: June 30, 2021, 03:34:19 PM »

How much flux/s is it when a beam is charging up/down?
Is it proportional to level or straight up using full flux cost?
What about damage and hit strength? Are they proportional?
Logged


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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24114
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7649 on: July 01, 2021, 08:44:12 PM »

Would it be possible to also have an external override for that, for use in things in the vein of the missile auto forge?

If you add the ALWAYS_PANIC ship hint that should achieve a similar if not identical result.

Edit: On a related note, is there a way to add tags to a weapon via hullmod?

There is not, no. No way to do it without affecting *all* weapons of that type.


Is there any API hook to return what ship is selected/if a ship is selected in the command UI?
(the one where you can issue orders/retreat..not sure if that's the right name for it)

There isn't, no. (Command UI is about right; I'm never quite sure what to call it, myself.)

edit: also, ships with fighter bays but no carrier tag - do they default to COMBAT_CARRIER behavior?

Yeah - well, "CARRIER, COMBAT" but yeah.

What can mess with a Ship's BreakProb to be 100% guaranteed? I need a wing that self-destructs to break into 4 pieces, but no matter how much numbers I put in BreakProb it will sometimes just refuse to split apart.

It can never be actually 100% guaranteed, let alone to break in exactly 4 pieces. It tries to find "valid" ways to break up the hull (which involves some RNG and tesselating the hull's bounds) and gives up after some number of failed attempts. Which is why for example you could see a ship be "destroyed" (rather than "disabled") but not break apart.

How much flux/s is it when a beam is charging up/down?
Is it proportional to level or straight up using full flux cost?
What about damage and hit strength? Are they proportional?

After checking: it looks to be the full flux cost during charge-up and active, and zero during charge-down. The damage and I believe hit strength are proportional to the charge level of the beam, though. Well, not exactly proportional, it's some sort of square function; I forget exactly why but it made some numbers work out.
Logged
Pages: 1 ... 508 509 [510] 511 512 ... 710