Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Achievements for Ren'Py

In-depth ingame achievement support for Ren'Py that plugs into the Steam backend. · By Feniks

Need Support? Post here! Sticky

A topic by Feniks created Sep 14, 2023 Views: 3,184 Replies: 91
Viewing posts 21 to 32 of 32 · Previous page · First page

Can the achievements code work with steam?

Developer

Yes it works with Steam, provided you download the Steam library support from the Ren'Py launcher and set up your Steam achievements with the same IDs.

Ok thanks!

How to make the notify frame into down right like the steam notification when you get a achievement?

Developer

Hello! You'll need to use screen language to adjust the popup screen. Unfortunately that's out of the scope of what I can help with on the forums here, but you can check out my website for some tutorials on screen language.

Hello! Thank you so much for your work. Is there a way to make it so that an achievement has a hidden description by default, but that description gets unhidden once a condition is reached or that another given achievement is granted? This would be a useful way to, let's say, give hints on how to unlock it without being too spoilery if the player hasn't completed the main story yet. Thanks in advance for your help!

Developer

Heya! That functionality isn't currently included, but it's relatively simple to add a condition property in the constructor (__init__) and update the description property method to account for what's in the condition. Just remember you'll need to use eval() on the condition, and the condition will need to be a string, so it can be evaluated in real-time and not just when the game is launched. Hope that helps get you started!

Thanks so much for the quick response, I'll see what I can do!

Just curious, how could I go about making the achievements change the story? Specifically, how could I make it so something like the Platinum achievement results in unlocking a special ending that you can only get through having the Platinum achievement?

Developer

I'd just check if they have the achievement (i.e. if platinum_achievement.has()) as a condition like you would use anywhere else - you can use it to wrap screen language too to show a button only if the player has the platinum achievement, for example.

(1 edit)

Ah, I'm kind of new at coding especially within Python. I attempted to type "if platinum_achievement.has()" and it ended up just showing an error.
Code itself : 
"

if platinum_achievement.has()

    e "This is a Test"
"
Then the error code

```

I'm sorry, but errors were detected in your script. Please correct the

errors listed below, and try again.

File "game/script.rpy", line 74: reached end of line when expecting ':'.

    if platinum_achievement.has()

                                 ^

Ren'Py Version: Ren'Py 8.3.6.25022803

Tue Mar 11 22:06:59 2025

```


I apologize if this might be a stupid question

Developer

You need a colon at the end of every conditional statement to start a block e.g.

if platinum_achievement.has():
    # stuff

You may want to check out feniksdev.com for some tutorials on conditional statements if you're having trouble!

Different question, just curious but is there a way to hide the progress bar from view? A few achievements i have i want to keep hidden.  i read over the stuff provided but i didn't see any mention of hiding it. unless im blind which happens much too often

Developer

There isn't a built-in option for it, but you're welcome to edit the code. That said, it sounds like you just want a regular achievement and you can track progress yourself via a persistent variable, and grant the achievement when it meets your threshold. 

When I click on an achievement in the achievement menu that hasn't been received yet, it gets unlocked. But if I click it again, it gets removed. How can I fix this?

Developer

Yeah that's intentional! It's this bit:

if config.developer:
    action a.Toggle()

so it only happens during development, not in a built game. It's to help with testing. You can just delete those lines from the achievement_gallery screen to get rid of that.

Okey thanks

(1 edit)

Hello! Thanks a lot for making this.

For now I've only tested 1 example and it seems to work, but I want to make sure. I'm getting this error in VSCode:

"store.custom_achievements": Use of a store variable that has not been defaulted.

It points to line 543 in achievement_backend.rpy  file. Do I need to default it to something?

Developer

