[Solved] Disabling interaction without blocking the player from quitting.

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
simba975
Newbie
Posts: 22
Joined: Sun Jul 23, 2023 12:05 pm
Contact:

[Solved] Disabling interaction without blocking the player from quitting.

#1 Post by simba975 »

So, I have a part in my visual novel where a "cinematic" plays, but its not a .ogv but instead multiple images who play at rhythm with the music, this because a cinematic is much heavier and because like that i can change anything without making a new video. For reference it looks like the image below:
script.rpy - game - Visual Studio Code 9_6_2023 11_43_47 PM.png
So, the thing is that if the player touches anything all the pacing gets ruined, so what I use to prevent interaction is $ disable_interaction(). The problem with this is that when using this command, if the player wants to exit the game it wont let them, and alt+f4 will lead to the application stop working, and the only way to get the game to close is to forcequit it multiple times trough the control panel. Any idea on a solution to this problem? Either making the player able to quit, or any other creative solution which could resolve this problem is welcome.
Last edited by simba975 on Fri Oct 27, 2023 7:08 pm, edited 1 time in total.

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Disabling interaction without blocking the player from quitting.

#2 Post by _ticlock_ »

simba975 wrote: Wed Sep 06, 2023 10:55 pm So, I have a part in my visual novel where a "cinematic" plays, but its not a .ogv but instead multiple images who play at rhythm with the music, this because a cinematic is much heavier and because like that i can change anything without making a new video. For reference it looks like the image below:
So, the thing is that if the player touches anything all the pacing gets ruined, so what I use to prevent interaction is $ disable_interaction(). The problem with this is that when using this command, if the player wants to exit the game it wont let them, and alt+f4 will lead to the application stop working, and the only way to get the game to close is to forcequit it multiple times trough the control panel. Any idea on a solution to this problem? Either making the player able to quit, or any other creative solution which could resolve this problem is welcome.
You can use ATL for that. This way you can simply show your cinematic as an image. You can apply hard pause to wait.
Example:

Code: Select all

image cinematic:
    # to apply transition
    "some_image" with dissolve
    # to wait
    1.0
    # to apply transform
    At("some_image", blurin)
    1.0
    # to show text
    Text("Meanwhile", align = (0.5,0.5), size=50)
    1.0
    # show composite image:
    Composite((1920, 1080), (0,0), "some_image", (0,0), "eileen happy.png")

Code: Select all

    show cinematic
    $ renpy.pause(5.0, hard = True)
    "End"

User avatar
simba975
Newbie
Posts: 22
Joined: Sun Jul 23, 2023 12:05 pm
Contact:

Re: Disabling interaction without blocking the player from quitting.

#3 Post by simba975 »

Thank you! There still is one problem though, for some reason, when the image changes after the select time, you can see the previously shown image for one frame.
For example:

Image code:

Code: Select all

image cinematic2:
    "e0m1b" with Fade(0.25, 0.0, 0.172916)
    At("e0m1b", drunk)
    1.0
    "e0m2 movie" with Fade(0.25, 0.0, 0.172916)
Code to show in script:

Code: Select all

    scene e1bed3
    ""

    show noise onlayer noise
    show cinematic2
    $ renpy.pause(5.0, hard = True)
    ""
In this case, when the image changes from "e0m1b" to "e0m2 movie", you can see "e1bed3 when transitioning between them for one frame. I tried using scene before reproducing the cinematic, but it shows an empty png instead. How can I fix it?

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Disabling interaction without blocking the player from quitting.

#4 Post by _ticlock_ »

simba975 wrote: Thu Sep 07, 2023 9:03 pm In this case, when the image changes from "e0m1b" to "e0m2 movie", you can see "e1bed3 when transitioning between them for one frame. I tried using scene before reproducing the cinematic, but it shows an empty png instead. How can I fix it?
Not sure.

Why do you start the cinematic with transition (what it should fade from)

Code: Select all

image cinematic2:
    "e0m1b" with Fade(0.25, 0.0, 0.172916)
Possibly you wanted:

Code: Select all

image cinematic2:
    "e0m1b"
     At("e0m1b", drunk) with Fade(0.25, 0.0, 0.172916)
PS: Is there any reason for such a precision 0.172916: why not simply Fade(0.25, 0.0, 0.17). Also, you can define transition to avoid rewriting it multiple times:

Code: Select all

define fade1 = Fade(0.25, 0.0, 0.172916)

User avatar
simba975
Newbie
Posts: 22
Joined: Sun Jul 23, 2023 12:05 pm
Contact:

Re: Disabling interaction without blocking the player from quitting.

#5 Post by simba975 »

The fade on the first image was by accident and it didn't do nothing so I didn't notice. Thank you for the advice on the custom fade define though. For the 0.172916, it needs to be exactly like that for the images to transition in the same timing as the music.
The "previous image showing between the transition" problem still persists though.

