Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Question about modifying player skills  (Read 741 times)

BigBrainEnergy

  • Admiral
  • *****
  • Posts: 698
    • View Profile
Question about modifying player skills
« on: May 25, 2023, 07:52:10 AM »

So I wanted to tweak some values for player skills and went into [starfarer.api.zip\com\fs\starfarer\api\impl\campaign\skills] but changing the values listed in the skill files here (such as: [public static float NUM_OFFICERS_BONUS]) didn't effect anything in game. What am I missing?
Logged
TL;DR deez nuts

starman13

  • Ensign
  • *
  • Posts: 40
    • View Profile
Re: Question about modifying player skills
« Reply #1 on: May 25, 2023, 03:43:19 PM »

I have a small personal mod that modifies this skills this way

Code
package tweaks;

import com.fs.starfarer.api.BaseModPlugin;
import com.fs.starfarer.api.impl.campaign.skills.*;

public class TweaksMod extends BaseModPlugin {

    @Override
    public void onApplicationLoad() {
        // Modify skills for less immediate impact but same long-term value.
        BulkTransport.CARGO_CAPACITY_THRESHOLD = 4000;
        BulkTransport.FUEL_CAPACITY_THRESHOLD = 4000;
        BulkTransport.PERSONNEL_CAPACITY_THRESHOLD = 10000;
        BulkTransport.CARGO_CAPACITY_MAX_PERCENT = 20;
        BulkTransport.FUEL_CAPACITY_MAX_PERCENT = 20;
        BulkTransport.PERSONNEL_CAPACITY_MAX_PERCENT = 20;
        MakeshiftEquipment.SUPPLY_USE_REDUCTION_MAX_PERCENT = 25;
        ContainmentProcedures.FUEL_USE_REDUCTION_MAX_PERCENT = 25;
        Sensors.SENSOR_BONUS = 100.0F;
        OfficerManagement.NUM_OFFICERS_BONUS = 3.0F;
    }

}

Jaghaimo

  • Admiral
  • *****
  • Posts: 661
    • View Profile
Re: Question about modifying player skills
« Reply #2 on: May 26, 2023, 01:36:44 AM »

To add on to that, you will also need `mod_info.json` and point entry point at that file starman13 posted. Could probably work without compilation (letting Janino do the work).
Logged

TheDeviL234

  • Ensign
  • *
  • Posts: 30
    • View Profile
Re: Question about modifying player skills
« Reply #3 on: May 26, 2023, 07:26:52 PM »

So I wanted to tweak some values for player skills and went into [starfarer.api.zip\com\fs\starfarer\api\impl\campaign\skills] but changing the values listed in the skill files here (such as: [public static float NUM_OFFICERS_BONUS]) didn't effect anything in game. What am I missing?
Report to moderator    Logged

to clarify, starfarer.api.zip is the uncompiled version (source code) of starfarer.api.jar, and the game only loads the .jar.
if you want to change something in the .jar, the best way to to that is to make a mod like this:

I have a small personal mod that modifies this skills this way

Code
package tweaks;

import com.fs.starfarer.api.BaseModPlugin;
import com.fs.starfarer.api.impl.campaign.skills.*;

public class TweaksMod extends BaseModPlugin {

    @Override
    public void onApplicationLoad() {
        // Modify skills for less immediate impact but same long-term value.
        BulkTransport.CARGO_CAPACITY_THRESHOLD = 4000;
        BulkTransport.FUEL_CAPACITY_THRESHOLD = 4000;
        BulkTransport.PERSONNEL_CAPACITY_THRESHOLD = 10000;
        BulkTransport.CARGO_CAPACITY_MAX_PERCENT = 20;
        BulkTransport.FUEL_CAPACITY_MAX_PERCENT = 20;
        BulkTransport.PERSONNEL_CAPACITY_MAX_PERCENT = 20;
        MakeshiftEquipment.SUPPLY_USE_REDUCTION_MAX_PERCENT = 25;
        ContainmentProcedures.FUEL_USE_REDUCTION_MAX_PERCENT = 25;
        Sensors.SENSOR_BONUS = 100.0F;
        OfficerManagement.NUM_OFFICERS_BONUS = 3.0F;
    }

}

decompiling .class files from the .jar directly, editing them, and recompiling them back is also possible, but it's pretty advanced.


EDIT:
turned starman13's code into a mod.
download it here
and add/change what you want.
« Last Edit: May 27, 2023, 09:23:25 AM by TheDeviL234 »
Logged

woodnoah

  • Ensign
  • *
  • Posts: 6
    • View Profile
Re: Question about modifying player skills
« Reply #4 on: September 13, 2023, 12:52:48 AM »

So I wanted to tweak some values for player skills and went into [starfarer.api.zip\com\fs\starfarer\api\impl\campaign\skills] but changing the values listed in the skill files here (such as: [public static float NUM_OFFICERS_BONUS]) didn't effect anything in game. What am I missing?
Report to moderator    Logged

to clarify, starfarer.api.zip is the uncompiled version (source code) of starfarer.api.jar, and the game only loads the .jar.
if you want to change something in the .jar, the best way to to that is to make a mod like this:

I have a small personal mod that modifies this skills this way

Code
package tweaks;

import com.fs.starfarer.api.BaseModPlugin;
import com.fs.starfarer.api.impl.campaign.skills.*;

public class TweaksMod extends BaseModPlugin {

    @Override
    public void onApplicationLoad() {
        // Modify skills for less immediate impact but same long-term value.
        BulkTransport.CARGO_CAPACITY_THRESHOLD = 4000;
        BulkTransport.FUEL_CAPACITY_THRESHOLD = 4000;
        BulkTransport.PERSONNEL_CAPACITY_THRESHOLD = 10000;
        BulkTransport.CARGO_CAPACITY_MAX_PERCENT = 20;
        BulkTransport.FUEL_CAPACITY_MAX_PERCENT = 20;
        BulkTransport.PERSONNEL_CAPACITY_MAX_PERCENT = 20;
        MakeshiftEquipment.SUPPLY_USE_REDUCTION_MAX_PERCENT = 25;
        ContainmentProcedures.FUEL_USE_REDUCTION_MAX_PERCENT = 25;
        Sensors.SENSOR_BONUS = 100.0F;
        OfficerManagement.NUM_OFFICERS_BONUS = 3.0F;
    }

}

decompiling .class files from the .jar directly, editing them, and recompiling them back is also possible, but it's pretty advanced.


EDIT:
turned starman13's code into a mod.
download it here
and add/change what you want.



 MakeshiftEquipment.SUPPLY_USE_REDUCTION_MAX_PERCENT = 25;
        ContainmentProcedures.FUEL_USE_REDUCTION_MAX_PERCENT = 25;



These two are percentage values,

Do you know what the attributes within the object are for direct values

For example, this:

MakeshiftEquipment.SUPPLY_USE_REDUCTION_MAX_UNITS = 10000;

But I couldn't find the relevant properties of ContainementProcedures because I didn't have the project source file



Do you know anything
Logged