Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 580 581 [582] 583 584 ... 710

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

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8715 on: May 02, 2022, 07:27:16 PM »

Make sure the weapons and fighter wings have autofit tags defined (see vanilla's weapon_data and wing_data csvs). If that fails, also check to make sure they're known by the faction.
Logged

Droll

  • Commander
  • ***
  • Posts: 103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8716 on: May 02, 2022, 09:06:21 PM »

Make sure the weapons and fighter wings have autofit tags defined (see vanilla's weapon_data and wing_data csvs). If that fails, also check to make sure they're known by the faction.

Thank you that has fixed the initial part of my issues, the weapons are now being added in the autofit and they are also showing up on my patrols.

However, the tags that the game uses are things like "kinetic15", "rocket3", "strike14" as well as "LR" or "SR". The latter two I imagine are just so the autofit knows the general range that the weapon is effective under but is there documentation for the former 3? They are not unique as some weapons (and wings) seem to have the same/similar tags. I'm also assuming that the "merc" tag just means that independent fleets of scavengers etc can equip those weapons.

That brings me to the current problem I have. Whenever I click my saved loadout to autofit, for some reason on slots that have the modded weapons don't stay the same as whats on the loadout. What confuses me is that as I said before, some of the vanilla weapons actually have some of the same tags in common. How do I make sure that the game always autofits consistently like it usually does (like how a vulcan cannon will always be autofitted with an available vulcan cannon)?

Thanks for your time
« Last Edit: May 03, 2022, 08:31:26 AM by Droll »
Logged

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8717 on: May 03, 2022, 05:52:00 AM »

what is the proper way to remove/unequip a weapon from the specific slot of a specific fleetMember in campaign ?
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: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8718 on: May 03, 2022, 10:23:55 AM »

How do I make sure that the game always autofits consistently like it usually does (like how a vulcan cannon will always be autofitted with an available vulcan cannon)?

One thing to check would be to make sure that the "upgrade" option is turned off in the autofit dialog.

Quote
"kinetic15", "rocket3", "strike14"

Pretty much what you'd think, I think - the number is "how good is it at that role". So kinetic15 is better at anti-shield than kinetic14. The SR/LR stuff is that for example a long-range kinetic doesn't get replaced by a quality but short-ranged one because it had a higher number. "rocket" is a dumbfire missile with lots of ammo. Strike is torpedoes and similar.

Tags without a number at the end - except for SR and LR - are not going to  be autofit-related. Your guess as to what "merc" does is spot-on; the way that's handled is by referring to that tag in the mercenary.faction file.

what is the proper way to remove/unequip a weapon from the specific slot of a specific fleetMember in campaign ?

You have to make sure that the VariantSource on its variant is REFIT; if not you'd set it to a clone of the shared variant, like so:
Code
if (member.getVariant().getSource() != VariantSource.REFIT) {
    member.setVariant(member.getVariant().clone(), false, false);
    member.getVariant().setSource(VariantSource.REFIT);
}

Otherwise, you might be modifying a shared STOCK variant, which would affect everywhere that uses it.

And after that you could modify the variant as needed. Depending on what you're doing, you might also want to add/remove the weapon to/from the player fleet's cargo.
Logged

Droll

  • Commander
  • ***
  • Posts: 103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8719 on: May 03, 2022, 10:33:38 AM »

Make sure the weapons and fighter wings have autofit tags defined (see vanilla's weapon_data and wing_data csvs). If that fails, also check to make sure they're known by the faction.

Thank you that has fixed the initial part of my issues, the weapons are now being added in the autofit and they are also showing up on my patrols.

However, the tags that the game uses are things like "kinetic15", "rocket3", "strike14" as well as "LR" or "SR". The latter two I imagine are just so the autofit knows the general range that the weapon is effective under but is there documentation for the former 3? They are not unique as some weapons (and wings) seem to have the same/similar tags. I'm also assuming that the "merc" tag just means that independent fleets of scavengers etc can equip those weapons.

That brings me to the current problem I have. Whenever I click my saved loadout to autofit, for some reason on slots that have the modded weapons don't stay the same as whats on the loadout. What confuses me is that as I said before, some of the vanilla weapons actually have some of the same tags in common. How do I make sure that the game always autofits consistently like it usually does (like how a vulcan cannon will always be autofitted with an available vulcan cannon)?

Thanks for your time

Completely disregard my quoted post as I am an unmitigated fool who missed that "randomize weapons" was checked on the autofit screen.

Following Histidines suggestion has completely fixed the problem for me. Thanks

Edit: Also thanks for your response Alex, now it makes sense. Especially since I'm not randomizing weapons anymore and complaining about it lol.
« Last Edit: May 03, 2022, 10:43:06 AM by Droll »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8720 on: May 03, 2022, 10:48:15 AM »

:D It happens!
Logged

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8721 on: May 03, 2022, 06:33:51 PM »

what is the proper way to remove/unequip a weapon from the specific slot of a specific fleetMember in campaign ?

You have to make sure that the VariantSource on its variant is REFIT; if not you'd set it to a clone of the shared variant, like so:
Code
if (member.getVariant().getSource() != VariantSource.REFIT) {
    member.setVariant(member.getVariant().clone(), false, false);
    member.getVariant().setSource(VariantSource.REFIT);
}

Otherwise, you might be modifying a shared STOCK variant, which would affect everywhere that uses it.

And after that you could modify the variant as needed. Depending on what you're doing, you might also want to add/remove the weapon to/from the player fleet's cargo.
thank you, this is helpful
however i haven't even gotten to the point of encountering any underwater rocks
i still can't figure out how to remove/unequip a weapon, nothing i tried had any effect so far(beyond null pointer crash, that is) and i can't find a working example, that's why i'm asking
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: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8722 on: May 03, 2022, 08:08:31 PM »

Hmm - ShipVariantAPI has a clearSlot(String slotId) method, have you tried that?
Logged

NuclearStudent

  • Ensign
  • *
  • Posts: 20
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8723 on: May 04, 2022, 12:07:52 AM »

Some odd behavior while trying to get and then delete campaign-level terrain. When I try to print all nearby terrain, I only ever get [TERRAIN] or [TERRAIN, DEBRIS] if there's debris. The worrisome part for me is that I delete magfields but not rings, asteroid fields, or solar shades somehow. RingBandAPI is a subclass of SecEnt.

 final float searchRange =60000f;//arbitrary number, in the future have a check to avoid removing the terrain from unrelated planets
        List<SectorEntityToken> terrainList=CampaignUtils.getNearbyEntitiesWithTag(planet, searchRange, "terrain");
        terrainList.addAll(CampaignUtils.getNearbyEntitiesWithTag(planet, searchRange, "ACCRETION_DISK"));
        terrainList.addAll(CampaignUtils.getNearbyEntitiesWithTag(planet, searchRange, "STELLAR_MIRROR"));
        //note: no idea why terrain covers magfields but not rings. they're both under terrain tags
        terrainList.addAll(CampaignUtils.getNearbyEntitiesWithTag(planet, searchRange, "RING"));
        terrainList.addAll(CampaignUtils.getNearbyEntitiesWithTag(planet, searchRange, "ASTEROID_BELT"));
       //note: adding things to terrainList seems to do precisely nothing in terms of increasing or decreasing the number of entities found

            //note: holy *** it works
            //note: wait ***, it wipes magfields but not rings that are in search range
        for (SectorEntityToken terrain:terrainList)
        {
            log.info((terrain.getTags()));
            system.removeEntity(terrain);
        }

The function I'm calling with getNearbyEntitiesWithTag is a LazyLib function, which seems to have a completely sane implementation based on using locationAPI and distance^2 to check the distance to all relevant SectorEntities in system. The LazyLib function seems to function completely fine in itself in testing. Implementation below in case it matter.

public static <T extends SectorEntityToken> List<T> getNearbyEntitiesWithTag(
            SectorEntityToken token, float range, String entityTag)
    {
        List<T> entities = new ArrayList<>();

        // Find all tokens of the given type within range
        for (SectorEntityToken tmp : token.getContainingLocation().getEntitiesWithTag(entityTag))
        {
            T entity = (T) tmp;

            // Exclude passed in token
            if (entity == token)
            {
                continue;
            }

            // Add any token within range
            if (MathUtils.isWithinRange(token, entity, range))
            {
                entities.add(entity);
            }
        }

        return entities;
    }

 @Nullable
    public static <T extends SectorEntityToken> T getNearestEntityFromFaction(
            SectorEntityToken token, String entityTag, FactionAPI faction)
    {
        T closest = null;
        float distanceSquared, closestDistanceSquared = Float.MAX_VALUE;

        for (SectorEntityToken tmp : token.getContainingLocation().getEntitiesWithTag(entityTag))
        {
            T entity = (T) tmp;

            if (entity == token || faction != entity.getFaction())
            {
                continue;
            }

            distanceSquared = MathUtils.getDistanceSquared(token.getLocation(),
                    entity.getLocation());
            if (distanceSquared < closestDistanceSquared)
            {
                closest = entity;
                closestDistanceSquared = distanceSquared;
            }
        }

        return closest;
    }
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8724 on: May 05, 2022, 08:54:01 AM »

Just want to know, how to hide a skill entirely if it is added to the player?
I just add only_npc to the tag, and everything seems okay, the skill is hidden, but I don't actually know if it is okay.
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24127
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8725 on: May 05, 2022, 10:04:45 AM »

I think it's npc_only and yeah that should be ok, that's why the tag is there.
Logged

Originem

  • Purple Principle
  • Captain
  • ****
  • Posts: 430
  • Dancing like a boss.
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8726 on: May 06, 2022, 07:08:20 AM »

I think it's npc_only and yeah that should be ok, that's why the tag is there.
oh, yes, I know, thx
Logged
My mods


Haze

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8727 on: May 06, 2022, 07:22:53 AM »

I've tried asking this question in the unofficial discord, but I've not gotten much help.

I've taken two java files from the starfarer.api zip file and I've edited them both. PhaseCloakStats.java to remove the flux slowdown, and MineStrikeStats.java to give it back its old range and minimum spawn range. I've attempted to use this to try to make it into a usable mod, with no success.

What do I do? How can I make this work? Keeping the modplugin section in mod_info crashes my game on launch, but deleting it causes the mod to have no effect on the game.

If anyone can help me out, I'll be very very grateful. I've been spending all afternoon toiling over this.
Logged

Haze

  • Ensign
  • *
  • Posts: 7
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8728 on: May 06, 2022, 07:29:34 AM »

I've tried asking this question in the unofficial discord, but I've not gotten much help.

I've taken two java files from the starfarer.api zip file and I've edited them both. PhaseCloakStats.java to remove the flux slowdown, and MineStrikeStats.java to give it back its old range and minimum spawn range. I've attempted to use this to try to make it into a usable mod, with no success.

What do I do? How can I make this work? Keeping the modplugin section in mod_info crashes my game on launch, but deleting it causes the mod to have no effect on the game.

If anyone can help me out, I'll be very very grateful. I've been spending all afternoon toiling over this.

And in case someone's willing to make the mod for me, here's the java files I've edited. All I had to do was change up a few values, but still.
https://pastebin.com/bS4EvxQn
https://pastebin.com/XpsJAk4h
Logged

NuclearStudent

  • Ensign
  • *
  • Posts: 20
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8729 on: May 06, 2022, 03:04:46 PM »

I've tried asking this question in the unofficial discord, but I've not gotten much help.

I've taken two java files from the starfarer.api zip file and I've edited them both. PhaseCloakStats.java to remove the flux slowdown, and MineStrikeStats.java to give it back its old range and minimum spawn range. I've attempted to use this to try to make it into a usable mod, with no success.

What do I do? How can I make this work? Keeping the modplugin section in mod_info crashes my game on launch, but deleting it causes the mod to have no effect on the game.

If anyone can help me out, I'll be very very grateful. I've been spending all afternoon toiling over this.

Post the mod_info, that might help.
Logged
Pages: 1 ... 580 581 [582] 583 584 ... 710