Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 516 517 [518] 519 520 ... 709

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

6chad.noirlee9

  • Captain
  • ****
  • Posts: 368
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7755 on: July 20, 2021, 06:35:23 PM »

I HATE to be that guy, however, it would be REALLY cool to have an "autopilot" that will fly you through hyperspace (by using the script the ai uses or something) where your fleet will auto slow through storms n such and possibly even seek out "high value" targets (configurably of course)

just a wish list sort of thing that hopefully will make it into the final release!
Logged
edit: edit: maybe were just falling with style LOL.  make a bubble, make the space in front of it smaller and just fall forward

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7756 on: July 20, 2021, 09:13:36 PM »

Heya, I found another issue with getTurretFireOffsets() - at least in simulator mode, when ending a battle and then consecutively starting a new one, the offsetted values of the launch points are "saved" somehow, and the next time these are called:
                   gun.ensureClonedSpec();
                   gun.getSpec().getTurretFireOffsets().get(0);
...the original values start from the previously offsetted point - and the offset code will activate again from here placing it way off.

Is there a way to sort of refresh these values to the original?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7757 on: July 20, 2021, 09:20:25 PM »

I HATE to be that guy, however, it would be REALLY cool to have an "autopilot" that will fly you through hyperspace (by using the script the ai uses or something) where your fleet will auto slow through storms n such and possibly even seek out "high value" targets (configurably of course)

just a wish list sort of thing that hopefully will make it into the final release!

Ahh, this isn't the right thread for general suggestions.

Heya, I found another issue with getTurretFireOffsets() - at least in simulator mode, when ending a battle and then consecutively starting a new one, the offsetted values of the launch points are "saved" somehow, and the next time these are called:
                   gun.ensureClonedSpec();
                   gun.getSpec().getTurretFireOffsets().get(0);
...the original values start from the previously offsetted point - and the offset code will activate again from here placing it way off.

Is there a way to sort of refresh these values to the original?

The elements in the arraylist returned by getTurretFireOffsets() are the same Vector2fs, only the list itself is cloned by ensureClonedSpec(). If you clear out the list and re-populate it with a copy of the vectors it should avoid this issue.
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 #7758 on: July 20, 2021, 09:50:55 PM »

Any idea why I'd be running into this on a new game start?

I can view the FleetFactoryV3 methods, but there is nothing about what that refresh method does in MutableCharacterStatsAPI or why it would generate a nullpointer. Maaybe I have an outdated and no longer used skill listed in the faction file for that faction?? I'll check for that.

