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.
-
Team1Player2
- Newbie
- Posts: 9
- Joined: Tue Mar 29, 2022 4:01 am
-
Contact:
#1
Post
by Team1Player2 » Sun Oct 09, 2022 3:37 pm
Hello,
I am trying to build a dialogue system in which one option is "Small talk". It improves relationship by a small value and gives random bits of dialogue. Mechanically, each character has several relationship states. Those are lists. I already wrote code that deletes and adds names to the appropriate list based on relationship. Each relationship level has a corresponding list of small talk.
Code: Select all
def choose_small_talk(name):
if name in met_not_acquainted:
small_talk = renpy.random.choice(adam_small_talk_1)
a "here will be the random thing"
How do I make my characters say the random nonsense picked from that list?
Last edited by
Team1Player2 on Sun Oct 09, 2022 5:18 pm, edited 1 time in total.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1882
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#2
Post
by Ocelot » Sun Oct 09, 2022 4:54 pm
Code: Select all
# We are returning chosen sentence instead of setting local variable
def choose_small_talk(name):
if name in met_not_acquainted:
return renpy.random.choice(adam_small_talk_1)
return renpy.random.choice(adam_small_talk_0)
# . . .
# You can use either:
$ a( choose_small_talk("some_name") )
# or this, if you want to process it before displaying
$ small_talk = choose_small_talk("some_name")
$ a( small_talk )
< < insert Rick Cook quote here > >
Users browsing this forum: Google [Bot], Majestic-12 [Bot]