1
Modding / Re: [0.9.1.a RC8] Can't seem to override "maxIndustries".
« on: September 27, 2019, 04:45:49 PM »
Nah, this just sets the baseline. PO3 adds a bonus separately. To change that bonus, you have to find this file:
Then, copy it into your mod keeping the structure & filename intact. This is the file the game uses to find the right class to use for the handling the bonus.
In that .skill file you will find:
What you want to do is change `com.fs.starfarer.api.impl.campaign.skills.PlanetaryOperations$Level3A` to target your own code (class) instead. This means you have to create a .java file that either implements or extends Level3A (or use the copied code as a starting point), save it somewhere with the right package name, and change the script target to your `new.package.ClassName`.
You can find the existing implementation of that still in `starfarer.api.zip` under `com\fs\starfarer\api\impl\campaign\skills\PlanetaryOperations.java`.
In short, copy that file to the same dir as the .skill file, change the package to `package data.characters.skills;`, then edit it as you see fit.
Keep in mind this will only change `Level3A` since that's what the script points to. You'd have to change the other script targets in the .skill file if you want the other levels to be altered too.
If you leave the `Level3A` as a inner class, your new target will be something like `data.characters.skills.PlanetaryOperations$Level3A` (Assuming you put it in {mod}\data\characters\skills). You only need to include inner & outer class names (separated by '$') if you leave the file as is.
If you move Level3A to an outer class, it would just be `data.characters.skills.Level3A` (Or whatever you've named the class.)
Note: Make sure the file name matches the top-level class.
Odds are you'll hit a syntax error or something along the way but those get printed straight to starsector.log so it's easy to check.
PS: You can actually setup a java IDE project and set `starfarer.api.zip` as a dependency to help you make edit the file. If you do, symlink your 'data' folder into the projects 'src' folder. (So it looks like {project root}\src\data\...) This should let you edit the files whilst keeping them where they need to be for the mod.
That will help you with everything you've forgotten about java.
PPS: If you do go the IDE route, make sure the project is set for java 1.7 as that is the IDE that's bundled with the game. (JAVA_VERSION="1.7.0")
Code
data\characters\skills\planetary_operations.skill
In that .skill file you will find:
Code
{
"name":"Level 3",
"requiredSkillLevel":3,
"effectBasedOnLevel":false,
"effects":[
{"type":"GOVERNED_OUTPOST", "script":"com.fs.starfarer.api.impl.campaign.skills.PlanetaryOperations$Level3A"},
]
},
What you want to do is change `com.fs.starfarer.api.impl.campaign.skills.PlanetaryOperations$Level3A` to target your own code (class) instead. This means you have to create a .java file that either implements or extends Level3A (or use the copied code as a starting point), save it somewhere with the right package name, and change the script target to your `new.package.ClassName`.
You can find the existing implementation of that still in `starfarer.api.zip` under `com\fs\starfarer\api\impl\campaign\skills\PlanetaryOperations.java`.
In short, copy that file to the same dir as the .skill file, change the package to `package data.characters.skills;`, then edit it as you see fit.
Keep in mind this will only change `Level3A` since that's what the script points to. You'd have to change the other script targets in the .skill file if you want the other levels to be altered too.
If you leave the `Level3A` as a inner class, your new target will be something like `data.characters.skills.PlanetaryOperations$Level3A` (Assuming you put it in {mod}\data\characters\skills). You only need to include inner & outer class names (separated by '$') if you leave the file as is.
If you move Level3A to an outer class, it would just be `data.characters.skills.Level3A` (Or whatever you've named the class.)
Note: Make sure the file name matches the top-level class.
Odds are you'll hit a syntax error or something along the way but those get printed straight to starsector.log so it's easy to check.
PS: You can actually setup a java IDE project and set `starfarer.api.zip` as a dependency to help you make edit the file. If you do, symlink your 'data' folder into the projects 'src' folder. (So it looks like {project root}\src\data\...) This should let you edit the files whilst keeping them where they need to be for the mod.
That will help you with everything you've forgotten about java.
PPS: If you do go the IDE route, make sure the project is set for java 1.7 as that is the IDE that's bundled with the game. (JAVA_VERSION="1.7.0")