*EDIT*
Yup sure enough, I had fighter_doctrine instead of fighter_uplink. Hopefully that prevents it from reoccurring. (And now I need to go over all my factions files' skill sections and double check them all for that.)

Code
1233638 [Thread-3] INFO  com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetRouteManager  - Creating trade fleet of tier 6.0 for market [Lilith]
1233758 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.campaign.CharacterStats.refreshCharacterStatsEffects(Unknown Source)
at com.fs.starfarer.api.impl.campaign.fleets.FleetFactoryV3.addCommanderSkills(FleetFactoryV3.java:1276)
at com.fs.starfarer.api.impl.campaign.fleets.FleetFactoryV3.addCommanderAndOfficersV2(FleetFactoryV3.java:1147)
at com.fs.starfarer.api.impl.campaign.fleets.FleetFactoryV3.addCommanderAndOfficers(FleetFactoryV3.java:852)
at com.fs.starfarer.api.impl.campaign.fleets.FleetFactoryV3.createFleet(FleetFactoryV3.java:411)
at com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetRouteManager.createTradeRouteFleet(EconomyFleetRouteManager.java:627)
at com.fs.starfarer.api.impl.campaign.fleets.EconomyFleetRouteManager.spawnFleet(EconomyFleetRouteManager.java:487)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.spawnAndDespawn(RouteManager.java:619)
at com.fs.starfarer.api.impl.campaign.fleets.RouteManager.advance(RouteManager.java:577)
at com.fs.starfarer.api.impl.campaign.CoreScript.advance(CoreScript.java:128)
at com.fs.starfarer.campaign.CampaignEngine.advance(Unknown Source)
« Last Edit: July 20, 2021, 09:57:13 PM by Morrokain »
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7759 on: July 20, 2021, 09:56:36 PM »

Is there a way for a fighter's hullmod to interact with its "owner carrier."

I'm looking everywhere in the ShipAPI and I can see that if I have FighterLaunchBayAPI, then I can access the owner carrier but I'm having a hard time using a fighter to access the FighterLaunchBayAPI itself... I want to make it possible that for every Wing with this hullmod is on a carrier, it decreases the max armor of the carrier.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24103
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7760 on: July 21, 2021, 09:23:24 AM »

Is there a way for a fighter's hullmod to interact with its "owner carrier."

I'm looking everywhere in the ShipAPI and I can see that if I have FighterLaunchBayAPI, then I can access the owner carrier but I'm having a hard time using a fighter to access the FighterLaunchBayAPI itself... I want to make it possible that for every Wing with this hullmod is on a carrier, it decreases the max armor of the carrier.

Something like fighter.getWing().getSourceShip();

But checking for nulls at every point (i.e. fighter.getWing() != null etc)

If this is the info you're looking for?
Logged

Timid

  • Admiral
  • *****
  • Posts: 640
  • Personal Text
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7761 on: July 21, 2021, 02:29:33 PM »

Is there a way for a fighter's hullmod to interact with its "owner carrier."

I'm looking everywhere in the ShipAPI and I can see that if I have FighterLaunchBayAPI, then I can access the owner carrier but I'm having a hard time using a fighter to access the FighterLaunchBayAPI itself... I want to make it possible that for every Wing with this hullmod is on a carrier, it decreases the max armor of the carrier.

Something like fighter.getWing().getSourceShip();

But checking for nulls at every point (i.e. fighter.getWing() != null etc)

If this is the info you're looking for?
I'm not sure then if I'm implementing it properly then since the fighter's hullmod doesn't seem to "add the hullmod" to its parent carrier when installed into a lanuch bay here is the code in question.
Code
package data.scripts.hullmods;

import com.fs.starfarer.api.combat.BaseHullMod;
import com.fs.starfarer.api.combat.ShipAPI;

public class free_carrier_forge extends BaseHullMod {
    @Override
    public void applyEffectsAfterShipCreation(ShipAPI ship, java.lang.String id) {
        if (ship.getWing() != null && ship.getWing().getSourceShip() != null) ship.getWing().getSourceShip().getVariant().addMod("missile_reload");
    }
}

creature

  • Captain
  • ****
  • Posts: 400
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7762 on: July 21, 2021, 02:55:49 PM »

The elements in the arraylist returned by getTurretFireOffsets() are the same Vector2fs, only the list itself is cloned by ensureClonedSpec(). If you clear out the list and re-populate it with a copy of the vectors it should avoid this issue.
Hmm... how should this be done? Like this?

Code
gun.ensureClonedSpec();
dglaunch = gun.getSpec().getTurretFireOffsets().get(0);

//Manitpulating dglaunch to move fire offsets
dglaunch.set(dglaunchX + (smoothedAnimLast*offsetFY), dglaunchY - (smoothedAnimFirst*offsetFX));

gun.getSpec().getTurretFireOffsets().clear();
gun.getSpec().getTurretFireOffsets().add(new Vector2f());

Also, one more thing - I found that when there are multiple units of the same one that has this offset code, it seems they all share the same offset - so if one activates the code, the offset of other units will adjust...
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 #7763 on: July 21, 2021, 03:26:45 PM »

Helping out another modder who is inexperienced, and I almost have the mod working, but I'm not compiling a jar in case that is relevant to this issue. Running into:

Caused by: java.lang.ClassNotFoundException: File 'data/scripts/skills/FieldRepairsNerfScript.java', Line 85, Column 11: Assignment conversion not possible from type "java.lang.Object" to type "com.fs.starfarer.api.fleet.FleetMemberAPI"
   at org.codehaus.janino.JavaSourceClassLoader.generateBytecodes(JavaSourceClassLoader.java:226)
   at org.codehaus.janino.JavaSourceClassLoader.findClass(JavaSourceClassLoader.java:178)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 2 more

It seems like I am declaring a type though so where is it getting the idea that I'm trying to convert an object? This is pasted directly from the Field Repairs script, so I have a hunch that its a janino issue or something. Or am I missing something obvious? (Wouldn't be the first time.)

"picked = picker.pick();" is line 85 for refence.

*FIXED* Hmm, ok so apparently the class loader doesn't like it if you declare a type when initializing a new WeightedRandomPicker.

So: WeightedRandomPicker<FleetMemberAPI> picker = new WeightedRandomPicker<FleetMemberAPI>();

Should change to: WeightedRandomPicker<FleetMemberAPI> picker = new WeightedRandomPicker<>();


Nvm the compiler doesn't like that either. I guess it's not possible to use a WeightedRandomPicker without using a jar?? The reason this is important is because the user wants to play around with one of the static values for testing, and that won't be possible if the script is in a jar. They don't really know how to code and won't want to set up an IDE.

*EDIT* Ah screw it I compiled a jar and made the code read the value from settings so it is easily changed. Simple enough. Works now.

From:
Spoiler
Code
import com.fs.starfarer.api.fleet.FleetMemberAPI;

Code
	protected FleetMemberAPI picked = null;

Code
		CampaignFleetAPI fleet = Global.getSector().getPlayerFleet();
WeightedRandomPicker<FleetMemberAPI> picker = new WeightedRandomPicker<FleetMemberAPI>();
for (FleetMemberAPI member : fleet.getFleetData().getMembersListCopy()) {
if (member.getVariant().isStockVariant()) continue;
int dmods = DModManager.getNumNonBuiltInDMods(member.getVariant());
if (dmods > 0) {
picker.add(member, 1);
}
}
picked = picker.pick();
[close]
« Last Edit: July 21, 2021, 05:08:13 PM by Morrokain »
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3019
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7764 on: July 21, 2021, 05:53:14 PM »

