Saving and Loading Movie VN

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
Bokus
Newbie
Posts: 3
Joined: Thu Oct 12, 2023 2:23 pm
Contact:

Saving and Loading Movie VN

#1 Post by Bokus »

Hi,

I'm experimenting with Ren'Py to create VN with lot of animated movies.
So far I manged to achieve how I would like it to look and behave, but I'm having issues with save/load game.

I'm not using regular character textbox, reason is that I have video playing and then timed subtitles show up and are controlled with renpy.pause.
Regular textboxes player needs to click on and that would break timings for subtitles.

Another thing I'm not using is menu choices, mostly because of looping movie while waiting for player to decide on choices on the screen.

My understanding is that Ren'Py is using these menu choices and regular textboxes when saving game and then loading state where user left of.

Is there a way for me to manually mark parts in code to use as anchor for save/load?

So far I tried making blank characters saying "" and configuring

Code: Select all

init:
    $ _preferences.afm_enable = True
    $ persistent.set_afm_time = True
    $ _preferences.afm_time = 0.1
Hacky solution but works so far as I could tell. Issue is witch choice selections.

For menu choices I tried

Code: Select all

screen auto_continue(label_to_jump_to):
    timer 0.1 action Jump(label_to_jump_to)
then use it as

Code: Select all

if selected_choice == "choice1":
    show screen auto_continue("chat_1_reply")
        menu:
            "":
                jump chat_1_reply
Which seems to work, but it doesn't save/load properly. It only works if I click on the menu choice showing, not with auto continue.

I'm still new to Ren'Py so I might be missing some obvious things.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Saving and Loading Movie VN

#2 Post by PyTom »

Try:

Code: Select all

$ renpy.checkpoint()


And see if that does what you want.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Bokus
Newbie
Posts: 3
Joined: Thu Oct 12, 2023 2:23 pm
Contact:

Re: Saving and Loading Movie VN

#3 Post by Bokus »

Hi PyTom,

Thanks for your quick reply.

I already tried

Code: Select all

$ renpy.checkpoint()
before, but it doesn't work.
I tried again creating a fresh project in case I messed up something with old one, but still same issue.

I've put $ renpy.checkpoint() in several points in the code. I play the game, make several saves on different slots.
When I try to load any of them it goes directly to main menu.

Bokus
Newbie
Posts: 3
Joined: Thu Oct 12, 2023 2:23 pm
Contact:

Re: Saving and Loading Movie VN

#4 Post by Bokus »

I'm trying different approach. Since I might be able to use textboxes with skip as shown on first post, only thing remaining for regular saves to work is to use menu choices in looping video.
Idea is that when choice is presented looping video is shown that loops until player makes choice. I'm not using movie with loop true since then when player clicks choice it would jump straight away and I want to wait till end of video so it connects to next video frame on new label.

This is what I have

Code: Select all

label play_looping_video_1:

    $ choice_made = ""
    
    scene chat_1
    show chat_1_idle_video # loop video lasts 2.5 seconds
    
    menu:
        "I want first choice":
            $ choice_made = "choice1"
        "I want second choice":
            $ choice_made = "choice2"
    
    $ renpy.pause(2.5, hard=True)  # wait for the video to finish

    if choice_made == "choice1":
        jump choice1
    elif choice_made == "choice2":
        jump choice2
    else:
        hide chat_1_idle_video  # Hide the current video before jumping back
        jump play_looping_video_1
But this shows looping video first time only, then I see that chat_1 image is shown but no video again.

I tried this as well

Code: Select all

screen auto_continue(time=5, label_to_jump_to="start", video_to_hide=None):
    timer time action [Hide(video_to_hide), Jump(label_to_jump_to)]

Code: Select all

label play_looping_video_1:

    $ choice_made = ""
    
    scene chat_1
    show chat_1_idle_video
    
    show screen auto_continue(time=2.5, label_to_jump_to="play_looping_video_1", video_to_hide="chat_1_idle_video")
    
    menu:
        "I want first choice":
            $ choice_made = "choice1"
        "I want second choice":
            $ choice_made = "choice2"
    
    $ renpy.pause(2.5, hard=True)  # wait for the video to finish

    if choice_made == "choice1":
        jump choice1
    elif choice_made == "choice2":
        jump choice2
    else:
        hide chat_1_idle_video  # Hide the current video before jumping back
        jump play_looping_video_1

This way it auto skips after timer and loops again, but it shows only 2 video loops and then it's static image again. When I remove menu choice it loops indefinitely.

Is there a way to fix this or have different approach to what I want to achieve?

Post Reply

Who is online

Users browsing this forum: Amazon [Bot], Semrush [Bot]