Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 573 574 [575] 576 577 ... 710

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

Frederoo

  • Ensign
  • *
  • Posts: 15
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8610 on: March 25, 2022, 02:02:28 AM »

Is there a way to filter out or block fighter wings from being installed via a hullmod or listener? I want to achieve an affect exactly like Automated ships (only allow drones), without the ship actually being automated. I've seen a similar effect with the Roider Union mod "Fighter Clamps" (blocks bombers specifically), but was redirected here instead. :) Right now I'm quite crudely removing those wings if they get selected based on Tags.AUTOMATED_FIGHTER in applyEffectsBeforeShipCreation
https://github.com/AlfredBroda/AlkemiaArmory/blob/0.8.1/data/hullmods/AlkemiaDroneConversion.java#L62

I disallowed bombers, not drones. Automated ships are limited to drone wings, but I can't find how they do it. Try asking on the Misc Modding Questions thread.
Logged

briansd9

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8611 on: March 25, 2022, 09:00:34 AM »

Under what conditions would FleetMemberAPI.getRepairTracker().computeRepairednessFraction() return infinity or NaN?

Got a crash report with
Code
java.lang.NumberFormatException: For input string: "?"
My code that breaks is trying to apply a numeric format to the repairedness fraction, the "?" is apparently a Unicode replacement character for either +infinity or NaN.

Haven't been able to replicate the crash at all, any possible leads would be appreciated.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8612 on: March 25, 2022, 09:29:07 AM »

Is there a way to filter out or block fighter wings from being installed via a hullmod or listener? I want to achieve an affect exactly like Automated ships (only allow drones), without the ship actually being automated. I've seen a similar effect with the Roider Union mod "Fighter Clamps" (blocks bombers specifically), but was redirected here instead. :) Right now I'm quite crudely removing those wings if they get selected based on Tags.AUTOMATED_FIGHTER in applyEffectsBeforeShipCreation
https://github.com/AlfredBroda/AlkemiaArmory/blob/0.8.1/data/hullmods/AlkemiaDroneConversion.java#L62

I disallowed bombers, not drones. Automated ships are limited to drone wings, but I can't find how they do it. Try asking on the Misc Modding Questions thread.

For automated ships iirc it's just hardcoded and looks for the "automated" hullmod and the "auto" tag on the wing.

You could add a FighterOPCostModifier listener to the ship, though, and increase the OP cost of non-auto wings to... I think going over 1000 makes the UI treat that fighter as "not installable" and puts it at the end of the list, instead of listing the cost.

Under what conditions would FleetMemberAPI.getRepairTracker().computeRepairednessFraction() return infinity or NaN?

Got a crash report with
Code
java.lang.NumberFormatException: For input string: "?"
My code that breaks is trying to apply a numeric format to the repairedness fraction, the "?" is apparently a Unicode replacement character for either +infinity or NaN.

Haven't been able to replicate the crash at all, any possible leads would be appreciated.

It'd have to be bad data that got into the FleetMemberStatus somehow. If somehow the maximum hitpoints of a ship got reduced to 0, perhaps?

However, infinity or NaN convert to "Infinity" and "NaN" when printed out as strings; I haven't ever seen it come out as "?".
Logged

Frederoo

  • Ensign
  • *
  • Posts: 15
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8613 on: March 25, 2022, 04:34:24 PM »

For automated ships iirc it's just hardcoded and looks for the "automated" hullmod and the "auto" tag on the wing.

You could add a FighterOPCostModifier listener to the ship, though, and increase the OP cost of non-auto wings to... I think going over 1000 makes the UI treat that fighter as "not installable" and puts it at the end of the list, instead of listing the cost.
Thank you! That's exactly the effect I saw in SafariJohn's Roider Union mod - that's enough for me. ;D
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8614 on: March 26, 2022, 12:01:32 AM »

Trying to document sensor ghosts on the wiki. Leviathan looks like it should generate a slipstream behind it, but I don't think I've ever seen it do this in actual gameplay, and it doesn't when I manually spawn one in code. Am I missing something?

