This worked fine until the game is reset. If it's reset, and you click on an item, the game crashes. Sadly, I have only just discovered this terrible bug but I want to fix it.
Here's my code in script.rpy:
Code: Select all
init -2:
default persistent.itemcount = set()
Code: Select all
if len(persistent.itemcount) == 31:
$achievement.grant("detective")
init:
$achievement.register("detective")
Code: Select all
label resetprogress:
$ persistent._clear(progress=True)
$ persistent.endings = []
call screen main_menu