Making scenes random with ending still intact

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
User avatar
Sabotage
Regular
Posts: 27
Joined: Thu Mar 28, 2013 7:50 am
Projects: Cupcake! [WIP-40%] :: Riddled [Idea-0%]
Contact:

Making scenes random with ending still intact

#1 Post 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!

User avatar
Donmai
Eileen-Class Veteran
Posts: 1962
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Making scenes random with ending still intact

#2 Post 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.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Kingv
Veteran
Posts: 324
Joined: Sun Jan 29, 2012 11:54 pm
Projects: Pet Tails, Transformation Sequence, Cheer On!
Tumblr: EphemeralBalance
Deviantart: kingv
Location: USA
Contact:

Re: Making scenes random with ending still intact

#3 Post 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

Post Reply

Who is online

Users browsing this forum: Bing [Bot], cruisy__, Google [Bot], Imperf3kt, Ocelot