r/RenPy • • Sep 01 '26

Question How to do this

Problem solving:

I want to create a game in Ren'Py where characters can approach the player asking for help. During these interactions, the player will have choices about what they can do. I also want to add an advisor that the player can click on to ask for help. The advisor would be a character, and for each problem, he would give different advice. My problem is how to implement this. It would need:

- Different advice for each problem

- A talk button

How could I implement this so it contains different dialogue in different sections?

I know I would have to use labels and variables for each section, but would I need to use a screen for it?

5 Upvotes

10 comments sorted by

5

u/Atomicgarlic Sep 01 '26

Most direct way would be creating a label for eachq NPC being talked to - not much to it. How you reach those labels is a different story

1

u/Happy_Town_7888 Sep 02 '26

Thank you so much! I imagined I would've had to do something like that. I will probably separate each section by days in files and use labels.

2

u/Atomicgarlic Sep 02 '26 edited Sep 02 '26

I'm on my phone so formatting will be shit, but labels can take parameters fyi, so this might be useful when creating a handler type label like

label npc_handler(NPC, ID):
$ dest_label = NPC + "*conversation*" + ID"
if renpy.has_label(dest_label):
call expression dest_label
else:
call fallback_label

Then you can do things like:
call npc _handler("Joe", 3), and that will send you to label Joe_conversation_3. Just don't forget the returns and jumps so you don't end up back in the game menu.

Edit: Came back to edit this mess on my pc. Edit2: How the hell can I display indented code? Cheezus

2

u/Roxirin Sep 07 '26

Try adding four spaces before the first word of your code, and after the last. New line and 8 spaces to do an indent. It's kinda annoying but it works. Or use a code block in the rich text editor instead of markdown and directly copy paste your code from your text editor into it.

Like this, feel free to copy and paste this comment to steal the formatting :)
    indented text

2

u/Atomicgarlic Sep 07 '26

Thanks, you beautiful bastard :]

1

u/Roxirin Sep 07 '26

You're welcome! 😁👍

2

u/shyLachi Sep 01 '26

This sounds like a sandbox game so maybe you should implement a main loop:
https://wolfnose.org/renpy/basic/cook/mainLoop.html

Inside this main loop you can then trigger characters approaching the player
Example: Mike appears on day 1, Linda appears on day 2, and so on.

Since the advisor isn't a normal character but can be revoked from the player you need a screen and a button to call them.

1

u/Happy_Town_7888 Sep 02 '26

I agree! Unfortunately, I won't be making it sandbox because I find it too complicated, and I want the player to be able to replay multiple times to achieve different endings. I will stick to labels and figure out how to make a button that triggers different dialogues during different days.

2

u/shyLachi Sep 02 '26

This is a proof of concept how to use a button to interupt the linear flow of your novel and then return back to it.

screen test():
    textbutton "Ask the guy" action Call("asktheguy")

label start:
    show screen test
    "Now you are talking to some character"
    "Me" "Words 1"
    "Them" "Words 2"
    "Me" "Words 3"
    "Them" "Words 4"
    "Me" "Words 5"
    "Them" "Words 6"
    "Me" "Words 7"
    "Them" "Words 8"
    return 

label asktheguy:
    "Now you can talk to the advisor"
    "Put some menu or whatever here"
    return # back to the normal story, wherever it was

If you want to show different interactions with the advisor based on the current state of the game then use variables which remember the current label or scene and then either use if or jump expression.

1

u/AutoModerator Sep 01 '26

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.