Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 669 670 [671] 672 673 ... 711

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

alaricdragon

  • Commander
  • ***
  • Posts: 163
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10050 on: July 31, 2023, 06:29:11 PM »

2) I'm not sure what "cut off" means in this context. You can check market.hasCondition(Conditions.HOSTILE_ACTIVITY) or something similar to see if it has the condition, or you could check its accessibility if you care about it in a more general sense.
im attempting to refer to what happens when you try to interact with a object on the map, and you cant because there is a hostile fleet nearby. it says something about there being 'a hostile fleet tracking your movement nearby' (or something like that), and talks about how you cant do anything well there is a hostile fleet right next to you.

also quick question because its bugging me, do you happen to know were the class/function 'TooltipMakerAPI.addSkillPanel(person,pad);' is implemented? i want to edit the code to work with admin skills, but am unable to find it anywhere in starsector core, for some reason.

and thank you for your responses. understanding a program can be hard sometimes and the answers i receive on this tread help a lot.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10051 on: July 31, 2023, 08:59:35 PM »

Re: nearby hostiles - ahh, I see! Generally that's checked in rules, using the HostileFleetNearbyAndAware command. If you wanted to check this in code, you could create a new instance of it and call its .execute() method. The problem is that it's not *guaranteed* that this is all that's checked for; a specific interaction may be checking for something else, and there's no general flag that's set for this state. So whatever you do would likely need to be on a case-by-case basis, checking what the rules do in that specific situation.

Re: TooltipMakerAPI.addSkillPanel(person,pad) - it's outside the API, in core vanilla code that's not (easily) mod-accessible, so you're kind of on your own there.
Logged

Lukas04

  • Captain
  • ****
  • Posts: 372
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10052 on: August 02, 2023, 06:39:24 AM »

Is there any way to prevent hostile activity from counting a fleet towards its "Hostile Fleet Destroyed" counter? Certain things become easy to farm nearby player colonies and it breaks the system entirely.
So just looking for a way to blacklist a fleet from the system.
Logged
My Mods

johnaaron

  • Ensign
  • *
  • Posts: 23
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10053 on: August 02, 2023, 07:15:49 AM »

Is there a way to turn off certain combat messages completely (e.g. combat readiness warnings)?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10054 on: August 02, 2023, 08:19:00 PM »

Is there any way to prevent hostile activity from counting a fleet towards its "Hostile Fleet Destroyed" counter? Certain things become easy to farm nearby player colonies and it breaks the system entirely.
So just looking for a way to blacklist a fleet from the system.

You could try setting HostileActivityEventIntel.FP_PER_POINT to some very high value situationally (i.e. when the battle about to be reported is one you want to exclude). It'd still net at least one point, though. (Also: changes to the HA system will I *think* make this mostly moot in the .1 release?)

Is there a way to turn off certain combat messages completely (e.g. combat readiness warnings)?

I don't think so, but you could turn off the sounds by setting their volume to zero in data/config/sounds.json.

cr_playership_critical
cr_allied_critical
cr_playership_malfunction
cr_allied_malfunction
cr_playership_warning
cr_allied_warning
Logged

johnaaron

  • Ensign
  • *
  • Posts: 23
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10055 on: August 04, 2023, 04:48:20 AM »

If I want to disable d-mod removal from the Hull Restoration skill, I can just treat the .skill like a .json and remove these lines right? (level2, level4A, level4B)

Code
{
"id":"hull_restoration",
"governingAptitude":"industry",
"compressHullmods":false,
"scope":"FLEET",
"effectGroups":[
{
"requiredSkillLevel":1,
"effectBasedOnLevel":false,
"effects":[
{"type":"FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level1"},
// REMOVE {"type":"ALL_SHIPS_IN_FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level2"},
// REMOVE {"type":"FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level4A"},
// REMOVE {"type":"FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level4B"},
{"type":"ALL_SHIPS_IN_FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level3"},
]
},
],
}
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4692
    • View Profile
    • GitHub profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10056 on: August 04, 2023, 11:44:47 PM »

When writing a save, does the game have anything that would serialize a variant with source REFIT as a STOCK variant?

Context: Been trying to confirm the origin of a bug where a ship, having been transferred from player fleet to an NPC fleet, loses its variant after save/load.
(The NPC fleet had fleet.setInflated(true); and fleet.setInflater(null); called after the fleet members were added to it; all the variants also had their sources set to REFIT and tagged as no_autofit)

