NetroScript / Graveyard-Keeper-Savefile-Editor

Edit, save and export save files from the game Graveyard Keeper - Works for Windows, Linux and macOS
MIT License
108 stars 12 forks source link

[Suggestion] Tech/Perk unlock #57

Open JuniorDallagnolo opened 5 years ago

JuniorDallagnolo commented 5 years ago

Is it possible for you to add to unlock specifics techs? I wanted to tryout a game with the cultist perk from the start (I'm pretty sure it will improve the overall grave keeper experience). Or maybe can you help me out with this individual study-case?

NetroScript commented 5 years ago

It would be possible to add single technologies and or perks. But because of 2 problems this functionality is not included in the editor. The first problem is the display within the GUI, because you could also make a tree like in the game (or maybe even use the game graphics), but it is questionable if the work is warranted - if so many users would even make use of it. The second problem is that I didn't take a look at the (code) depencies of all the technologies and perks (nor did I do any testing besides for unlocking all technologies). F.e. can you only have a later perk if you have all previous ones, or would it work directly if you manually set it. Also there are multiple locations where information related to technologies is stored, do all need to be modified or only one. And if they depend on the earlier ones you would need f.e. a graph like structure which unlocks all dependencies if a user wants a specific unlock.

If you want to know how the editor unlocks all the technologies (at least pre 1.200) you can take a look at the code here https://github.com/NetroScript/Graveyard-Keeper-Savefile-Editor/blob/53eda08f27dd9a5e4ecc6f0a6b81ea66c565ddf9/main.py#L422-L444

But to summarize you have multiple locations for perks. If we talk f.e. just about perks I think the most important attribute in stored in the player variable (the base inventory object) - there you just have 2 lists, 1 list contains the name of the property the other the state. F.e. the _res_type list would have p_cultist as entry and the _res_v list would have 1 as a Single (at the same index). But at the same time the save has the following properties revealed_techs, unlocked_perks and unlocked_techs which are just lists containing strings. What I don't know is - do you need the tech you want revealed and does it need to be at the same time unlocked as a tech and as a perk? Or do you just need the player attributes. For the technologies themself you need to at least add strings to those lists, because there are no properties in the player object for it.

You would need to do testing with those values. But if you want to use f.e. cultist specifically you could just remove other values from the lists in the data.json file.

JuniorDallagnolo commented 5 years ago

Hello, I tried manually creating a Json from a save I just started them going there and giving myself the p_cultist as a object (the same perk format we had before) but after that I was not able to conver the json to a normal save file back. And trying with the .dat option made the save invalid. I'm really sorry for bothering with you on this btw, I just wanted to make a study case that I'm trying to demonstrate for the devs themselves why I think the feature of this perk (being able to see the Skulls) would be better as it's own tech made early on the tree. It would make the whole graveyard corpse handling a much more enjoyble process and not having people relying on save-scum to get their desired organs. Is there any way you could help me create a starting save with just that tech or perk?

NetroScript commented 5 years ago

Like I said the easiest way for you would be to just modify the data.json because otherwise you have to care about the internal datatypes, like adding strings to the list of internal serialized strings, ... . For you to test I removed all the parts of the data.json which are unrelated to cultist. Just replace your data.json (in the data folder, best case just rename it) with this one and then press the unlock all technologies button in the editor and save.

It works for an older save I have.

The data.json file

jhammersholt commented 4 years ago

I second this request - maybe add the ability to just unlock cultist perk as an option in the editor would be awesome 👍 Thx

I tried the data.json file you provided in the editor an pressed unlock all tech,, and it seemed like it only unlocked the cultist tech when i looked at the tech tree however i was able to build all sort of stuff ;)

ghost commented 3 years ago

I managed to create a most minimal data.json to unlock cultist after reading the file uploaded by @NetroScript . Tested on game version 1.310

data.zip

How to use:

Note: the data.json also unlock Meat Fiesta (the starting recipe). This one is easy, just 3 foods, and I don't think there is any way to unlock it again after the tutorial

NetroScript commented 1 year ago

Just to add to what I previously wrote here.

A user asked me how to unlock a single technology, as his game bugged. He now has it fixed, but for other people here is how to do it:

Export the game save as a .html (which is a file type option when exporting as JSON). Open the file, and type the following in the console:

gameSave.savedata.revealed_techs.v.push({
    "v": "The Beginning Of Alchemy",
    "type": 10
})

Export the file as .json, import it in the save editor, save it as a .dat.

In general I advise using revealed_techs and then buying it in game, as unlocked_techs justs allows you to continue the path, and shows it as bought, but it doesn't actually add the unlocks you would get (especially crafts).

I do want to make a complete rewrite of the editor (should I have sufficient time at some point), where unlocking technologies also would be possible. So if you are interested in the technologies I could also already provide you with a list of them.

vincent-lu commented 2 months ago

I've figured out a way to reveal the Cultist tech.

When editing the .html save, run the following 3 commands:

gameSave.serializer.push("Dark body");

gameSave.savedata.revealed_techs.v.push({
  "type": 10,
  "v": "Dark body"
});

gameSave.savedata.unlocked_techs.v.push({
  "type": 10,
  "v": "Dark body"
});

This reveals and unlocks the "Dark Bodies" tech, which is the prerequisite tech for "Cultist". Once you replace the game save with this 1.dat file, you will see the "Cultist" tech revealed, and all you need is to spend the 300 blue points to get it.

The only small glitch with this method is that although you have "Dark Bodies" tech, you won't get any dark organs. But some organs indeed have 4 red skulls and 1 white skull (so, a dark organ) but it still looks like a normal organ, and using them in Alchemy will still produce normal ingredients and not dark organ ingredients.

Once your Inquisitor storyline progressed enough and the Inquisitor asks you to get dark organs for him, actual proper dark organs will start to appear in corpse.

To the best of my knowledge this method doesn't break the game save.