[SOLVED] Ease and Easein transitions only sometimes work?

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
lking22
Regular
Posts: 50
Joined: Sun Dec 03, 2017 3:33 am
Projects: Grey Feather
itch: freefall-games
Contact:

[SOLVED] Ease and Easein transitions only sometimes work?

#1 Post by lking22 »

Sorry if this turns out a little vague, but I really can't figure out why this is happening, let alone how to go about fixing it. For some reason, the 'ease' and 'easeinleft/right' transitions are only working some of the time, and I can't seem to find a pattern as to why. I think it has something to do with the code that I'm using to push the currently-speaking character to the front of the scene? I'll admit I don't 100% understand every part of that code.

Code: Select all

default current_speaker = None

init -1 python:
    def char_callback(event, **kwargs):
        showing_tags = renpy.get_showing_tags()
        current_tag = renpy.get_say_image_tag()
        character_tags = [
            t for t in
            ['doc', 'dan', 'lat', 'mid', 'thi', 'sep', 'ret', 'mic', 'rap', 'azr', 'ari', 'jop', 'gab', 'cha', 'hun', 'imp', 'ext', 'ex2', 'nar']
            if t in showing_tags
            and t != current_tag ]
        if current_tag and event == "begin":
            for tag in character_tags:
                renpy.show( tag , zorder = 0 )
                renpy.with_statement(dis, always=False)
            if renpy.showing(current_tag):
                renpy.show( current_tag , zorder = 100 )
                renpy.with_statement(dis, always=False)
        return (), kwargs
    config.all_character_callbacks.append( char_callback )

#Note: There is a version of this code below for each character, all the same besides the 'active_' and 'current_speaker =' having a different suffix
init python:
    def active_azr(event, interact=True, **kwargs):
        global current_speaker
        if not interact:
            return
        if event == "begin":
            current_speaker = 'azr'
            
#Later in the same file, not in a python section, the 'dis' transition is defined
define dis = { "master" : Dissolve(.5) }
In a different file, while the game is running, the code looks like this.

Code: Select all

    scene Cirrus
    show azr Normal at left
    with dis
    show rap Normal at right with easeinright		#easein doesn't work here (dissolves instead), but does if I move it underneath the narrator
    nvl_narrator "We land smoothly, and Azrael is quick to set me down next to another angel."
    nvl clear
    R "Oh, Dr Avery! Good to see you're not falling through the clouds here. I guess having an angel's feather really {i}does{/i} let mortals cloud-walk."
After that is a long set of questions/answers that have no transitions, which I've cut for space. Then:

Code: Select all

    R Normal2 "Alright, I guess we should get to our places, then!"
    A Normal "Good luck."
    hide azr with easeoutleft		#easein doesn't work here (dissolves instead)
    show rap at center with ease	#This ease does work for some reason
    show rap Normal with dis
    nvl_narrator "Raphael puts a hand on my back and leads me toward a boxed-off seat in the middle of the benches where the Archangel are sitting. The appearance and positioning of it makes me feel as if I'm on trial."
    nvl clear
    R "Try not to say anything stupid, okay?"
    stop music fadeout 0.5
    hide rap with dissolve
    nvl_narrator "There is a slight pause as the rest of the chatter in the room dies down. Soon, one of the angels stands."
    nvl clear
    show mic Normal with dissolve
    M "Brothers. Sisters. I won't waste time. We are in grave danger, and in disagreement as to how to handle the situation. I understand that there are two proposed solutions?"
    show ari Angry at right with easeinright	#easein doesn't work here (dissolves instead)
    a "One solution, and one desperate scramble for redemption."
    show rap Grin at left with easeinleft	#easein doesn't work here (dissolves instead)
    R "Wow, Ariel, you're almost as flattering as Az."
    $ ari_name = "Ariel"
    a "We're not here for your quips, Raphael. For once in your life, take something seriously."
    R Normal "Fine, fine. How about you present your case first?"
    a "Gladly."
    play music latsad
    a Pleading "Michael, this crisis is not something that we should handle gently. We have here, in our midst, a solid solution. This mortal is linked to the demon Latael by a soul-feather. Killing him will kill the demon."
    $ mic_name = "Michael"
    a "I am not a murderer. You know that. I take no joy in arguing this. But we all know that Latael is capable of starting a Holy War. The effect on the mortals would be too great."
    a "Our duty is to defend the mortals, as many as we can. Regrettably, that means killing this one mortal."
    R Concerned2 "And a former angel."
    M "Wait your turn, Raphael."
    R Normal "Sorry, Mikey. I'll shut up."
    nvl_narrator "Were Ariel talking about anyone else, I would most likely agree with her. However, given that she's talking about me and my son, I can't bring myself to make the logical decision."
    nvl clear
    M "Chamuel, what do you See for this path? What does the future hold?"
    $ cha_name = "Chamuel"
    show ari at right2 with ease			#ease doesn't work here (dissolves instead)
    show cha Upset at rightside with easeinright	#This easein does work for some reason
    C "Nothing..."