My code looks like this now:

Code: Select all

image cinematic2:
    "e0m1b"
    At("e0m1b", drunk)
    1.0
    "e0m2 movie" with fadep
Any idea why it could happen? Or should I maybe mark this as solved and start a new topic with the question?

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Disabling interaction without blocking the player from quitting.

#6 Post by _ticlock_ »

simba975 wrote: Sat Sep 09, 2023 12:17 am The fade on the first image was by accident and it didn't do nothing so I didn't notice. Thank you for the advice on the custom fade define though. For the 0.172916, it needs to be exactly like that for the images to transition in the same timing as the music.
The "previous image showing between the transition" problem still persists though.

My code looks like this now:

Code: Select all

image cinematic2:
    "e0m1b"
    At("e0m1b", drunk)
    1.0
    "e0m2 movie" with fadep
Any idea why it could happen? Or should I maybe mark this as solved and start a new topic with the question?
You can start a new topic if you'd like. It may help other people who may encounter the same problem.

Anyway,

Code: Select all

image cinematic2:
    "e0m1b"
    At("e0m1b", drunk)
image "e0m1b" is immediately replaced by At("e0m1b", drunk). You can add a delay or remove "e0m1b" from the first line.

Concerning the problem:
it is hard to say without knowing transform drunk and what is definition of "e0m2 movie"(Is it just an image or movie sprite or something else?)

User avatar
simba975
Newbie
Posts: 22
Joined: Sun Jul 23, 2023 12:05 pm
Contact:

Re: Disabling interaction without blocking the player from quitting.

#7 Post by simba975 »

You can start a new topic if you'd like. It may help other people who may encounter the same problem.

Anyway,

Code: Select all

image cinematic2:
    "e0m1b"
    At("e0m1b", drunk)
image "e0m1b" is immediately replaced by At("e0m1b", drunk). You can add a delay or remove "e0m1b" from the first line.

Concerning the problem:
it is hard to say without knowing transform drunk and what is definition of "e0m2 movie"(Is it just an image or movie sprite or something else?)
"e0m2 movie" is an ogv (video). Its code is: image e0m2 movie = Movie(play="e0m2.ogv")
Now that you mentioned it i tried it with a normal image and it works fine, both with and without the transitions and the transform (fadep and drunk).
The problems come with the video, when transitioning from any image to any video the previous image can be seen between them. However, this is only the first time that video is played. If i play the same video a second time in the cinematic the problem disappears. However if i play a different video for the first time the problem comes again.

For example:

Code: Select all

image cinematic2:
    At("e0m1b", drunk)
    1
    "e0m3" with fadep
    1
    "e0m4 movie"
    1
    "e0m1b"
    1
    "e0m4 movie" with fadep
    1
    "e0m2 movie"
    1
    "e0m1b"
    1
    "e0m4 movie"
In this case the problem happens only when transitioning to "e0m4 movie" for the first time, when transitioning to "e0m2 movie", and when transitioning to "e0m4 movie" after e0m2 movie has been played. Any transition or transform make no difference.

I also tried calling the video before it is played like this:

Code: Select all

    At("e0m1b", drunk)
    1
    "e0m4 movie"
    "e0m3" with fadep
    1
    "e0m4 movie"
But it makes the problem happen when transitioning to "e0m3"

I literally have no idea what is happening, i tried making the same problem by calling show instead of scene in my previous code but even then it works fine:

Code: Select all

    scene e0m3 at drunk
    show noise
    with Dissolve(1)
    $ renpy.pause(1, hard=True)
    ""

    show e0m1b
    show noise
    play music "audio/dizzy_dream.ogg"
    "{w=3}{nw}"

    show e0m2 movie at blur2
    show noise
    with Fade(0.25, 0.0, 0.172916)
    "{w=3}{nw}"

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: Disabling interaction without blocking the player from quitting.

#8 Post by _ticlock_ »

simba975 wrote: Sun Sep 10, 2023 1:04 pm "e0m2 movie" is an ogv (video). Its code is: image e0m2 movie = Movie(play="e0m2.ogv")
Now that you mentioned it i tried it with a normal image and it works fine, both with and without the transitions and the transform (fadep and drunk).
The problems come with the video, when transitioning from any image to any video the previous image can be seen between them. However, this is only the first time that video is played. If i play the same video a second time in the cinematic the problem disappears. However if i play a different video for the first time the problem comes again.
It likely happens because the playback has started, but the first frame has not yet been decoded. You can use start_image for the Movie to avoid it:

Code: Select all

image e0m2 movie = Movie(play="e0m2.ogv", start_image = "start_image")
You can also try to predict the image or the movie image (so it would work like 2nd time the video is played).

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], MagicBuns