Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 495 496 [497] 498 499 ... 710

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

Inhilicon

  • Lieutenant
  • **
  • Posts: 61
  • I like when the ship
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7440 on: May 23, 2021, 07:53:00 AM »

Can you have a low-tech or midline ship use Plasma Jets and can you have a high-tech ship use Burn Drive? What are the colors of the jets for low-tech and midline ships?

You can, yeah. IIRC Burn Drive keeps the engine color being whatever it is, while Plasma Jets shifts it towards green, regardless of the ship's normal engine color. You can check the relevant .system file for details (Plasma Jets is defined in microburn.system, btw.)

Very cool! Thank you very much, Alex. I will fiddle with it for my mod and maybe come up with something cool!
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24130
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7441 on: May 23, 2021, 09:31:53 AM »

Have fun :D
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3023
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7442 on: May 23, 2021, 02:37:42 PM »

Ran into a strange crash while testing when the AI fleet I was following attacked a pirate scav fleet:

Spoiler
527810 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.api.impl.campaign.FleetInteractionDialogPluginImpl.winningPath(FleetInteractionDialogPluginImpl.java:1977)
   at com.fs.starfarer.api.impl.campaign.FleetInteractionDialogPluginImpl.optionSelec ted(FleetInteractionDialogPluginImpl.java:1481)
   at com.fs.starfarer.ui.newui.Stringsuper.dismiss(Unknown Source)
   at com.fs.starfarer.ui.Oo0O.processInputImpl(Unknown Source)
   at com.fs.starfarer.ui.newui.Stringsuper.processInputImpl(Unknown Source)
   at com.fs.starfarer.ui.o00O.processInput(Unknown Source)
   at com.fs.starfarer.ui.v.dispatchEventsToChildren(Unknown Source)
   at com.fs.starfarer.ui.v.processInputImpl(Unknown Source)
   at com.fs.starfarer.ui.o00O.processInput(Unknown Source)
   at com.fs.starfarer.campaign.CampaignState.processInput(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(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)
[close]

I have no idea what could have caused this. Did I configure something wrong when spawning the AI fleet?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24130
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7443 on: May 23, 2021, 02:55:16 PM »

Just for future reference, since this came up a bit earlier here: added ability to specify suppliesToRecover and suppliesPerMonth in .skin files.


Ran into a strange crash while testing when the AI fleet I was following attacked a pirate scav fleet:

Spoiler
527810 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
   at com.fs.starfarer.api.impl.campaign.FleetInteractionDialogPluginImpl.winningPath(FleetInteractionDialogPluginImpl.java:1977)
   at com.fs.starfarer.api.impl.campaign.FleetInteractionDialogPluginImpl.optionSelec ted(FleetInteractionDialogPluginImpl.java:1481)
   at com.fs.starfarer.ui.newui.Stringsuper.dismiss(Unknown Source)
   at com.fs.starfarer.ui.Oo0O.processInputImpl(Unknown Source)
   at com.fs.starfarer.ui.newui.Stringsuper.processInputImpl(Unknown Source)
   at com.fs.starfarer.ui.o00O.processInput(Unknown Source)
   at com.fs.starfarer.ui.v.dispatchEventsToChildren(Unknown Source)
   at com.fs.starfarer.ui.v.processInputImpl(Unknown Source)
   at com.fs.starfarer.ui.o00O.processInput(Unknown Source)
   at com.fs.starfarer.campaign.CampaignState.processInput(Unknown Source)
   at com.fs.starfarer.BaseGameState.traverse(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)
[close]

I have no idea what could have caused this. Did I configure something wrong when spawning the AI fleet?

The crash is in plugin code the source of which you can view, btw. So, huh - this means the dialog member variable in the plugin is somehow null, which is odd, because that should be set when the plugin is initialized, in the init() method, and isn't set anywhere else.
Logged

ElPresidente

  • Commander
  • ***
  • Posts: 152
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7444 on: May 24, 2021, 01:22:07 AM »

Alex, I found the problem, here is the solution just in case:

It very silly: in the name.java file in data/script/world/systems/ there was a caps missing in the following line:
      PlanetAPI byzos_star = system.initStar("byzos", // unique id for this star
In my case, "Byzos" was initially missing a caps on the "b", so I ended up with something like that:
      PlanetAPI byzos_star = system.initStar("Byzos", // unique id for this star

Please note that I make some tries with the Nakara system file just to check where was the problem. It has the same spelling problem.

Thanks again for the support!


I actually tried this for my own issue. Still not solved.

I've compared the files of systems that spawn correctly with the ones that don't, and I just can't figure out why ONLY these two (Procyon and Kores) spawn over Hybrasil, instead of their supposed location.

If anyone can take a look, files are here:  (just core files)
https://www.nexusmods.com/starsector/mods/56
« Last Edit: May 24, 2021, 03:47:06 AM by ElPresidente »
Logged

Stealth

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7445 on: May 24, 2021, 06:44:23 AM »

https://fractalsoftworks.com/forum/index.php?topic=21538.0

my ships are named <missing name>. what did i do wrong?
Logged
"it is what it is"  ~me every 30 seconds

Aramoro

  • Ensign
  • *
  • Posts: 48
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7446 on: May 24, 2021, 03:31:24 PM »

https://fractalsoftworks.com/forum/index.php?topic=21538.0

my ships are named <missing name>. what did i do wrong?



here i "FIXED" it for u ;D

no, for real...

open the:
ship_data.csv in ur Open office or whatever, click save, CSV format yes yes, done

probably a bug...
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7447 on: May 24, 2021, 07:00:42 PM »

Turns out my debugging lag issue was indeed as SafariJohn said, I had one (1) undeleted breakpoint and removing it made the issue go away. Whoops!

Alex, I found the problem, here is the solution just in case:

It very silly: in the name.java file in data/script/world/systems/ there was a caps missing in the following line:
      PlanetAPI byzos_star = system.initStar("byzos", // unique id for this star
In my case, "Byzos" was initially missing a caps on the "b", so I ended up with something like that:
      PlanetAPI byzos_star = system.initStar("Byzos", // unique id for this star

Please note that I make some tries with the Nakara system file just to check where was the problem. It has the same spelling problem.

Thanks again for the support!
I actually tried this for my own issue. Still not solved.

I've compared the files of systems that spawn correctly with the ones that don't, and I just can't figure out why ONLY these two (Procyon and Kores) spawn over Hybrasil, instead of their supposed location.

If anyone can take a look, files are here:  (just core files)
https://www.nexusmods.com/starsector/mods/56
If you're going to provide a mod for testing, at least make it work from the start without CTDs and not require the person to manually arrange folders from two different zips.

Anyway the issue seems to be that the starmap.json locations aren't being used at all, the star system IDs in it don't match what they're spawned with. The other systems spawn fine anyway because their location is set in the script, e.g.
Code: java
system.getLocation().set(24000, 16000);   	
Set those two star systems' locations in the script as well. Changing the ID of their stars to match the starmap.json entries would also work, but requires a bit of find/replace work.

(I think every single major mod with a starmap.json that I checked also has non-matching IDs that rely on in-script location setting, except DME)
Logged

ElPresidente

  • Commander
  • ***
  • Posts: 152
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7448 on: May 25, 2021, 12:24:45 AM »

OH hell, how did I miss that?  :-[
Thanks, you're a life saver!
Logged

ElPresidente

  • Commander
  • ***
  • Posts: 152
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7449 on: May 25, 2021, 04:40:54 AM »

A question I have to ask again - sounds control.

Any way to check if a sound is currently playing, or if it finished playing?
I have a weapon that I have to control fully trough scripts, including sounds - and while the warmup and powerdown are simple (just check in which charge state I am, play it and set a boolean so it's not triggered again on next frame update), but fire does not have a 100% set duration (it has a maximum, but it can be shorter), so the sound has to be looped.
Right now it just keeps getting re-started every frame, so it sounds bad.
Logged

Stealth

  • Ensign
  • *
  • Posts: 47
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7450 on: May 25, 2021, 05:47:04 AM »

https://fractalsoftworks.com/forum/index.php?topic=21538.0

my ships are named <missing name>. what did i do wrong?



here i "FIXED" it for u ;D

no, for real...

open the:
ship_data.csv in ur Open office or whatever, click save, CSV format yes yes, done

probably a bug...

Thank you very much
Logged
"it is what it is"  ~me every 30 seconds

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7451 on: May 25, 2021, 06:04:56 PM »

Is the FluxTrackerAPI.getCurrFlux() the sum of hard and soft flux or soft flux only?
Logged


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

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7452 on: May 25, 2021, 07:18:49 PM »

Is the FluxTrackerAPI.getCurrFlux() the sum of hard and soft flux or soft flux only?

The sum of hard and soft flux.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7453 on: May 25, 2021, 09:32:47 PM »

Two mod bug questions:

- LazyLib contains this method:
Spoiler
Code: java
/**
     * Spawns a ship directly onto the battle map, bypassing the fleet reserves.
     *
     * <b>NOTE: this method will not work out of the box in the campaign (.6.2a)
     * due to an after-battle crash in the default FleetEncounterContextPlugin
     * caused by spawned ships not being registered with the fleet.</b>
     *
     * @param variantId       The ID of the ship variant to spawn.
     * @param type            Whether this is a ship or a fighter wing.
     * @param side            What side of the battle this ship should fight on.
     * @param combatReadiness The CR the ship should start with.
     * @param location        The location on the battle map the ship should
     *                        spawn at.
     * @param facing          The initial facing of the ship on the battle map.
     *
     * @return The {@link ShipAPI} that was spawned by this method.
     *
     * @since 1.9
     */
    public static ShipAPI spawnShipOrWingDirectly(String variantId,
                                                  FleetMemberType type, FleetSide side, float combatReadiness,
                                                  Vector2f location, float facing)
    {
        FleetMemberAPI member = Global.getFactory().createFleetMember(type, variantId);
        member.getCrewComposition().addCrew(member.getNeededCrew());
        ShipAPI ship = Global.getCombatEngine().getFleetManager(side)
                .spawnFleetMember(member, location, facing, 0f);
        ship.setCRAtDeployment(combatReadiness);
        ship.setCurrentCR(combatReadiness);
        ship.setOwner(side.ordinal());
        ship.getShipAI().forceCircumstanceEvaluation();
        return ship;
    }
[close]
Example usage:
Code: java
runcode CombatUtils.spawnShipOrWingDirectly("mudskipper_Hull", FleetMemberType.SHIP, FleetSide.ENEMY, 0.7f, new Vector2f(0, 0), 0);
Here's the thing: I can use this to spawn a ship on the enemy side, as per the above console command. But when it dies, the "<shipname> disabled" message in the top-left uses the green color of friendly ships. Is this a bug in the base game's combat engine?

- Could this bug be looked at? I realize it's a pretty rare issue specific to particular mod circumstances, but the crash log indicates it's happening within base game code.

A question I have to ask again - sounds control.

Any way to check if a sound is currently playing, or if it finished playing?
I have a weapon that I have to control fully trough scripts, including sounds - and while the warmup and powerdown are simple (just check in which charge state I am, play it and set a boolean so it's not triggered again on next frame update), but fire does not have a 100% set duration (it has a maximum, but it can be shorter), so the sound has to be looped.
Right now it just keeps getting re-started every frame, so it sounds bad.
Doesn't seem like the sound player API has a way to do that.

Mega gross workaround I thought of: Break up the sound into chunks (say 0.5 seconds each).
In the weapon script, at each interval, check if we should continue playing the overall sound effect. If yes, play the next sound in the sequence, if not, reset and leave.
Logged

ElPresidente

  • Commander
  • ***
  • Posts: 152
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7454 on: May 26, 2021, 12:01:47 AM »

A question I have to ask again - sounds control.

Any way to check if a sound is currently playing, or if it finished playing?
I have a weapon that I have to control fully trough scripts, including sounds - and while the warmup and powerdown are simple (just check in which charge state I am, play it and set a boolean so it's not triggered again on next frame update), but fire does not have a 100% set duration (it has a maximum, but it can be shorter), so the sound has to be looped.
Right now it just keeps getting re-started every frame, so it sounds bad.
Doesn't seem like the sound player API has a way to do that.

Mega gross workaround I thought of: Break up the sound into chunks (say 0.5 seconds each).
In the weapon script, at each interval, check if we should continue playing the overall sound effect. If yes, play the next sound in the sequence, if not, reset and leave.

I don't see how that would be any better, I would still need some way to check when to paly the next part. Hmmm... a timer?
IF I know my looping fire sounds is 2 seconds, I can make a timer that counts frames and only isses the "play sound" after 2 seconds. How many frames is 2 seconds?



And another question - any example of fleet spawning script? Can someone point me to a mod that has scripts that spawn fleets that are viewable (I know a few, but all the scripts are in a .jar)
Logged
Pages: 1 ... 495 496 [497] 498 499 ... 710