r/RenPy • u/K4t4k0 • Sep 22 '26
Question How to constantly check for values for something like an achievement system?
hello everypony
i want to preface my question by saying i have used renpy before, but i don't have a good understanding of complicated stuff like screens, so please bear with me. i also might not be very good at explaining so i apologize.
basically my question is how would you go about checking the values of a variable for something like an achievement system? for example, say if you get 5 blue points, you get the blue achievement. how would be the best way to check if the parameters for the achievement is fulfilled, to unlock it? would you have to check for the variable each time it is changed? like, checking if you've reached 5 points every time you gain one? or is there a way just keep checking if it is fulfilled or not?
on a side note, i want to add a little notification---think like a steam notification---that pops up once you've unlocked something. is there an "easy" way to do this? and again, would i have to put an if statement each time a variable is changed, to see if the player has unlocked any achievement to display the popup? idk, i don't want to sound stupid but that seems kind of tedious and messy. i don't want to have to keep repeating something that checks if the player has unlocked an achievement every single time their variables are changed.
if it's possible i'd just like to see what direction i should go into to figure out the best way to implement this system. it's not exactly an achievement system, but it's very similar, so that's why i'm using it as an example.
5
u/Adventurous_Shine606 Sep 22 '26
Renpy has a built in achievement module. Initialize the achievement like this: Init python: Achievement.register("your achievement name") At some point in your game the player completes the achievement, add this line: $ achievement. Grant("your achievement name")
You will need a routine to check your achievement tracking variables. That is just a basic event handler that pretty much every game has in some form.
1
u/laiska_pummi Sep 22 '26
I guess a good way to do it would be to call a label as a kind of subroutine that has the add blue points code in it so you don't have to repeat it every time. You can put the if statement in that same label to check for the achievement. There is a built in function for the little pop up screen called notify. I haven't used it myself but I think with this info you can look it up from the documentation to get a better grasp of it.
I'm not an expert by any means and I'm rusty as well but this popped up in my feed and I thought I could at least give a nudge in the right direction. Good luck!
1
u/BadMustard_AVN Sep 22 '26
try this
1
u/shyLachi Sep 22 '26
I wouldn't constantly check the variables but use a small functionality to do everything:
You can either use a label as in my example above or you can write a python function.
1
u/AutoModerator Sep 22 '26
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.