Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 358 359 [360] 361 362 ... 710

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

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5385 on: October 14, 2019, 10:27:28 AM »


Hmm, one possible option for this: respawn the hologram?

How? order the drone to land()?
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5386 on: October 14, 2019, 11:05:07 AM »

I meant just removing it and spawning a replacement, but, yeah, if you're using a drone launcher system, that doesn't seem ideal/workable...

Another option would be to have the drone's visuals be handled using a decorative weapon instead of the actual ship sprite. By default, decorative weapons don't show damage decals, so you'd be good there.
Logged

RustyCabbage

  • Captain
  • ****
  • Posts: 347
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5387 on: October 14, 2019, 01:36:44 PM »

I was wondering if there is a way to reflect these changes in the the stats screen or the mouseover details, ideally without changing the entire implementation into a hull mod.
Pretty sure you just need to add a description of the effect as a third argument for modifyMult, like this:
Code: java
member.getStats().getBaseCRRecoveryRatePercentPerDay().modifyMult("sl_crpd", CR_MULT_FRIGATE, "reason for modifier");

Pretty sure you just need to add a description of the effect as a third argument for modifyMult, like this:
Code: java
member.getStats().getBaseCRRecoveryRatePercentPerDay().modifyMult("sl_crpd", CR_MULT_FRIGATE, "reason for modifier");

That's part of it, but also: ship stats modifiers get cleaned out and recomputed fairly frequently. E.G. for the player fleet it'll happen any time you open the fleet screen, hover over a fleet or ship related tooltip, etc. This means that changing them directly in a script like this is not a good idea - the changes will never be reflected in the UI, and may be overwritten and not used at key moments.

What you want to do is look at FleetMemberAPI.getBuffManager(), and at com.fs.starfarer.api.impl.campaign.terrain.CRRecoveryBuff. EmergencyBurnAbility has an example using this to stop CR recovery temporarily.

The buffs from a BuffManager get applied at the right times and so will be seen in the UI and will actually work properly all the time.
Thank you both. I'll mess around with it.

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5388 on: October 14, 2019, 07:20:26 PM »

One of my hullmods if causing a serious duplication glitch, the hullmod limits LPCs to be equipped to 8 OP or less and no crew (drone only), it seems like the game can make a variant and equip invalid LPCs ignoring the hullmod removal, but not ignoring the code that places the LPC back into the inventory

Code
if (ship.getVariant().getWing(i).getVariant().getHullSpec().getMinCrew() > 0 || ship.getVariant().getWing(i).getOpCost(ship.getMutableStats()) > 8) {
            String LPC = ship.getVariant().getWingId(i);
            ship.getVariant().setWingId(i ,null); //this is ignored
            if(ship.getVariant().getWing(i) == null) { //i even added this check!
            if (Global.getSector() != null) {
                        if (Global.getSector().getPlayerFleet() != null) {
                            Global.getSector().getPlayerFleet().getCargo().addFighters(LPC, 1); //this always go through
                        }
                    }
            }
               
                shouldSoundError = true;
}

How to reproduce:
1. Get a ship that has the hullmod (like a Corgi).
2. Open variants
3. Left-click the preset
4. It should add some kind of crewed wing to the variant it made
5. Left-click the preset multiple times

I have no idea how to fix it
« Last Edit: October 14, 2019, 07:54:32 PM by Ed »
Logged
Check out my ships

Sundog

  • Admiral
  • *****
  • Posts: 1727
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5389 on: October 14, 2019, 08:45:09 PM »

I would guess the line isn't being ignored, but overwritten by the autofit process.

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5391 on: October 15, 2019, 07:18:16 AM »

I would guess the line isn't being ignored, but overwritten by the autofit process.
Seems like my only choice is to allow it to be equipped and give harsh penalities during combat instead....
Hullmods are called during combat right? how do i check it? Looking if the Global.combatengine != null?
Logged
Check out my ships

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 #5392 on: October 15, 2019, 10:06:52 AM »

if there is a way to change settings in game?
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5393 on: October 15, 2019, 10:48:40 AM »

What determines what colour a weapon mount cover is?

It's automatically calculated based on the colors of the ship sprite, and can be overridden using "coversColor" in .ship and .skin files.

I would guess the line isn't being ignored, but overwritten by the autofit process.
Seems like my only choice is to allow it to be equipped and give harsh penalities during combat instead....
Hullmods are called during combat right? how do i check it? Looking if the Global.combatengine != null?

See: HullModEffect.advanceInCombat(). Also you can apply effects in HullModEffect.applyEffectsAfterShipCreation().

if there is a way to change settings in game?

If you mean settings.json-type settings, then mostly (aside from dev mode) no, I don't believe so.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5394 on: October 15, 2019, 11:09:14 AM »

See: HullModEffect.advanceInCombat(). Also you can apply effects in HullModEffect.applyEffectsAfterShipCreation().

I see, i can change how my hullmods work then, instead of using a workaround to unequip stuff i will make guns malfuncion during combat and fighters... could just explode i guess?
Logged
Check out my ships

cerberus00

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5395 on: October 15, 2019, 04:09:41 PM »

I'm very new to modding and I have no java experience, but I'm willing to learn and would like to work on a special faction that raids and has dormant fleets in debris fields. Is this feasible? I've tried looking for tutorials on making special factions that don't have homes or bases but it doesn't seem like there's much out there. Anyone have suggestions on where to find some instruction on it? Thanks.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5396 on: October 15, 2019, 06:28:48 PM »

There is only one instance of each hullmod right? so you can't use variables outside the methods since all ships that have a hullmod would share the same value right?

Also is there a problem in assigning stat modifications in applyEffectsAfterShipCreation instead of applyEffectsBeforeShipCreation? Since i have to redo the check when the player equips something
« Last Edit: October 15, 2019, 06:31:16 PM by Ed »
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24118
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5397 on: October 15, 2019, 06:56:44 PM »

There is only one instance of each hullmod right? so you can't use variables outside the methods since all ships that have a hullmod would share the same value right?

Correct. If in the campaign, you can store stuff in Global.getSector().getPersistentData().

Also is there a problem in assigning stat modifications in applyEffectsAfterShipCreation instead of applyEffectsBeforeShipCreation? Since i have to redo the check when the player equips something

I'm not exactly sure what you mean. You could do either, I suppose; some stats don't take effect when changed in applyEffectsAfterShipCreation - namely, max armor and hull values; iirc everything else (or almost?) will work.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5398 on: October 15, 2019, 07:23:28 PM »

There is only one instance of each hullmod right? so you can't use variables outside the methods since all ships that have a hullmod would share the same value right?

Correct. If in the campaign, you can store stuff in Global.getSector().getPersistentData().

Also is there a problem in assigning stat modifications in applyEffectsAfterShipCreation instead of applyEffectsBeforeShipCreation? Since i have to redo the check when the player equips something

I'm not exactly sure what you mean. You could do either, I suppose; some stats don't take effect when changed in applyEffectsAfterShipCreation - namely, max armor and hull values; iirc everything else (or almost?) will work.

Thanks!

Reworked my hullmod, no more duplication exploits!
Logged
Check out my ships

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #5399 on: October 16, 2019, 12:47:52 PM »

I tried out:

Code

"engineSlotChanges":{
   "0":{
"style":"CUSTOM",
"styleId":"COBRA_BOMBER",
},
   "1":{
"style":"CUSTOM",
"styleId":"COBRA_BOMBER",
},
},


And it crashes with a nullpointer. Is this possible using a skin file? I may have my syntax wrong but it matches the way weapons are changed.
Logged
Pages: 1 ... 358 359 [360] 361 362 ... 710