Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.95.1a is out! (12/10/21); Blog post: Uniquifying the Factions, Part 2 (04/30/22)

Pages: 1 ... 561 562 [563] 564 565 ... 586

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

SafariJohn

  • Admiral
  • *****
  • Posts: 2446
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8430 on: January 20, 2022, 09:02:08 AM »

How are we supposed to do multi-line short descriptions for ships? In 0.9.1a I was able to use text2, but that doesn't work anymore.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8431 on: January 20, 2022, 09:20:32 AM »

I don't understand exactly what you mean.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 2446
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8432 on: January 20, 2022, 09:27:06 AM »

Sorry, multiple paragraphs.

For ship short descriptions, the game uses the first paragraph of text1 in descriptions.csv, right? In older versions I could force-set the short description with multiple paragraphs using text2. Now text2 and text3 have been repurposed for the Ziggurat and there doesn't seem to be a way to force-set a short description.
« Last Edit: January 20, 2022, 09:47:42 AM by SafariJohn »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8433 on: January 20, 2022, 09:33:41 AM »

Ah - thank you for clarifying. Hmm, I'm not even sure that was ever intentional, might have been some kind of fallback code - but regardless, I don't think this can be done now, sorry!
Logged

itBeABruhMoment

  • Lieutenant
  • **
  • Posts: 52
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8434 on: January 21, 2022, 01:19:14 PM »

How do you determine if a ship is officered from its FleetMemberAPI? I couldn't find a chain of methods ending with some sort of "hasOfficer" method.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8435 on: January 21, 2022, 02:49:21 PM »

Check out com.fs.starfarer.api.impl.campaign.skills.WolfpackTactics.isFrigateAndOfficer()

Note that the isDefault() method will also return false if the person is isAICore(), if that's a meaningful distinction for you.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 3789
    • View Profile
    • Bitbucket profile
    • Email
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8436 on: January 22, 2022, 01:18:14 AM »

If I'm getting a stack overflow on trying to save my game, what would be a good way to find what's causing it?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8437 on: January 22, 2022, 10:01:46 AM »

Presumably, you're getting a stack trace to go along with it? It's either going to be infinite recursion, which you can usually tell from the trace where it happens, or, if that's not it, it's probably the stack legitimately being too large for the amount of memory allocated to it, in which case increasing the (off the top of my head) -Xss would be the solution.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2141
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8438 on: January 22, 2022, 10:03:47 AM »

Is DMOD_EFFECT_MULT currently modifiable using MutableFleetStatsAPI? Using modifyMult or modifyPercent doesn't seem to do anything:

Code
    public static final float DMOD_EFFECT_REDUCTION = 0.5f;

    MutableFleetStatsAPI.getDynamic().getMod(Stats.DMOD_EFFECT_MULT).modifyMult(id, DMOD_EFFECT_REDUCTION);

I've also tried:

Code
    public static final float DMOD_EFFECT_REDUCTION = 50f;

    MutableFleetStatsAPI.getDynamic().getMod(Stats.DMOD_EFFECT_MULT).modifyPercent(id, -DMOD_EFFECT_REDUCTION);

And I've also tried MutableFleetStatsAPI.getDynamic().getStat(Stats.DMOD_EFFECT_MULT) just in case - though I'd think this was a mod and not a stat.

The test for this is Faulty Power Grid since its easier to see whether the max flux is reduced by 20% or 10% with the skill.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8439 on: January 22, 2022, 10:15:11 AM »

No, it's not a fleet stat. Generally if you look at the source of Stats.java the variables are grouped together by what kind of thing they affect, and there's some comments explaining what section is for what.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2141
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8440 on: January 22, 2022, 10:39:03 AM »

No, it's not a fleet stat. Generally if you look at the source of Stats.java the variables are grouped together by what kind of thing they affect, and there's some comments explaining what section is for what.

Ah I missed:

   // ships

At the top of that list!  Thanks for clarifying.

Hmm, can you think of anything off hand that would go wrong if I created an everyFrameScript that did nothing but had public methods to apply/unapply this affect to all ships in the fleet?

Nvm, as I was typing this I immediately thought of one: it wouldn't handle a player adding or removing ships from the fleet unless I set up some kind of tracker and that's already getting too complicated. I'll just find a better effect for the skill.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2141
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8441 on: January 22, 2022, 12:06:05 PM »

