Unlockable Paths Part 2 [SOLVED]

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
User avatar
moonkistprincess
Newbie
Posts: 8
Joined: Fri Jun 24, 2016 3:11 pm
Tumblr: moonkistprincess
Contact:

Unlockable Paths Part 2 [SOLVED]

#1 Post by moonkistprincess »

I had a ton of help from a wonderful Ren'Py user here via PM for a full day, but neither of us can figure out where I'm going wrong.
The intention: When the player clicks one option, the main menu adds a "bonus date", and when the player finishes the current (unchanged by this choice!) route, they will see the "bonus date" button on the main menu. They can then click it and experience the small, short, unconnected scene.
The problem: Despite all this coding, I cannot unlock the path, nor can I see the path unlocked visually.
Traceback/Error: The game runs just fine, there are no errors to report.

SCREENS.RPY

Code: Select all

##############################################################################
# Main Menu
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu():

    # This ensures that any other menu screen is replaced.
    tag menu
    add "fortmenu.png"

    if persistent.ending == "Somnus":
        use main_menu_2
    else:
        use main_menu_default
        
##############################################################################
        
screen main_menu_default:
    tag menu
    add "fortmenu.png"

# The main menu buttons.
    imagemap:
        ground "800600.png"
        idle "fortmenu.png"
        hover "fortmenu2.png"
        
        alpha False
        # This is so that everything transparent is invisible to the cursor. 

        hotspot (619, 432, 166, 34) action Start()
        hotspot (622, 464, 163, 28) action ShowMenu("load")
        hotspot (619, 495, 170, 24) action ShowMenu("preferences")
        hotspot (652, 521, 109, 34) action Help()
        hotspot (650, 555, 115, 30) action Quit(confirm=False)

###############################################################################

screen main_menu_2:

    # This ensures that any other menu screen is replaced.
    tag menu
    add "800600.png"

# The main menu buttons.
    imagemap:
        ground "800600.png"
        idle "fortmenuwalksnoline.png"
        hover "fortmenuwalks.png"
        
        alpha False
        # This is so that everything transparent is invisible to the cursor. 

        hotspot (619, 432, 166, 34) action Start()
        hotspot (622, 464, 163, 28) action ShowMenu("load")
        hotspot (619, 495, 170, 24) action ShowMenu("preferences")
        hotspot (636, 405, 134, 29) action ShowMenu("bonus3") 
        hotspot (652, 521, 109, 34) action Help()
        hotspot (650, 555, 115, 30) action Quit(confirm=False)
        

##############################################################################
SCRIPT.RPY

Code: Select all

menu:
    "Sure, Somnus! It's a date.":
        if persistent.Somnus:
            $ persistent.Somnus = True
            jump wherego
    "Uh...":
        jump wherego
also in the script, the path we're supposed to be able to access

Code: Select all

label bonus3:
scene black with dissolve 
scene bg spacebase with dissolve
show som with dissolve
som "this is filler text"

return MainMenu
Last edited by moonkistprincess on Tue Jun 28, 2016 7:29 pm, edited 4 times in total.

User avatar
mobychan
Veteran
Posts: 275
Joined: Fri Apr 24, 2015 6:31 am
Projects: The Chosen - Sakura Pink & Gentian Blue
Organization: Foresoft
Location: Germany
Contact:

Re: Unlockable Paths Part 2

#2 Post by mobychan »

recheck this part:

Code: Select all

menu:
    "Sure, Somnus! It's a date.":
        if persistent.Somnus:
            $ persistent.Somnus = True
            jump wherego
    "Uh...":
        jump wherego
put in words it's:
if persistent.somnus equals true, set persistent.somnus to true and jump to wherego.

I guess your intended use would be

Code: Select all

not persistent.somnus

User avatar
moonkistprincess
Newbie
Posts: 8
Joined: Fri Jun 24, 2016 3:11 pm
Tumblr: moonkistprincess
Contact:

Re: Unlockable Paths Part 2

#3 Post by moonkistprincess »

Thank you for the help! Changing that to this:

Code: Select all

label somscrtmen:
menu:
    "Sure, Somnus! It's a date.":
        not persistent.Somnus:
            $ persistent.Somnus = True
            jump wherego
    "Uh...":
        jump wherego
ends up with this error:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 198: expected statement.
    not persistent.Somnus:
                         ^

Ren'Py Version: Ren'Py 6.99.10.1227

User avatar
mobychan
Veteran
Posts: 275
Joined: Fri Apr 24, 2015 6:31 am
Projects: The Chosen - Sakura Pink & Gentian Blue
Organization: Foresoft
Location: Germany
Contact:

Re: Unlockable Paths Part 2

#4 Post by mobychan »

you removed the if, I'm sorry I wasn't clear on that part^^

the whole thing should look like this:

Code: Select all

label somscrtmen:
    menu:
        "Sure, Somnus! It's a date.":
            if (not persistent.Somnus):
                $ persistent.Somnus = True
                jump wherego
        "Uh...":
            jump wherego

User avatar
moonkistprincess
Newbie
Posts: 8
Joined: Fri Jun 24, 2016 3:11 pm
Tumblr: moonkistprincess
Contact:

Re: Unlockable Paths Part 2

#5 Post by moonkistprincess »

Ahhh I did exactly as you said, and nothing has changed, sadly.

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Unlockable Paths Part 2

#6 Post by gas »

Code: Select all

if persistent.ending == "Somnus":
you're checking something.

Code: Select all

if (not persistent.Somnus):
You're checking something else.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
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: Unlockable Paths Part 2

#7 Post by xavimat »

Try this one:

Code: Select all

if persistent.somnus is None:
    $ persistent.somnus = True
And, in the screen:

Code: Select all

if persistent.somnus:
    use main_menu_2
else:
    use main_menu_default
Your code changes the variable, "persistent.Somnus" in the menu; but the main menu screen checks for the variable "persistent.ending" that has never been defined.
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
moonkistprincess
Newbie
Posts: 8
Joined: Fri Jun 24, 2016 3:11 pm
Tumblr: moonkistprincess
Contact:

Re: Unlockable Paths Part 2

#8 Post by moonkistprincess »

Ah! That did the trick, xavimat! Thank you very, very much. :D

User avatar
moonkistprincess
Newbie
Posts: 8
Joined: Fri Jun 24, 2016 3:11 pm
Tumblr: moonkistprincess
Contact:

Re: Unlockable Paths Part 2 [SOLVED]

#9 Post by moonkistprincess »

I had a second problem that I wrote here but I have fixed it since.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]