Achievements screen

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
Vict0r1994
Newbie
Posts: 19
Joined: Mon Apr 08, 2013 10:46 pm
Contact:

Achievements screen

#1 Post by Vict0r1994 » Thu May 08, 2014 2:32 am

Ok. I created an achievements screen for my game, and I made it accesible from both the game menu and the main menu, but my problem is that I don't want it displayable until the user gets his first acheivment, and that would be at the end of the first act. Thus, I need a way of changing the "Achievements" button in the main and game screen from a Null action to a Show_screen action at a given point in the game. I tried using config.main_menu and setting the button to "false" and then setting it to "true" where I needed it to be usable in the game script. However, it didn't work and I am at a loss... How should I proceed? Is it possible to do this? I never programmed anything before renpy, so I don't understand python too well and I would appreciate any help!

Vict0r1994
Newbie
Posts: 19
Joined: Mon Apr 08, 2013 10:46 pm
Contact:

Re: Achievements screen

#2 Post by Vict0r1994 » Thu May 08, 2014 7:40 am

Never mind. Figured this one out myself, but I'll post the sollution for other newbies like myself. I stated an "end_act1" variable in init -2 python in the screens file and assigned it the value "False", and then wrote the navigation menu like this:

Code: Select all

screen navigation:   
    window:
        style "gm_root"
    frame:
        style_group "gm_nav"
        xalign 0.98
        yalign 0.98
        
        has vbox

        textbutton _("Return") action Return()
        textbutton _("Options") action ShowMenu("options")
        textbutton _("Save Game") action ShowMenu("save")
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Main Menu") action MainMenu()
        if end_act1:
            textbutton _("Achievements") action ShowMenu("Achievements")
            textbutton _("Quit") action Quit("confirm=False")
        else:
            textbutton _("Quit") action Quit("confirm=False")
Of course, I also wrote this at the end of the 1st act:

Code: Select all

if end_act1 == False:
         $ end_act1 = True

This way, the achievements screen won't be there until players get their first achievement. I am aware that I'm hardly posting any news and that probably nobody needs to know how to do this simple trick, but the bottom line is that I solved the issue and the thread may be closed.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1446
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Achievements screen

#3 Post by xavimat » Thu May 08, 2014 6:11 pm

you don't need to repeat the "Quit" button, simple indent it outside the if block:

Code: Select all

screen navigation:   
    window:
        style "gm_root"
    frame:
        style_group "gm_nav"
        xalign 0.98
        yalign 0.98
       
        has vbox

        textbutton _("Return") action Return()
        textbutton _("Options") action ShowMenu("options")
        textbutton _("Save Game") action ShowMenu("save")
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Main Menu") action MainMenu()
        if end_act1:
            textbutton _("Achievements") action ShowMenu("Achievements")
        textbutton _("Quit") action Quit("confirm=False")
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
HB38
Regular
Posts: 53
Joined: Sun Apr 27, 2014 2:14 pm
Contact:

Re: Achievements screen

#4 Post by HB38 » Thu May 08, 2014 7:32 pm

Vict0r1994 wrote:

Code: Select all

if end_act1 == False:
         $ end_act1 = True
You could probably remove the if statement; and just have it set to 'True' whether it's False or not - shouldn't matter.

Post Reply

Who is online

Users browsing this forum: Dr_arell, Google [Bot]