[SOLVED] Combining Lists and While loop

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
AngJo
Newbie
Posts: 10
Joined: Wed Jun 21, 2017 4:22 pm
Contact:

[SOLVED] Combining Lists and While loop

#1 Post by AngJo »

Hello everyone,

I'm currently working on a very simple Ren'py game with a battle sequence.
There's a monster and a main character.
It's very basic, in that the player picks the battle option, and attacks the monster.
The monster attacks based on a random integer.

What I would like to do, is have the Monster say a different bit of dialogue after each attack from the player.
I've got an idea of how I'd do it in C#, but I'm not familiar with how that would go in Python.

How should I go about this?


I assumed I could do the following:

Code: Select all

x = 0
List1 = ["You'll never be worth anything!", "You are in no way creative!", "Your friends only pretend to like you"]

while x < len(List1):
        "[List1[x]]"
        $ x +=1
    jump BattleChoice #returns player to Battle Menu 
Thank you in advance.
Last edited by AngJo on Tue Jul 18, 2017 8:57 am, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1909
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: [HELP] Combining Lists and While loop

#2 Post by philat »

Why not just use renpy.random.choice(List1)?

AngJo
Newbie
Posts: 10
Joined: Wed Jun 21, 2017 4:22 pm
Contact:

Re: [HELP] Combining Lists and While loop

#3 Post by AngJo »

philat wrote:Why not just use renpy.random.choice(List1)?
Oh! I didn't realize that was an option!
Thanks for sharing :).

However, what would I do if I wanted to walk through the dialogue one by one?

Thanks again!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], decocloud, Google [Bot]