Last version I was able to ensure my retrofit bar event was at the top of the bar list, but now there is no way to do that without breaking random events. Can we please get a way to add priority bar events?

Events added in the AddBarEvents trigger show up first, I believe. Not exactly what you're asking for, but might be good enough.

Seems like this does what I want.
Logged

6chad.noirlee9

  • Captain
  • ****
  • Posts: 368
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7765 on: July 21, 2021, 06:26:39 PM »

I HATE to be that guy, however, it would be REALLY cool to have an "autopilot" that will fly you through hyperspace (by using the script the ai uses or something) where your fleet will auto slow through storms n such and possibly even seek out "high value" targets (configurably of course)

just a wish list sort of thing that hopefully will make it into the final release!

Ahh, this isn't the right thread for general suggestions.



youre right i forgot about that my bad
Heya, I found another issue with getTurretFireOffsets() - at least in simulator mode, when ending a battle and then consecutively starting a new one, the offsetted values of the launch points are "saved" somehow, and the next time these are called:
                   gun.ensureClonedSpec();
                   gun.getSpec().getTurretFireOffsets().get(0);
...the original values start from the previously offsetted point - and the offset code will activate again from here placing it way off.

Is there a way to sort of refresh these values to the original?

The elements in the arraylist returned by getTurretFireOffsets() are the same Vector2fs, only the list itself is cloned by ensureClonedSpec(). If you clear out the list and re-populate it with a copy of the vectors it should avoid this issue.
Logged
edit: edit: maybe were just falling with style LOL.  make a bubble, make the space in front of it smaller and just fall forward

Tecrys

  • Admiral
  • *****
  • Posts: 595
  • repair that space elevator!
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7766 on: July 21, 2021, 10:27:50 PM »

Hello!

How can I adjust the xp gain from battles? I'm getting a way too high xp bonus because the game thinks a battle is hard for my fleet but in reality it is a piece of cake.
Like 260% xp bonus for a battle no ship of mine got a scratch and I used mediocre stock variants.
Does it have anything to do with the civilian hint and/or hullmod? Because that's on all those ships.
I've tried upping fleet points in ship_data.csv but that did nothing.

Can I somehow fix that?
« Last Edit: July 22, 2021, 06:41:12 AM by Tecrys »
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0

shoi

  • Admiral
  • *****
  • Posts: 657
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7767 on: July 22, 2021, 01:23:31 AM »

Does damageAPI.getDamage() return the base damage including any modifiers?
I'm using this to kill some ships with fighter hullsize in an attempt to get around the 50% chance of them poofing out of existence and not being disabled, and while it seems to work most of the time, there have been instances where it doesn't  seem to  trigger, and I can't figure it out for the life of me.
Quote
public String modifyDamageTaken(Object param,CombatEntityAPI target, DamageAPI damage, Vector2f point, boolean shieldHit)
      {
         
         if(!(target instanceof ShipAPI))
            return null;
         
         if(shieldHit)
            return null;
         
         if(damage.getDamage() > target.getHitpoints())
         {
            ShipAPI sc = (ShipAPI) target;
            sc.setHullSize(HullSize.FRIGATE);
            sc.setHitpoints(0f);
            
         }
            String id = "strikecraft_death";
            return id;
      }

« Last Edit: July 22, 2021, 01:58:20 AM by shoi »
Logged

Sutopia

  • Admiral
  • *****
  • Posts: 1005
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7768 on: July 22, 2021, 02:04:58 PM »

Does damageAPI.getDamage() return the base damage including any modifiers?
I'm using this to kill some ships with fighter hullsize in an attempt to get around the 50% chance of them poofing out of existence and not being disabled, and while it seems to work most of the time, there have been instances where it doesn't  seem to  trigger, and I can't figure it out for the life of me.
Quote
public String modifyDamageTaken(Object param,CombatEntityAPI target, DamageAPI damage, Vector2f point, boolean shieldHit)
      {
         
         if(!(target instanceof ShipAPI))
            return null;
         
         if(shieldHit)
            return null;
         
         if(damage.getDamage() > target.getHitpoints())
         {
            ShipAPI sc = (ShipAPI) target;
            sc.setHullSize(HullSize.FRIGATE);
            sc.setHitpoints(0f);
            
         }
            String id = "strikecraft_death";
            return id;
      }


But you specified frigate instead of fighter?
There is also no guarantee that fighters poof on death.
Your best bet is actually phase the thing at death I think. Make the sprite transparent would work as well.
Logged


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

shoi

  • Admiral
  • *****
  • Posts: 657
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #7769 on: July 22, 2021, 02:29:17 PM »

They're frigates with fighter hullsize. Changing the hullsize to frigate is so they are disabled normally.
Logged
Pages: 1 ... 516 517 [518] 519 520 ... 709