Map location having different labels based on what the user has completed

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
FaceAaA
Newbie
Posts: 3
Joined: Thu Nov 01, 2018 12:15 pm
Contact:

Map location having different labels based on what the user has completed

#1 Post by FaceAaA »

Making a game that uses a world map to navigate to different areas. What I'm trying to do, is use the map locations as the primary engine for user input to progress each story. I'm unsure how to not repeat a label once it's been done. I've looked into if statements, but I've not found a good place that explains how to use the statements that makes sense.

For example, map location area1 may have event1 or character_intro1, but I would want area1 to later show a different event, such as a different character intro or event after event1 has been played through.

As an aside, if anyone knows of an up to date knowledge center for coding with renpy, I would be interested in reading that also. I've stumbled through using google search from here, but I've been unable to solve this problem using the same method.

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Map location having different labels based on what the user has completed

#2 Post by DannX »

The most up to date source for Ren'Py that I know of, apart from this forum, is RenPy's own documentation. There is a section regarding what you probably need for this problem, wich is the use of variables and if statements, here.

Maybe something like this:

Code: Select all

default event1_seen = False 

label area1:

    if not event1_seen: #If the player has not seen the event
        "This is event 1."

        "When it's done, we set the variable to True, so when the player returns here, it doesn't occur again"
         
        $ event1_seen = True 
As for where to learn Ren'Py without struggling with the confusing documentation, check out the Tutorial games that come with Renpy, they demonstrate a lot of useful things. You can also check out this forum's cookbook section as it also contains a lot of helpful tutorials.
Last edited by DannX on Thu Nov 01, 2018 12:55 pm, edited 1 time in total.

User avatar
Meg'
Regular
Posts: 185
Joined: Tue Sep 27, 2011 10:37 am
Projects: Anges Démoniaques, Gang (Alex & Hugo), Le passé dans les veines
Location: France
Contact:

Re: Map location having different labels based on what the user has completed

#3 Post by Meg' »

You should use persistent, I'm not sure if it is the best option but this is what I would do.

Code: Select all

$ persistent.event_1 = False
$ persistent.event_2 = False


label event_1:
    
"Hello, I am event_1".

"Ok, so I can set you to True."

$ persistent.event_1 = True


if event_1 == True:
    jump event_2
    
    
else:
    jump event_1
    
    
label event_2:
    
"Hello, I see you have played event_1... So you're ready to play event_2!"

$ persistent.event_2 = True

if persistent.event_2 == True:
    jump event_3
    
else:
    jump event_2
You can also use screen to call instead of labels while using persistents too, I guess.

I'm not really sure what is the best way to implement what you want, but I think I'll do something like this if I was trying to do the same thing. You can also look at the Dating sim engine because it has an events planner system and you are intending to use several events.

I hope that helps in some way :)

Edit: someone was faster than me but well I'll leave my message.

DannX
Regular
Posts: 99
Joined: Mon Mar 12, 2018 11:15 am
Contact:

Re: Map location having different labels based on what the user has completed

#4 Post by DannX »

A bit of advice regarding Meg's recommendation, while persistent is a valid option, as the name implies, it persists between all saves. This means that if for example the player or someone else starts the game again from the beginning in a different save file, when they reach this point, the variable will be True since it was set to true in a previous playthrough, meaning they won't be able to see this event at all.

FaceAaA
Newbie
Posts: 3
Joined: Thu Nov 01, 2018 12:15 pm
Contact:

Re: Map location having different labels based on what the user has completed

#5 Post by FaceAaA »

Both very useful! Thanks for the info.

I ended up using the first option, as I do not want the events to be saved across all playthroughs. I had tried to use something similar, but I didn't use the first False statement, so it wasn't working correctly. This worked, though!

Thanks for the quick responses!

Post Reply

Who is online

Users browsing this forum: No registered users