Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

I've created a small python script that reads two JSON files to form a complete unlock file

python3.8 is required to run (probably can run in older version tho)

import json, os
PROFILE_JSON_PATH='./'
PROFILE_JSONFILE='profile.json'
OUTPUT_PROFILE_JSONFILE='test_profile.json'
ENCOUNTERS_JSON_PATH='./'
ENCOUNTERS_JSONFILE='encounters.json'
unlocked = {}
all_cgs = {'animatedCgSeen': [], 'cgSeen': []}
to_unlock = {'animatedCgSeen': [], 'cgSeen': []}
with open(os.path.join(PROFILE_JSON_PATH, PROFILE_JSONFILE), 'r') as f:
    jprofile = json.loads(f.read())
for k, v in jprofile.items():
    if k in ['cgSeen', 'animatedCgSeen']:
        unlocked[k] = v
with open(os.path.join(ENCOUNTERS_JSON_PATH, ENCOUNTERS_JSONFILE), 'r') as f:
    jencounters = json.loads(f.read())
for k, v in jencounters.items():
    for i in v:
        if 'animatedForeground' in i.keys() and i['animatedForeground'] not in all_cgs['animatedCgSeen']:
            all_cgs['animatedCgSeen'].append(i['animatedForeground'])
        if 'foreground' in i.keys() and i['foreground'] not in all_cgs['cgSeen']:
            all_cgs['cgSeen'].append(i['foreground'])
for i in all_cgs['cgSeen']:
    if i not in unlocked['cgSeen']:
        to_unlock['cgSeen'].append(i)
for i in all_cgs['animatedCgSeen']:
    if i not in unlocked['animatedCgSeen']:
        to_unlock['animatedCgSeen'].append(i)
for k, v in to_unlock.items():
    for i in v:
        jprofile[k][i] = 1
with open(os.path.join(PROFILE_JSON_PATH, OUTPUT_PROFILE_JSONFILE), 'w') as f:
    f.write(json.dumps(jprofile, indent=4))

I was running on the local dir for the save files so I didn't need to fiddle with path too much, generating a file called test_profile.json 

The real issue is that the encounters.json file is only found in the .jar file in `script/encounters.json` and it's filled with multiple INVALID JSON so there's a lot to patch up to make this work. I honestly hope they do fix-up the JSON files so this can run smoother.
The idea is to only unlock what you haven't already, hence some checks if the scenes were seen or not.

Thanks, it worked for me 

So, for fulling running this, where would you slap this in for, say, a stock windows unzip and such?

(+1)

I'm sorry I missed this comment, you can use Python from the Windows Store or download the installer from python.org, either should work, you may need to start the IDLE and adapt the path for those files according to your installation 

What about the apparent lack of an encounters.json as of recent?

I've always found those inside the .jar file, with WinRAR (or any other program that you can use to open the Jar file) you find those in `scripts/encounters.json`


Recently the quality of the JSON file improved a lot so there's just a few adjustments that I needed to make in order to run the script

Deleted 2 years ago

hey! I'm really really new to programming, how exactly do i run that? I already have python installed :)

As per this comment is how I do it today:
https://itch.io/post/6606189

I open the files on vscode so it detect failed JSON specs that needs adjustments (usually is like dquotes missing or commas missing)

(1 edit)

I've tried running the code in python to no avail. I don't have experience with coding so I don't know what might be wrong, I just copy-pasted it in python, which resulted in an error with line 6 "jencounters = json.loads(f.read())", any help?

the way I run is I created a script and made python call it, running via de IDLE is a bit harder as you need to change the path of files for that to work, if you don't have coding experience I don't recommend going this route but instead wait for the download the person who created this thread made

Managed to get it working! Somehow missed when you mentioned you tweaked the JSON and then noticed one of your new replies mentioning it again and so I opened the encounters.json on vscode and after fixing 3 or 4 errors it worked! XD

Glad you made it, it used to be 200+ errors now it's like 3 or 4! 


Have fun hot potato ;)

i'm kind of having a hard time getting the code to work, do you mind just sharing the profile.json text with everything unlocked??

Already posted it earlier on this thread

https://itch.io/post/6607944

Does this work recently, and what were your previously mentioned edits?

(1 edit)

I use this on every release, you just need to copy those JSON files to the same place you put the script on to run, I basically do like

```

PS C:\Users\s\AppData\Roaming\TalesOfAndrogyny> python.exe .\ordering.py

PS C:\Users\s\AppData\Roaming\TalesOfAndrogyny>

```
And in thise same directory you have the JSON files required, dont forget to replace the `test_profile` for your current profile before loading the game