(Persistent) Ren'Py Achievements w/ Download link

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Angelo Seraphim
Regular
Posts: 32
Joined: Tue May 21, 2019 8:00 am
Completed: Enamored Risks (NaNoReNo 2020)
Projects: 616 Charagma
Organization: GLSUoA
Deviantart: glsuoa
itch: glsuoa
Location: London, UK
Discord: Just A Concept#9599
Contact:

(Persistent) Ren'Py Achievements w/ Download link

#1 Post by Angelo Seraphim » Mon Feb 08, 2021 1:39 pm

Latest update (5 / JULY / 21)

Hello, everyone!

I've decided to make an achievement system using RenPy Achievements.
:!: UPDATE (I figured it'd be easier to create a downloadable file including a short tutorial and the code.)

:!: Here's a quick video of what it looks like in my game so you can get an idea.


Some screenshots. The first is the screen of what it looks like in my game, and the second is showing the notification displayed at the top of the screen.
616_charagma_acheivements_1.png
616_charagma_acheivements_2.png

Downloads

:arrow: Itch.io: https://glsuoa.itch.io/renpy-achievements

:arrow: Direct:
Achievements.zip
(980.54 KiB) Downloaded 92 times

If you run into any problems feel free to let me know over on Discord - @Angel Seraphim#9599
Last edited by Angelo Seraphim on Sun Aug 22, 2021 3:27 am, edited 23 times in total.
Image

User avatar
bonnie_641
Regular
Posts: 124
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A. (pending); Aprende Chino conmigo (active)
Deviantart: rubymoonlily
Contact:

Re: Using Ren'Py Achievements and making them persist

#2 Post by bonnie_641 » Thu Feb 11, 2021 5:58 am

Thank you! :D
From: https://www.youtube.com/watch?v=j89RDm0nNAs

For all the trophy/achievement hunters.

This took me a long time to figure out, but I'm happy to have got it working.
If anybody is interested in learning how to create a persistent list I will create a simple walkthrough tutorial on the RenPy Lemmasoft forum soon.
It is impressive!
I watched the video and it looks great.
I really wish you would give an example of how to use each part of this wonderful tutorial (with persistent data).
I appreciate your effort and time spent.
Regards.
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

User avatar
Angelo Seraphim
Regular
Posts: 32
Joined: Tue May 21, 2019 8:00 am
Completed: Enamored Risks (NaNoReNo 2020)
Projects: 616 Charagma
Organization: GLSUoA
Deviantart: glsuoa
itch: glsuoa
Location: London, UK
Discord: Just A Concept#9599
Contact:

Re: Using Ren'Py Achievements and making them persist

#3 Post by Angelo Seraphim » Fri Feb 12, 2021 12:00 pm

bonnie_641 wrote:
Thu Feb 11, 2021 5:58 am
Thank you! :D
From: https://www.youtube.com/watch?v=j89RDm0nNAs

For all the trophy/achievement hunters.

This took me a long time to figure out, but I'm happy to have got it working.
If anybody is interested in learning how to create a persistent list I will create a simple walkthrough tutorial on the RenPy Lemmasoft forum soon.
It is impressive!
I watched the video and it looks great.
I really wish you would give an example of how to use each part of this wonderful tutorial (with persistent data).
I appreciate your effort and time spent.
Regards.
Thank you!
I'm still working to perfect it.
However, I've come across a small problem where for example if you earn, let's say, 10 achievements in a "new" save and you go back to an old save those achievements don't show up, as in, they are locked as if you never earned them at all, but they are actually there, just not in older save files.

I'm looking to see how I could fix that as it may come across as concerning to see your achievements just suddenly disappear.
If anyone has any idea on how to solve this I'd be more than happy.
Image

User avatar
Angelo Seraphim
Regular
Posts: 32
Joined: Tue May 21, 2019 8:00 am
Completed: Enamored Risks (NaNoReNo 2020)
Projects: 616 Charagma
Organization: GLSUoA
Deviantart: glsuoa
itch: glsuoa
Location: London, UK
Discord: Just A Concept#9599
Contact:

Re: Using Ren'Py Achievements and making them persist

#4 Post by Angelo Seraphim » Fri Feb 12, 2021 5:25 pm

UPDATE 12th FEB 2021

Okay, so I've figured out the problem.

So, in the screen that displays the achievements, instead of:

Code: Select all

	## Granted trophies
	for t in Trophy.Trophies: ## Change this line...
		if achievement.has(t.name):
			...
... do:

Code: Select all

	## Granted trophies
	for t in persistent.my_victories: ## ... to this.
		if achievement.has(t.name):
			...
Use the persistent variable defined earlier. This will display the achievements correctly even after loading a save.
Image

User avatar
bonnie_641
Regular
Posts: 124
Joined: Sat Jan 13, 2018 10:57 pm
Projects: Código C.O.C.I.N.A. (pending); Aprende Chino conmigo (active)
Deviantart: rubymoonlily
Contact:

Re: Using Ren'Py Achievements and making them persist

#5 Post by bonnie_641 » Fri Feb 19, 2021 5:52 am

Thank you for updating the topic.
I will try to incorporate this into my game.
Thank you very much <3
I speak and write in Spanish. I use an English-Spanish translator to express myself in this forum. If I make any mistakes, please forgive me.
I try my best to give an answer according to your question. :wink:

User avatar
Angelo Seraphim
Regular
Posts: 32
Joined: Tue May 21, 2019 8:00 am
Completed: Enamored Risks (NaNoReNo 2020)
Projects: 616 Charagma
Organization: GLSUoA
Deviantart: glsuoa
itch: glsuoa
Location: London, UK
Discord: Just A Concept#9599
Contact:

Re: Using Ren'Py Achievements and making them persist

#6 Post by Angelo Seraphim » Mon Mar 01, 2021 4:26 pm

UPDATE 4th MARCH 2021

I've done a few more testing. There are times when the achievement is rewarded but doesn't show up in the achievement screen.

The changes;
For the __eq__ you can do;

Code: Select all

	def __eq__(self, value):
		return all((self.name == value.name, self.message == value.message))
This seems to work more consistently. (Still currently testing.)

If you run into any problems feel free to let me know over on Discord - @Angel Seraphim#9599
Image

SiegeWizard
Newbie
Posts: 6
Joined: Wed Jun 23, 2021 4:50 am
Github: Siege-Wizard
Contact:

Re: Using Ren'Py Achievements and making them persist

#7 Post by SiegeWizard » Fri Jun 25, 2021 3:51 am

In the class "__init__" method, you may want to provide a "fit" property to the "Transform", as the default ("fill") will mess with aspect ratios.
  • "contain" avoids messing with aspect ratio, will use 100 for the big dimension and keep the other one the corresponding ratio (a 200x150 image will be transformed to 100x75 instead of 100x100)
  • "scale-down" does the same but if the image is already small enough it doesn't enlarge it.
https://www.renpy.org/doc/html/atl.html ... operty-fit

User avatar
Angelo Seraphim
Regular
Posts: 32
Joined: Tue May 21, 2019 8:00 am
Completed: Enamored Risks (NaNoReNo 2020)
Projects: 616 Charagma
Organization: GLSUoA
Deviantart: glsuoa
itch: glsuoa
Location: London, UK
Discord: Just A Concept#9599
Contact:

Re: Using Ren'Py Achievements and making them persist

#8 Post by Angelo Seraphim » Sun Jun 27, 2021 7:13 am

SiegeWizard wrote:
Fri Jun 25, 2021 3:51 am
In the class "__init__" method, you may want to provide a "fit" property to the "Transform", as the default ("fill") will mess with aspect ratios.
  • "contain" avoids messing with aspect ratio, will use 100 for the big dimension and keep the other one the corresponding ratio (a 200x150 image will be transformed to 100x75 instead of 100x100)
  • "scale-down" does the same but if the image is already small enough it doesn't enlarge it.
https://www.renpy.org/doc/html/atl.html ... operty-fit
Thanks for this. I will amend the code to reflect this change. :mrgreen:
Image

Post Reply

Who is online

Users browsing this forum: No registered users