(Also my code can't seem to spawn minnows which is odd)

EDIT: Okay, I don't think ghosts in general work if I just sit wherever and spawn them with console (e.g. Remnant, ship and Zig ghosts just stay where they're spawned and don't move or reveal themselves). I've seen ghosts spawn slipstreams but I dunno which type they are.
For the wiki, I'll just write down what I already knew to be true.
« Last Edit: March 26, 2022, 12:43:52 AM by Histidine »
Logged

bananana

  • Commander
  • ***
  • Posts: 228
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8615 on: March 26, 2022, 03:19:58 AM »

question
what is the current official hard cap on weapon fire delay?
the minimum amount of time between firing a shot, chargeup, chargedown and burst delay combined
i mean exact number it gets cut off at, not balance or sanity considerations
i know there was no hard cap once but now there is and i don't recall reading anywhere what it is, just that thereis one
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.

briansd9

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8616 on: March 26, 2022, 05:10:38 AM »

Under what conditions would FleetMemberAPI.getRepairTracker().computeRepairednessFraction() return infinity or NaN?

Got a crash report with
Code
java.lang.NumberFormatException: For input string: "?"
My code that breaks is trying to apply a numeric format to the repairedness fraction, the "?" is apparently a Unicode replacement character for either +infinity or NaN.

Haven't been able to replicate the crash at all, any possible leads would be appreciated.

It'd have to be bad data that got into the FleetMemberStatus somehow. If somehow the maximum hitpoints of a ship got reduced to 0, perhaps?

However, infinity or NaN convert to "Infinity" and "NaN" when printed out as strings; I haven't ever seen it come out as "?".

Got it, this is a "should never happen" situation right?

My mistake btw, the "?" was from a DecimalFormat I was using to round the repairedness to 2 decimal places (found the exact issue on stackoverflow), the crash occurred when trying to parse the output as a float. Not my problem strictly speaking, but it'd be nice to find the exact cause
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8617 on: March 26, 2022, 07:51:28 AM »

Trying to document sensor ghosts on the wiki. Leviathan looks like it should generate a slipstream behind it, but I don't think I've ever seen it do this in actual gameplay, and it doesn't when I manually spawn one in code. Am I missing something?

(Also my code can't seem to spawn minnows which is odd)

EDIT: Okay, I don't think ghosts in general work if I just sit wherever and spawn them with console (e.g. Remnant, ship and Zig ghosts just stay where they're spawned and don't move or reveal themselves). I've seen ghosts spawn slipstreams but I dunno which type they are.
For the wiki, I'll just write down what I already knew to be true.

You've looked at SensorGhostManager, right? spawnGhost() in particular; the SensorGhost needs to be added to the "ghosts" list in order to function. ... which, that list is protected right now, let me add a getter for it - otherwise, I don't think you can spawn fully functional ghosts. And yeah, the leviathan leaves a slipstream behind.

Hmm - I suppose you could work around this with a custom derived SensorGhostManager; feels like you'd probably be doing this sort of thing already for a number of things.

question
what is the current official hard cap on weapon fire delay?
the minimum amount of time between firing a shot, chargeup, chargedown and burst delay combined
i mean exact number it gets cut off at, not balance or sanity considerations
i know there was no hard cap once but now there is and i don't recall reading anywhere what it is, just that thereis one

It's 20 shots per second.

Got it, this is a "should never happen" situation right?

My mistake btw, the "?" was from a DecimalFormat I was using to round the repairedness to 2 decimal places (found the exact issue on stackoverflow), the crash occurred when trying to parse the output as a float. Not my problem strictly speaking, but it'd be nice to find the exact cause

Right! It's a hard one to track down because once there's a NaN or Infinity in the data somewhere, it can propagate almost anywhere - any calculation that uses these results in a NaN (or Infinity), too, and there's no way to trace where it came from.
Logged

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 840
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8618 on: March 26, 2022, 01:29:27 PM »

I'm trying to specify an OnRightClick action, as well as some sprite rendering for a commodity. There is a "Plugin" field in commodities.csv, but it doesn't appear to do anything (specifying a SpecialItemPlugin there doesn't allow setting OnRightClick actions, tooltip modifications or rendering). Any way to manually specify an lItemPlugin for a commodity and get access to these methods while not losing the economy integration?
« Last Edit: March 26, 2022, 01:34:42 PM by SirHartley »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8619 on: March 26, 2022, 02:51:38 PM »

The plugin field in commodities.csv is not used; I'm not actually sure why it's even there.
Logged

Stelarwand030

  • Lieutenant
  • **
  • Posts: 58
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8620 on: March 27, 2022, 05:10:23 PM »

I am trying to edit a hullmod mod I bought but the game keeps crashing. i would ask the creator but he lives in Kyiv... so...

Here is the Mod: https://files.gamebanana.com/bitpit/rofhullmod_378fa.rar its a super cheaty mod that increases damage and rate of fire for all weapons. I want to drop the damage modifier but the game keeps crashing. Can someone tell me how to do that?
Logged

alaricdragon

  • Commander
  • ***
  • Posts: 162
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8621 on: March 27, 2022, 05:13:09 PM »

dose anyone know how to accesses and or remove an markets population growth modifiers? I want to replace all of them with my own if certain conditions are meet.
i tried using the Immigration Modifiers to clear the population growth, but nothing happened. i think they are used for something completely different, but I had to try something
(i put this into the applyGrowthChanges() of an market condition that extends BaseMarketConditionPlugin implements MarketImmigrationModifier )
Code
LinkedHashSet<MarketImmigrationModifier> i = market.getImmigrationModifiers();
for(MarketImmigrationModifier a : i){
   market.removeImmigrationModifier(a);
}
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8622 on: March 27, 2022, 06:20:52 PM »

I am trying to edit a hullmod mod I bought but the game keeps crashing. i would ask the creator but he lives in Kyiv... so...

Here is the Mod: https://files.gamebanana.com/bitpit/rofhullmod_378fa.rar its a super cheaty mod that increases damage and rate of fire for all weapons. I want to drop the damage modifier but the game keeps crashing. Can someone tell me how to do that?
Works for me, you might just have edited it wrong (post the modified code and error message if you continue having trouble)

Here's the missile hullmod with halved damage bonus (replace the contents of existing file):
Spoiler
Code
package data.hullmods;

import com.fs.starfarer.api.combat.BaseHullMod;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import data.scripts.util.MagicIncompatibleHullmods;

public class MissileRoFHullmod extends BaseHullMod {

    public static final float ROF_BONUS = 1f;

    public static final float DAMAGE_BONUS_PERCENT = 25f;

    public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
        if (stats.getVariant().getHullMods().contains("rof_hullmod_all"))
            MagicIncompatibleHullmods.removeHullmodWithWarning(stats.getVariant(), "rof_hullmod_all", "rof_hullmod_missile");

        stats.getMissileRoFMult().modifyMult(id, 1f + (ROF_BONUS));
        stats.getMissileWeaponDamageMult().modifyPercent(id, DAMAGE_BONUS_PERCENT);
    }

    public boolean isApplicableToShip(ShipAPI ship) {
        return (!ship.getVariant().getHullMods().contains("rof_hullmod_all"));
    }

    public String getUnapplicableReason(ShipAPI ship) {
        if (ship.getVariant().getHullMods().contains("rof_hullmod_all"))
            return "Incompatible with Weapon RoF Improvement";
        return null;
    }

    public String getDescriptionParam(int index, HullSize hullSize) {
        float mult = 1f + ROF_BONUS;
        float bonusPercent = (int) ((mult - 1f) * 100f);
        if (index == 0) return "" + (int) bonusPercent + "%";
        if (index == 1) return "" + (int) DAMAGE_BONUS_PERCENT + "%";
        return null;
    }
}
[close]
All-boost mod with double ROF, 50% flux reduction and 200% bonus beam damage:
Spoiler
Code: java
package data.hullmods;

import com.fs.starfarer.api.combat.BaseHullMod;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import data.scripts.util.MagicIncompatibleHullmods;

public class AllRoFHullmod extends BaseHullMod {

    public static final float ROF_BONUS = 2f;
    public static final float FLUX_REDUCTION = 50f;

    public static final float DAMAGE_BONUS_PERCENT = 200f;

    public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
        if (stats.getVariant().getHullMods().contains("rof_hullmod_ballistic"))
            MagicIncompatibleHullmods.removeHullmodWithWarning(stats.getVariant(), "rof_hullmod_ballistic", "rof_hullmod_all");
        if (stats.getVariant().getHullMods().contains("rof_hullmod_energy"))
            MagicIncompatibleHullmods.removeHullmodWithWarning(stats.getVariant(), "rof_hullmod_energy", "rof_hullmod_all");

        stats.getBallisticRoFMult().modifyMult(id, 1f + (ROF_BONUS));
        stats.getBallisticWeaponFluxCostMod().modifyMult(id, 1f - (FLUX_REDUCTION * 0.01f));
        stats.getEnergyRoFMult().modifyMult(id, 1f + (ROF_BONUS));
        stats.getEnergyWeaponFluxCostMod().modifyMult(id, 1f - (FLUX_REDUCTION * 0.01f));

        stats.getMissileRoFMult().modifyMult(id, 1f + (ROF_BONUS));
        stats.getMissileWeaponFluxCostMod().modifyMult(id, 1f - (FLUX_REDUCTION * 0.01f));
        stats.getBeamWeaponDamageMult().modifyPercent(id, DAMAGE_BONUS_PERCENT);
    }

    public boolean isApplicableToShip(ShipAPI ship) {
        return (!ship.getVariant().getHullMods().contains("rof_hullmod_ballistic") &&
                !ship.getVariant().getHullMods().contains("rof_hullmod_energy"));
    }

    public String getUnapplicableReason(ShipAPI ship) {
        if (ship.getVariant().getHullMods().contains("rof_hullmod_ballistic"))
            return "Incompatible with Improved Ammo Feeders";
        if (ship.getVariant().getHullMods().contains("rof_hullmod_energy"))
            return "Incompatible with Fast Recharging Capacitors";
        return null;
    }

    public String getDescriptionParam(int index, HullSize hullSize) {
        float mult = 1f + ROF_BONUS;
        float bonusPercent = (int) ((mult - 1f) * 100f);
        if (index == 0) return "" + (int) bonusPercent + "%";
        if (index == 1) return "" + (int) DAMAGE_BONUS_PERCENT + "%";
        if (index == 2) return "" + (int) FLUX_REDUCTION + "%";
        return null;
    }
}
[close]
Logged

Stelarwand030

  • Lieutenant
  • **
  • Posts: 58
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8623 on: March 27, 2022, 07:12:58 PM »

I am trying to edit a hullmod mod I bought but the game keeps crashing. i would ask the creator but he lives in Kyiv... so...

Here is the Mod: https://files.gamebanana.com/bitpit/rofhullmod_378fa.rar its a super cheaty mod that increases damage and rate of fire for all weapons. I want to drop the damage modifier but the game keeps crashing. Can someone tell me how to do that?
Works for me, you might just have edited it wrong (post the modified code and error message if you continue having trouble)

Here's the missile hullmod with halved damage bonus (replace the contents of existing file):
Spoiler
Code
code
[close]
code
[/code][/spoiler]

I am using rons editor. what i want to change is the damage bonus for the all rof hullmod from 1000 to 100. yet every time i do this I get: fatal: Error loading [data.hullmods.allrofhullmod] Cause parsing compilation unit 'data.hullmods. allrofhullmod'

here is the original code
Code
package data.hullmods;

import com.fs.starfarer.api.combat.BaseHullMod;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
import data.scripts.util.MagicIncompatibleHullmods;

public class AllRoFHullmod extends BaseHullMod {

    public static final float ROF_BONUS = 10f;
    public static final float FLUX_REDUCTION = 500f;

    public static final float DAMAGE_BONUS_PERCENT = 1000f;
    public static final float AMMO_BONUS_PERCENT = 1000f;
    public static final float RANGE_BONUS_PERCENT = 1000f;
    public static final float HEALTH_BONUS_PERCENT = 1000f;
    public static final float ACCELERATION_BONUS_PERCENT = 1000f;
    public static final float SPEED_BONUS_PERCENT = 1000f;

    public void applyEffectsBeforeShipCreation(HullSize hullSize
        if (stats.getVariant().getHullMods().contains("rof_hullmod_ballistic"))
            MagicIncompatibleHullmods.removeHullmodWithWarning(stats.getVariant()

I want to drop the DAMAGE_BONUS_PERCENT = 1000f to 100f but whenever I do the game crashes.
« Last Edit: March 27, 2022, 07:16:27 PM by Stelarwand030 »
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4682
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8624 on: March 28, 2022, 05:49:33 PM »

Don't use Ron's Editor to open .java files, it's for .csv. Notepad++ will do, although for more serious work an IDE is recommended.
Logged
Pages: 1 ... 573 574 [575] 576 577 ... 710