Hi folks, maybe some modder will be interested in my lazy scripts... I got frustrated by the game because for some gamplays inserting feats is easy while for others I happen to have issues loading saves and the exceptions thrown by the game are not helpful
Anyways, I wrote myself a very simple groovy maven project in IntelliJ IDEA, it's more of a script than a super complex editor, it works on lots of assumptions but gets the job done. This might be helpful if You want to add a few simple feats to Your character, however please keep in mind that there might be issues with it once Your char abilities/feats/activatables and spellbook grow very large as I've found.
I'll try to come back to the game once it's been stabilized a bit by these incoming patches since I remember not having stability issues in 1.00 and now I sometimes can't load the saves properly.. the devs just need to stabilize their product.
With that in mind, here Ya go:
A decent IDE
IntelliJ, Notepad++ or some other good text editor
How it works:
a) You select the feats You'd like to use on Your character, for example Dirty Trick:
* Place the "Dirty Trick" feat object into the Json Table in src/main/resources/feats
* Place all 3 "Dirty Trick" ability feat objects into the Json Table in src/main/resources/abilities
* To make it simply have a actiavableability file with an empty json array in src/main/resources/activatableabilities
Make sure that all file paths are correct with regards to SaveEdit.groovy main class
Code: Select all
def level = "lv3"
def featFile = "combat_feats_" + level + ".json"
def activatableFile = "activatable_abilities_" + level + ".json"
def abilityFile = "abilities_" + level + ".json"
def spellFile = "spells_" + level + ".json"
In this case I'm expecting:
* combat_feats_lv3.json to be in root feats dir
* activatable_abilities_lv3.json to be in root activatableabilities dir
* abilities_lv3.json to be in root abilties dir
* spells_lv3.json to be in root spells dir
How configure this thing to read from the save You wish to add feats to:
Code: Select all
String saveFilePath = "C:\\Users\\NEuRO\\AppData\\LocalLow\\Owlcat Games\\Pathfinder Kingmaker\\Saved Games\\"
Character character = partyMembersCharacterMap.get(PartyMembers.PROTAGONIST)
String saveFile = "Manual_10_before_levelup.zks"
* Change Your saveFilePath to Your windows uer
* Change the character to the one You wish to edit (It supports some party members, but the Enum allows You to add all Companions from the game if You know their prefabs, in this case it's my PROTAGONIST so the script will look for the Custom character name within the script (You can extend this to support Your custom characters
* Change the name of Your save file to the save You wish to edit.
What the script does for You:
a) Opens the .zks save and ONLY extracts party.json (IF You have a large save You'll notice the difference)
b) Backs up the party.json file in src/main/resources/unzippedSaves as party.json.bak
c) Loads up party json as JSON Object ( I had to use Gson, sadly the save nesting is a bit crazy for me) and searches recursively through all "$id" keys to find the highest one (we need it)
d) Works on the party.json to find the character that You wish to edit, based on custom name or prefab (10 standard companions), if the character is found this character's block of data is saved in memory
e) Thanks to knowing the character object we can get two important things:
* Caster Reference (Needed if You want to be able to view Your feats, use them on a character, see them on character sheet)
* Spellbook owner identifier (Needed if You want to be able to add spells to a particular character's spellbook)
Whoo that took a while... I'm a novice code monkey so maybe I'm overcomplicating things.
After all of these things are done we can start making new feats that should not collide with the game data... (SHOULD
I start by incrementing the highest ID by a lot , I add 2000 to the number just to be safe, then I create feats, abilities, activatable abilities, as well as displaying the ID of two-weapon fighting base feat that all characters have in case You'd like to edit that.
Once I have these object prepared I modify the character object that was extracted from party.json and add the new objects - feats under the Progressions ... stuff
and activatable/abilities in their corresponding spots.
Once that is done I display some extra info, so all the character data that was found, as well as replace the old player object with the new one that I just made, ...with String.replace ... might be inefficient but I'm a little bit tired of fighting with recursion.
Once all changes are done, the orginal party.json is overwritten by modified party.json... literally all You have to do is replace the party.json file within the save (yes this can be easily automated if You really want to)
a) Fast and convenient for me,
b) Less human error,
c) Does not beautify the whole json file, the game loads the modified save quite fast... or it crashes quite fast
a) Modified file is still linearized so to compare it with the .bak You should beautify both,
b) I've found no visual bugs but sometimes the saves don't load properly for me so there has to be some mistakes I made
I'm sharing this crap project in case any interested modder would like to use some of my stuff/approach in order to make save editing easier
I'll be back to the game once Owlcat slows down the progress of crazy patches and issues related to them (for example the game refuses to start for some people with 1.0.13 or stuff that's ... sad)