Page 1 of 1
Making scenes random with ending still intact
Posted: Tue Apr 30, 2013 5:29 am
by Sabotage
Okay, I hope I can describe this clear enough.
The story I'm planning takes place while the player is dreaming and I wanted to emulate the randomness of dreams (that is, each time it is played, the scenes you see are random). I plan to make 10-15 small scenes that will have choices on each of them. The choices are all designed to give you an ending.
I've looked around, and I've only seen choices and assets (pictures, videos, responses) randomized. But is it possible to randomize whole scenes? If you write the scenes into separate rpy files, is there a way to call certain ones to get an ending? I have only used Renpy for around a month now, so my apologies if I give proof to that fact. Thank you!
Re: Making scenes random with ending still intact
Posted: Tue Apr 30, 2013 7:09 am
by Donmai
No need to write each scene on a separate rpy file (well, you can do it, if you prefer). Just give a distinctive label to each scene, then you can call (or jump to) each label randomly.
Re: Making scenes random with ending still intact
Posted: Tue Apr 30, 2013 1:09 pm
by Kingv
Sabotage wrote:Okay, I hope I can describe this clear enough.
The story I'm planning takes place while the player is dreaming and I wanted to emulate the randomness of dreams (that is, each time it is played, the scenes you see are random). I plan to make 10-15 small scenes that will have choices on each of them. The choices are all designed to give you an ending.
I've looked around, and I've only seen choices and assets (pictures, videos, responses) randomized. But is it possible to randomize whole scenes? If you write the scenes into separate rpy files, is there a way to call certain ones to get an ending? I have only used Renpy for around a month now, so my apologies if I give proof to that fact. Thank you!
I haven't been using Ren'Py long either but I do use some random generators in my game. I modified the code a bit so that it would work for scenes. The code works but having 'return' at the end of 'label endChoice' makes the game stop so I would advising replacing it with another label to continue the story. There might be a cleaner way to make this work so...yeah...might want to ask for a second opinion to be sure.
Code: Select all
init:
$ random1 = False
$ random2 = False
$ random3 = False
label randomChoice:
E" Let's call some scenes randomly!"
label beginChoice:
$ r = renpy.random.randint(1, 3)
if r == 1:
if random1== False:# If 1st scene hasn't been seen yet
call random1
if random1 and random2 and random3:# If all scenes have been seen end choices and continue story
call endChoice
else:# Reloads the label 'beginChoice' if scene random1 has already been seen
call beginChoice
if r == 2:
if random2== False:# If 2nd scene hasn't been seen yet
call random2
if random1 and random2 and random3:# If all scenes have been seen end choices and continue story
call endChoice
else:
call beginChoice
if r ==3:
if random3 == False:# If 3rd scene hasn't been seen yet
call random3
if random1 and random2 and random3:# If all scenes have been seen end choices and continue story
call endChoice
else:
call beginChoice
call beginChoice
return
label random1:
E"This is the part where I do stuff."
$ random1 = True
#Setting the variable to True will disable it as a random choice
call beginChoice
label random2:
E"I have alot to do today so I'm going to rush through this scene."
$ random2 = True
#Setting the variable to True will disable it as a random choice
call beginChoice
label random3:
E"Is this a scene too?"
$ random3 = True
#Setting the variable to True will disable it as a random choice
call beginChoice
label endChoice:
E"Those where some cool scenes but let's finish the game."
return