How do I shuffle a list (array)?
Longer explanation (only necessary if the above doesn't have a simple command)
I want to have a list of events, that an event gets pulled randomly from and removed from the list. I also want there to be more than one possibility of a certain event within the list, and I do not want all instances to be removed. I cannot find a renpy command that does that, though I found that the 'pop' command removes a set item in the list.
On the code side here is a simplified example
Code: Select all
label start:
$ forest = ["Orc", "Orc", "Orc", "Treasure", "Nothing"]
# this is where I'd want the shuffle
jump forest_encounter
label forest_encounter:
$ encounter = forest.pop()
if encounter == "Orc":
"Danger, Orc"
jump forest_encounter
elif encounter == "Treasure":
"Yay, Treasure"
jump forest_encounter
elif encounter == "Nothing":
"The forest is quiet"
jump forest_encounter