Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Pages: 1 ... 330 331 [332] 333 334 ... 710

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

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4965 on: September 04, 2019, 01:17:59 PM »

This looks like a "the variant of the ship is null" issue caused by Vayra's Ship Pack; same underlying issue as that other thread about it a bit back.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1727
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4966 on: September 04, 2019, 01:32:33 PM »

Ok, thanks Alex. Sorry to bother you again about the same thing. It looked pretty different to me. Glad it's apparently not my fault!

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4967 on: September 04, 2019, 01:37:48 PM »

No worries! Yeah, it looked different to me, too - needed to look at the source code to make sense of it, and thankfully there was literally only way way it could NPE in that 3-line method.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4968 on: September 04, 2019, 02:17:34 PM »

Where is the script for Drive Field Stabilization (the Ox hullmod)? I can't find it in the vanilla files.
Logged
Check out my ships

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4969 on: September 04, 2019, 02:46:40 PM »

You can check hull_mods.csv to see what the hullmod's script; for this one it's com.fs.starfarer.api.impl.hullmods.DriveFieldStabilizer

The API's source code is in the starfarer.api.zip file. Changing it there would have no effect, btw, it's already compiled into a jar and is only provided for reference.
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4970 on: September 04, 2019, 04:23:09 PM »

You can check hull_mods.csv to see what the hullmod's script; for this one it's com.fs.starfarer.api.impl.hullmods.DriveFieldStabilizer

The API's source code is in the starfarer.api.zip file. Changing it there would have no effect, btw, it's already compiled into a jar and is only provided for reference.
Thanks

I want it for reference, i want to make a hullmod that does something similar.
Logged
Check out my ships

Innominandum

  • Commander
  • ***
  • Posts: 166
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4971 on: September 04, 2019, 04:36:09 PM »

You can check hull_mods.csv to see what the hullmod's script; for this one it's com.fs.starfarer.api.impl.hullmods.DriveFieldStabilizer

The API's source code is in the starfarer.api.zip file. Changing it there would have no effect, btw, it's already compiled into a jar and is only provided for reference.
Thanks

I want it for reference, i want to make a hullmod that does something similar.
- 2 Burn + 50% Fuel Consumption ?

Logged
"The early worm catcheth the bird."

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4972 on: September 04, 2019, 04:57:33 PM »


- 2 Burn + 50% Fuel Consumption ?

+4 burn actually, this is for my huge logistics ship, it will do the work of 4 Ox tugs in one huge ship

Logged
Check out my ships

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4973 on: September 04, 2019, 05:02:57 PM »

Quite new to the API, need a bit of help here

How would i turn this line from "Get the cost of these bombers and increase by BOMBER_COST_PERCENT" to "Get the cost of these bombers and increase by BOMBER_COST_PERCENT IF they are not drones (0 crew?) AND cost less than 5 OP"?

Code
stats.getDynamic().getMod(Stats.BOMBER_COST_MOD).modifyPercent(id, BOMBER_COST_PERCENT);

I don't know the syntax to add conditions here.
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 #4974 on: September 04, 2019, 05:21:53 PM »

This should work: (Edit: not for what you're trying to do though)
Code
        if(fighter.getHullSpec().getMinCrew() > 0 && fighter.getHullSpec().getOrdnancePoints(null) < 5)
Edit: It looks like you're trying to adjust the ordnance point cost of bombers that meet those criteria. If so, I don't think there's a way to do it. The problem is that that stat modification needs to be applied to the carrier, not the bomber, and there's no way to pick and choose which bombers it applies to.
« Last Edit: September 04, 2019, 05:31:16 PM by Sundog »
Logged

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4975 on: September 04, 2019, 05:58:09 PM »

This should work: (Edit: not for what you're trying to do though)
Code
        if(fighter.getHullSpec().getMinCrew() > 0 && fighter.getHullSpec().getOrdnancePoints(null) < 5)
Edit: It looks like you're trying to adjust the ordnance point cost of bombers that meet those criteria. If so, I don't think there's a way to do it. The problem is that that stat modification needs to be applied to the carrier, not the bomber, and there's no way to pick and choose which bombers it applies to.

What i really want is to limit the ship to only be able to equip wings that are Drones and have very low OP (weak drones only), i figured making all other wings have a prohibitive cost would be a good solution. Guess not :(
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 #4976 on: September 04, 2019, 06:17:39 PM »

Ah, ok. Sylphon RnD does something similar to what you want, although the implementation is imperfect. If I remember correctly, it allows you to assign any fighter, but then removes it if it's not a drone.

I don't know exactly what you're trying to accomplish, but perhaps a better approach would be to discourage crewed fighters instead of outright disallowing them. For example, the hullmod could automate all crewed fighters, preventing crew casualties from fighter losses, but also reducing their effectiveness.

Ed

  • Captain
  • ****
  • Posts: 442
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4977 on: September 04, 2019, 08:21:32 PM »

Ah, ok. Sylphon RnD does something similar to what you want, although the implementation is imperfect. If I remember correctly, it allows you to assign any fighter, but then removes it if it's not a drone.

I don't know exactly what you're trying to accomplish, but perhaps a better approach would be to discourage crewed fighters instead of outright disallowing them. For example, the hullmod could automate all crewed fighters, preventing crew casualties from fighter losses, but also reducing their effectiveness.

I have a ship that would be too strong if it could just put anything in the fighter bays, so i wanted to balance it this way, i will check the Sylphon RnD solution, thanks for the tip!
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 #4978 on: September 05, 2019, 09:06:22 AM »

What's the difference between ListenerManagerAPI and getAllListeners() in sectorAPI.
I found that if I add my listener by Global.getSector().addListener, listener manager seems won't contain that listener.
Logged
My mods


Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 24128
    • View Profile
Re: Misc modding questions that are too minor to warrant their own thread
« Reply #4979 on: September 05, 2019, 09:40:45 AM »

What's the difference between ListenerManagerAPI and getAllListeners() in sectorAPI.
I found that if I add my listener by Global.getSector().addListener, listener manager seems won't contain that listener.

SectorAPI.getAllListeners() - and other methods, like addListener() etc - are for CampaignEventListener only.

SectorAPI.getListenerManager() is for... just about anything. E.G. mods can even add their own types of listeners that the core game is not explicitly aware of. See: com.fs.starfarer.api.campaign.listeners.ListenerUtil for how listeners added to ListenerManagerAPI are used.
Logged
Pages: 1 ... 330 331 [332] 333 334 ... 710