No worries,the VS code extension simply isn't able to recognize the namespace properly. It isn't a problem with the code, just an inconsistency in the extension trying to detect variables (which this isn't).

I see. Thanks again!

how to disable granting an achievement when you click on it? 

Developer

Just delete

if config.developer:
    action a.Toggle()

from the screen. Note that because of the "if config.developer" part, clicking on achievements will not grant them in a proper build; only during development for testing.

Hello! Thank you for your work. I want to ask which is the part that is controlling the achievement popup? I have a scene where 2 achievement can be granted at the same time, but when I test it, it seems only one popup show up (the other still get unlocked in the gallery though).

Developer

It's likely showing both popups in the same place on top of one another - if you look at the default achievement_popup screen, there's a special bit:

## Allows multiple achievements to be slightly offset from each other.
## This number should be at least as tall as one achievement.
default achievement_yoffset = num*170
frame:
    style_prefix 'achieve_popup'
    ## The transform that makes it pop out
    at achievement_popout()
    ## Offsets the achievement down if there are multiple
    yoffset achievement_yoffset

That yoffset bit makes sure that if there are multiple achievements shown at the same time, they get offset so they're not stacking on top of each other. Make sure you have that code, or something similar, in your own popup screen!

Thank you! I do have that yoffset part in my code. When I toggle the achievements in the gallery, the multiple popups show stacking on each other just fine, but in the game, only one popup show up at a time .

Here is the code for granting two achievements at the same time, I think it works because the if A is unlocked and I have B, the C will get unlocked in the gallery, its just that C popup doesn't show in the game.

Currently, I'm using renpy 8.5.2 

$ ending_A.grant()
        if ending_A.has() and ending_B.has():
            $ ending_C.grant()
Developer

All right, unfortunately I don't really have any further actionables - it sounds like things are set up properly if you see multiple achievements from the gallery, so it probably makes sense to debug around the time you're trying to grant your achievements. Do you have any LinkedAchievements or similar? Usually in a case like this, where you automatically grant an achievement if two others have been earned, LinkedAchievement is useful. I'd also include some debug lines like "Do you have ending_A achievement? [ending_A.has()]" to see what the values for everything are. It might be that you already have ending_C's achievement accidentally or something, so its popup is not appearing.

Thank you! It seems that the LinkedAchievements work perfectly, when I tried it the popups show correctly. Still don't know what happened with the if statements, but I'll stick with the Linked for now, thanks!

Hi, is it possible to use a function to delete the persistent data for achievement? When I use the "Delete Persistent" option in renpy dev mode, all the achievements got reset to the initial stage, but when I use $ persistent._clear(progress=True) ingame, it doesn't do anything to the achievement (other persistent value got cleared, though).

Or is there another way to do it?

Developer

You can run achievement.clear_all() (https://www.renpy.org/doc/html/achievement.html#achievement.clear_all) to clear all achievements.

Thank you!

(2 edits)

Hi! Sorry in advance if this is a silly question, I'm still new to Renpy. Is there a way to show a timestamp (a month, to be exact) in another language? I'm making a game in Russian, my Renpy is in Russian too, and I can see that the timestamp can be shown in Russian (e.g. in slots when saving/loading). But I can't quite figure out how to do the same when working with your code. I have no problem with formatting, the question is about the names of the months: I want "Получено 18 мая 2026", but it's shown as "Получено 18 May 2026". Thank you so much for all your work!!

Developer

I looked more closely into how Ren'Py handles the FileTime time stamps - try changing the get_timestamp function in the backend as follows:

def get_timestamp(self, format=_("%b %d, %Y @ %I:%M %p{#achievement_timestamp}")):
    """
    Return the timestamp when this achievement was granted,
    using the provided string format.
    """
    if self.has():
        format = renpy.translation.translate_string(format)
        return _strftime(format, self._timestamp)
    else:
        return ""

And let me know if that works! 

Thank you for the fast reply! Unfortunately nothing changed :c the code doesn't throw any mistakes, the timestamp is just still in English.

upd: I found a workaround by using the second, get_timestamp method and by just redacting stuff in quotes lol, that's good enough for me. I should've done that from the start, sorry for the trouble 😞

But yeah, if you work with translated Renpy and use text a.timestamp when showing a timestamp it still wil be in English. 

Viewing posts 21 to 32 of 32 · Previous page · First page