I can't figure out the pattern for why the ease-es do/do not work, and I'm sure this error is occurring all throughout my game (this is just the section that shows it best, since it has a lot of characters entering/exiting in quick succession). Does anyone have any clue why this is happening and how to fix it?
Last edited by lking22 on Thu Jun 27, 2019 10:14 am, edited 1 time in total.
Releases:
Image

Current projects:
In the Ashes of Dawn
Split Psyche
Savestate Gambit

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Ease and Easein transitions only sometimes work?

#2 Post by Remix »

The issue ( I think ) is that you are replacing the ease with a dis inside the character callback function...

Code: Select all

renpy.with_statement(dis, always=False)
I do not know if you could determine if a 'with transition' is running on the sprite and either do both or ignore the dis...

The only simple fix would be removing the renpy.with_statement(dis, always=False) line from the callback, though you could maybe convert all the inline withs to atl movement which might/should work.

Incidentally, this is a cleaner, more usable version of the move-speaker-to-front callback (it doesn't need you to specify your characters beforehand)

Code: Select all

default all_character_tags = []

init python:

    def char_callback(event, **kwargs):

        global all_character_tags 

        if event == "begin":

            current_tag = renpy.get_say_image_tag()

            if current_tag not in all_character_tags:
                all_character_tags.append(current_tag)

            sprite_tags = [ k for k in renpy.get_showing_tags(sort=True) 
                            if k in all_character_tags ]

            for z,k in enumerate(sprite_tags):
                zorder = ( config.tag_zorder.get(k, z) 
                           if k != current_tag else 
                           max(config.tag_zorder.values() 
                               + [len(sprite_tags)]) )
                renpy.show(k, zorder=zorder )

        return (), kwargs

    config.all_character_callbacks.append( char_callback )
Note: no renpy.with_statement call
Last edited by Remix on Thu Jun 27, 2019 11:19 am, edited 1 time in total.
Frameworks & Scriptlets:

User avatar
lking22
Regular
Posts: 50
Joined: Sun Dec 03, 2017 3:33 am
Projects: Grey Feather
itch: freefall-games
Contact:

Re: Ease and Easein transitions only sometimes work?

#3 Post by lking22 »

Ah, thank you so much! It turns out I was accidentally replacing the ease transitions with the dis ones. The streamlined code was a huge help! As it turns out, not only was the problem in the code for moving characters to the front, but it was also caused by this line as well:

Code: Select all

define config.say_attribute_transition = { "master" : Dissolve(.5) }
Taking that out fixes the issue of the other transitions not working properly, now all I have to do is figure out how to get the effect of dissolving between expressions without breaking half the other transitions in the game, haha...
Releases:
Image

Current projects:
In the Ashes of Dawn
Split Psyche
Savestate Gambit

User avatar
lking22
Regular
Posts: 50
Joined: Sun Dec 03, 2017 3:33 am
Projects: Grey Feather
itch: freefall-games
Contact:

Re: Ease and Easein transitions only sometimes work?

#4 Post by lking22 »

Okay, after a bit of playing around with things, and a lot of help from your code, it's solved! And I managed to keep the nice transitions between expressions, too. Turns out the 'with' statements in the code to move a character to the front weren't what was causing the issue, it was the say_attribute_transition causing it. Thank you so much for pointing me in the right direction with the suggestion that the intended transitions were being replaced!

For the new, working code, I removed the say_attribute_transition line entirely. While I was doing that, I merged the old version of the move-to-front code with the streamlined aspects of the new one. In this version, the newest speaker goes to the top with a nice dissolve effect, and the order is remembered as the conversation continues (ie the character who spoke before the newest one will be second in the order instead of resetting to where they were in the order when they entered the screen). The only downside is that it tends to send characters entering the scene for the first time to the back of the order.

Code: Select all

default all_character_tags = []
default current_speaker = None
init python:
    def char_callback(event, **kwargs):
        global all_character_tags
        showing_tags = renpy.get_showing_tags()
        current_tag = renpy.get_say_image_tag()
        if current_tag not in all_character_tags:
            all_character_tags.append(current_tag)
        if current_tag and event == "begin":
            for tag in showing_tags:
                renpy.show( tag , zorder = 0 )
                renpy.with_statement(dis, always=False)
            if renpy.showing(current_tag):
                renpy.show( current_tag , zorder = 100 )
                renpy.with_statement(dis, always=False)
            else:
                pass
        return (), kwargs
    config.all_character_callbacks.append( char_callback )
Releases:
Image

Current projects:
In the Ashes of Dawn
Split Psyche
Savestate Gambit

Post Reply

Who is online

Users browsing this forum: DollhouseRose, Google [Bot], Ocelot, snotwurm