No, it's not a fleet stat. Generally if you look at the source of Stats.java the variables are grouped together by what kind of thing they affect, and there's some comments explaining what section is for what.

Sorry for the follow up post but I'm curious as to why implementing the same logic using ShipSkillEffect in order to access MutableShipStatsAPI instead of MutableFleetStatsAPI and then setting the script to run with ALL_SHIPS_IN_FLEET also doesn't seem to work.

It know that process works with other skills.

And I also tried modifying it with just the ship with the officer. Still doesn't seem to work.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8442 on: January 22, 2022, 12:09:29 PM »

Sorry for the follow up post but I'm curious as to why implementing the same logic using ShipSkillEffect in order to access MutableShipStatsAPI instead of MutableFleetStatsAPI and then setting the script to run with ALL_SHIPS_IN_FLEET also doesn't seem to work.

It know that process works with other skills.

As you say, it works with other skills, so the most likely answer is you didn't set something up correctly.

In particular, make sure that ALL_SHIPS_IN_FLEET is specified for that effect in the .skill file, too.
Logged

Morrokain

  • Admiral
  • *****
  • Posts: 2141
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8443 on: January 22, 2022, 01:18:47 PM »

As you say, it works with other skills, so the most likely answer is you didn't set something up correctly.

In particular, make sure that ALL_SHIPS_IN_FLEET is specified for that effect in the .skill file, too.

Hmm, no, after extensive testing I'm 99.9% sure that this just doesn't work as intended. :( I changed it to only affect the flagship and added functionality test controls:

Code
# control 1 - ensures things are applied to flagship correctly - should make shield efficiency 0.8 instead of 1.0
"scope":"PILOTED_SHIP",
"effectGroups":[
{
"requiredSkillLevel":1,
"effectBasedOnLevel":false,
"effects":[
#{"type":"CHARACTER_STATS", "script":"data.scripts.skills.ArcheusFieldRepairs$Level1"},
#{"type":"ALL_SHIPS_IN_FLEET", "script":"data.scripts.skills.ArcheusFieldRepairs$Level2"},
{"type":"SHIP", "script":"data.scripts.skills.ArcheusFieldRepairs$Level5"},
{"type":"SHIP", "script":"com.fs.starfarer.api.impl.campaign.skills.ShieldModulation$Level2"},
]
},

Code
	public static class Level5 implements ShipSkillEffect {
public void apply(MutableShipStatsAPI stats, HullSize hullSize, String id, float level) {
stats.getDynamic().getMod(Stats.DMOD_EFFECT_MULT).modifyMult(id, 1 - DMOD_EFFECT_REDUCTION / 100);
stats.getMaxSpeed().modifyFlat(id, (1 - DMOD_EFFECT_REDUCTION / 100) * 10);
}

public void unapply(MutableShipStatsAPI stats, HullSize hullSize, String id) {
stats.getDynamic().getMod(Stats.DMOD_EFFECT_MULT).unmodify(id);
stats.getMaxSpeed().unmodify(id);
}

public String getEffectDescription(float level) {
return "Reduces the negative effects of d-mods by " + (int) DMOD_EFFECT_REDUCTION + "%";
}

public String getEffectPerLevelDescription() {
return null;
}

public ScopeDescription getScopeDescription() {
return ScopeDescription.ALL_SHIPS;
}
}

 // control 2 and math double check - should raise test speed by 4 after degraded engines factored in and proves that data.scripts.skills.ArcheusFieldRepairs$Level5 is being ran

Results: (I even tested in the simulator to make sure it wasn't just the tooltip not being updated.)

Spoiler



[close]

 - It doesn't show up in the officer tooltip because CombatOfficer isn't set to TRUE in skill_data.csv, but that doesn't prevent the actual effects from taking place as is verified by shield modulation level 2 being applied correctly as well as the small speed boost by my script. I also tested modifyPercent() and getStat() instead of getMod() under these conditions. Same results.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 20364
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #8444 on: January 22, 2022, 03:33:52 PM »

What am I looking at that shows the dmod effect multiplier not applying?

Rugged Construction works, and the effects of skills are applied before hullmods, so I strongly suspect you've got something hooked up wrong somewhere.

Also, of note, you've got this:
{"type":"SHIP", "script":"data.scripts.skills.ArcheusFieldRepairs$Level5"},

Which does not match what you've been saying about wanting it to apply fleetwide.
Logged
Pages: 1 ... 561 562 [563] 564 565 ... 586