Events that can take place at any point.

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
Mimic Fox
Newbie
Posts: 13
Joined: Wed Aug 05, 2020 8:52 pm
Contact:

Events that can take place at any point.

#1 Post by Mimic Fox »

Is there a way to create events that can happen at any point in the story? The best example I can think of to explain what I'm talking about are the free time events from Danganronpa. Basically the story stops and you're able to spend time with a character. If your relationship is high enough, you get a special event with them. these are completely self contained and the story starts back up after they happen.

I know how to do point systems, what I'm confused about is how to return to whatever point in the story you're at once the event ends.

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Events that can take place at any point.

#2 Post by RicharDann »

The most basic way would be to make use of the call statement to run a label that, once finished, returns to the exact point after it was called.

Here's a basic, fly-typed example (somewhat based on Danganronpa's system):

Code: Select all

label start:
    #this can be any chapter/point in the story
    "I have some free time now."
    
    $ free_time_points = 2 # we add a few points to spend on hang out events
    
    call free_time #we call a label containing the free time code
    
    "Free time's over, now the main story resumes."

    return

label free_time: #This is called to start a free time event section
    
    "I should ask someone out!"
    
    menu hang_out_options:
        "Who should I hang out with?"

        "Chihiro":
            call chihiro_event  
            
        "Junko":
            call junko_event

        "Byakuya":
            call byakuya_event
            
    # the game resumes here after one of the events is played
    if free_time_points > 0: #check how many points are left
        
        "I still have some time left..."
        jump hang_out_options
    else:
        return #once no points remain, return to the previous label in the script, in this case, start label

# These are the character events. Each one has it's own label
label chihiro_event:
    
    $ free_time_points -= 1 # we substract from the variable so the player doesn't get infinite events forever
    
    "Chihiro and I got closer..." 
    
    return # we return to the previous label, in this case, free_time
    
label junko_event:

    $ free_time_points -= 1
    
    "Junko and I got closer..."
    
    return
    
label byakuya_event:

    $ free_time_points -= 1
    
    "Byakuya and I got closer..."
    
    return    
The most important step is always the next one.

User avatar
Mimic Fox
Newbie
Posts: 13
Joined: Wed Aug 05, 2020 8:52 pm
Contact:

Re: Events that can take place at any point.

#3 Post by Mimic Fox »

RicharDann wrote: Mon Aug 10, 2020 10:16 am The most basic way would be to make use of the call statement to run a label that, once finished, returns to the exact point after it was called.

Here's a basic, fly-typed example (somewhat based on Danganronpa's system):
Thanks!

Post Reply

Who is online

Users browsing this forum: Google [Bot]