If I want to disable d-mod removal from the Hull Restoration skill, I can just treat the .skill like a .json and remove these lines right? (level2, level4A, level4B)

Code
{
"id":"hull_restoration",
"governingAptitude":"industry",
"compressHullmods":false,
"scope":"FLEET",
"effectGroups":[
{
"requiredSkillLevel":1,
"effectBasedOnLevel":false,
"effects":[
{"type":"FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level1"},
// REMOVE {"type":"ALL_SHIPS_IN_FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level2"},
// REMOVE {"type":"FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level4A"},
// REMOVE {"type":"FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level4B"},
{"type":"ALL_SHIPS_IN_FLEET", "script":"com.fs.starfarer.api.impl.campaign.skills.HullRestoration$Level3"},
]
},
],
}
Assuming those are the right effect levels in the skill's java class, that should work yes. (Note that Starsector uses '#' for JSON comments)
« Last Edit: August 04, 2023, 11:47:13 PM by Histidine »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10057 on: August 07, 2023, 12:47:23 PM »

When writing a save, does the game have anything that would serialize a variant with source REFIT as a STOCK variant?

Context: Been trying to confirm the origin of a bug where a ship, having been transferred from player fleet to an NPC fleet, loses its variant after save/load.
(The NPC fleet had fleet.setInflated(true); and fleet.setInflater(null); called after the fleet members were added to it; all the variants also had their sources set to REFIT and tagged as no_autofit)

I'm sorry about the delayed response! Been plugging away at stuff and, in all honesty, just forgetting to check this thread often enough.

Ah, hmm, it will do that - if variant.getOriginalVariant() returns non-null, the game will set the ship to that when it deflates the fleet prior to saving. I think calling variant.setOriginalVariant(null) in addition to what you were doing should sort it out.
Logged

Lukas04

  • Captain
  • ****
  • Posts: 372
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10058 on: August 08, 2023, 01:44:25 PM »

Edit: found the solution for my question so nvm.
« Last Edit: August 08, 2023, 02:01:38 PM by Lukas04 »
Logged
My Mods

alaricdragon

  • Commander
  • ***
  • Posts: 163
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10059 on: August 10, 2023, 01:45:12 PM »

hello once again my fellow life forms. i have returned with another set of questions
1) is there any way to run code right after a player founds a market, like some type of 'market founded listener'?
2) how do i grey out options (so you cant click on them), like what happens with 'establish a colony' when in a system with no hyperspace accuses?
once more i thank all you kind people for answering all of my previous of my silly questions. its very kind of you all.
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3026
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10060 on: August 10, 2023, 04:52:22 PM »

hello once again my fellow life forms. i have returned with another set of questions
1) is there any way to run code right after a player founds a market, like some type of 'market founded listener'?
2) how do i grey out options (so you cant click on them), like what happens with 'establish a colony' when in a system with no hyperspace accuses?
once more i thank all you kind people for answering all of my previous of my silly questions. its very kind of you all.

1 - Add a PlayerColonizationListener with Global.getSector().getListenerManager().addListener()

2 - OptionPanelAPI.setEnabled()
Logged

Liral

  • Admiral
  • *****
  • Posts: 718
  • Realistic Combat Mod Author
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10061 on: August 10, 2023, 09:01:49 PM »

How can I let all ships naturally accelerate past the 600 speed limit?

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10062 on: August 11, 2023, 10:52:44 AM »

How can I let all ships naturally accelerate past the 600 speed limit?

You can't, it's a hardcoded limit. Part of the reason it exists is for collision reliability etc; I'd imagine things start breaking down visibly at some point after that's exceeded.
Logged

rogerbacon

  • Commander
  • ***
  • Posts: 151
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10063 on: August 12, 2023, 09:48:26 AM »

There is a cool hull mod that creates mines using engine.spawnProjectile(). It passes in null for the weaponAPI parameter and creates a "mineLayer1" projectile. I wanted to change it to create a "sabot" projectile. However, that projectile has an OnHitEffect that has projectile.getWeapon().get.... which results in a null reference exception.
How can I pass an appropriate weaponAPI to spawnProjectile() so that any other script calling getWeapon on the projectile won't be null?
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24157
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #10064 on: August 13, 2023, 10:21:30 AM »

You can use CombatEngineAPI.createFakeWeapon(shipId, weaponId) to create a sabot (or whatever) weapon and use that.
Logged
Pages: 1 ... 669 670 [671] 672 673 ... 711