[Solved] Extended Achievements - check achievement (OlegWock/Roselia-achievements)

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
kalesco
Regular
Posts: 25
Joined: Wed Apr 18, 2018 9:34 am
Contact:

[Solved] Extended Achievements - check achievement (OlegWock/Roselia-achievements)

#1 Post by kalesco »

Hi!
If I wanted to use a screen with an imagemap for this achievement code - how can I check whether the achievement has been granted?

The achievements look like this:

Code: Select all

# Define your achievements here
    if not persistent.achievements_dict:
        persistent.achievements_dict = {"wasser": {"type": 0, # One time achievent
                                                             "title": "Wasser", # Also neame for steam
                                                             "text": "Kapitel Wasser abgeschlossen", # description
                                                             "icon": "images/icons/icon-wasser.png" # 96x96 image
                                                             },
                                        "feuer": {"type": 0,
                                                             "title": "Feuer",
                                                             "text": "Kapitel Feuer abgeschlossen",
                                                             "icon": "images/icons/icon-feuer.png"
                                                             }
 
Should I use the index number (this won't change for the achievements)? Seems unelegant.
thank you!
Last edited by kalesco on Fri Apr 27, 2018 11:13 am, edited 1 time in total.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Extended Achievements - check achievement (OlegWock/Roselia-achievements)

#2 Post by kivik »

I'm probably being dumb here, but I'm not sure what you're trying to do? What is this screen and imagemap that you want to use?

Also your achievement dict - where does it say whether it's been done or not? I assume "type" indicates what type of achievement it is, instead of whether it's been done - is there another dict that's used to store whether an achievement was granted or not?

kalesco
Regular
Posts: 25
Joined: Wed Apr 18, 2018 9:34 am
Contact:

Re: Extended Achievements - check achievement (OlegWock/Roselia-achievements)

#3 Post by kalesco »

I found my solution (after a lot of trial and error):

Code: Select all

if achievement.has("wasser"):
    hotspot (95, 221, 350, 105) clicked #dosomething
it does not work if no action is called.

The imagemap is my achievement screen.
The achievement dict has been taken from OlegWocks code, turns out it uses the built in achievement system? I didn't get this at first.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Extended Achievements - check achievement (OlegWock/Roselia-achievements)

#4 Post by kivik »

Cool! I think I understand now - so you have a screen that displays whether an achievement has been unlocked or not, and you can then click on it?

I guess I wouldn't have considered basing both information (title, text, icon) and unlocked status in a single dictation - it just seems an odd way of implementing it. I'd have gone for a persistent dict with just flags saying whether it's been unlocked; and a separate defined dict to say what the title, text, icon are.

I'd imagine if you later decided to change the title, text, or icon, you'd have to check through the entire persistent dict at each game launch and to see if they already exist and replace the content - whilst if you just have a dict that's an in game variable then it's already updated when you push a new version of the game out.

My two pennies :)

kalesco
Regular
Posts: 25
Joined: Wed Apr 18, 2018 9:34 am
Contact:

Re: Extended Achievements - check achievement (OlegWock/Roselia-achievements)

#5 Post by kalesco »

I have used the code from here:
viewtopic.php?t=39890

which is working fine for me.
every chapter (11) has an achievement "completed", so there's not too many places to change sth.

Post Reply

Who is online

Users browsing this forum: Google [Bot]