Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hello! I'm having a strange issue with granting achievements during the game.

Here's one achievement as an example:

define ACHex = Achievement(     
    name = _("EXTERMINATOR"),
    id = "Exterminator",
    description = _("Get the good ending to the RATS scenario after choosing to kill them."),
    unlocked_image = "gui/ach/Exterminatora.png",
    locked_image = "locked_achievement",
    hidden = False,
    hide_description=True,
    )

My issue lies with the [achievementName].grant() function. It's very strange, because while some instances of the function work, others (and the ones I need most) don't seem to. For example, when I grant the achievement as a screen function like this (for testing purposes only):

textbutton "GET" action Function(ACHex.grant)

It works! The art and description show up, which is what I want. But the problem is that I want to grant the achievements in the game itself as you play. But, when I do so by putting this in the actual scene of the game:

$ ACHex.grant()

Nothing happens. I've toggled all of my achievements to hide and unhide them while testing, so I can confirm that they all have the proper art, title, and description once their achievements are granted. I've also made sure to restart the game, and double check that Steams support is up to date (My game is already on Steam so this was just to be sure). 

The main thing I want to know is how I can get the achievements to be granted in real time as you play like in the example above (only functional lol). Any help would be awesome, this is a neat tool and I'd like to get it working! ✌✨

So, when you say nothing happens - does it not grant the achievement at all, or are you just not seeing the popup? You can watch the status of the achievement by bringing up the console with shift+o and typing watch ACHex.has() for example. If you already have the achievement, it won't re-grant it. If proceeding past that line in your script does not change the achievement to being unlocked, then that's a different issue from it changing it and you not seeing the popup screen. If you're testing on Steam, you may need to clear the achievements from their backend as well. See the bottom of this article: https://partner.steamgames.com/doc/features/achievements/ach_guide

Thanks! As it turns out, it was actually an issue with how I was calling the achievements menu (I had a feature that was able to delete all achievements after clicking another confirmation box) that was clearing the achievements as the menu was called for some reason. The good news is that I found this out by using the shift+o console method which I actually didn't know about before, so thanks for the help! I used this to test all of my achievements and if they were being granted correctly, and it's been a big help! ✌✨