Add blur to character callback?

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
olddog
Newbie
Posts: 18
Joined: Sun Dec 30, 2018 11:27 am
Projects: Kismet, a TF/TG game
Contact:

Add blur to character callback?

#1 Post by olddog »

Is there a way so that, whenever a specific character talks, the screen ALWAYS blurs? Via a callback so I don't have to manually add the blur code to every line of dialogue?

And then, additional, when that character stops talking, it returns to normal?

Bonus points if the blur stays in effect during multiple character calls for speaking!

Like:

charles "blah blah blah"
charles "ha ha ha"
jodie "laaaame"

So, Charles talks, the screen blurs. It stays blurred during his second dialogue but as soon as Jodie talks, the screen clears until the next time Charles talks.

User avatar
PyTom
Ren'Py Creator
Posts: 16094
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: Add blur to character callback?

#2 Post by PyTom »

Hm... sort of. The problem is the sprites would get blurred. Is that 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

olddog
Newbie
Posts: 18
Joined: Sun Dec 30, 2018 11:27 am
Projects: Kismet, a TF/TG game
Contact:

Re: Add blur to character callback?

#3 Post by olddog »

PyTom wrote: Fri Jan 22, 2021 10:40 pm Hm... sort of. The problem is the sprites would get blurred. Is that what you want?
Yup, I'm definitely fine with that. I know how to do it in renpyb itself but I need to do it as a callback function and that I don't know. I was using, uh, show master layer blur ? I think? I'm on my phone so I could be wrong.

strayerror
Regular
Posts: 159
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Add blur to character callback?

#4 Post by strayerror »

This looked interesting and so decided to take a quick run at it. Be aware that this is just rushed concept code, so there may be problems with it I've not noticed yet, or won't become apparent except in more complex scenarios, most especially the "reset" call, which I'm fairly certain that despite seeming to function, probably isn't the intended way of achieving this. I was also unable to find a quick way to check if the transform is already applied to the layer, so it's re-applied each time which isn't ideal, and may cause issues if using more complex transitions (i.e. you wouldn't notice dissolving from one image to the same image, but you would if it was a move/fade etc).

Code: Select all

transform mindfog:
    blur 30


init python:
    def foo_callback(event, interact=True, **kwargs):
        if not interact:
            return

        if event == 'begin':
            # Apply transform defined above to default (i.e. master) layer.
            renpy.show_layer_at(mindfog)
        elif event == 'end':
            # This will clear all transforms on the layer, so you may need
            # something cleverer if you're using others at the same time.
            # Not sure this is the best way to reset, but it works. :/
            renpy.show_layer_at(reset, reset=True)

        # When skipping no need to try and transition nicely.
        if not config.skipping:
            # Only transition the master layer to avoid delaying the say screen.
            renpy.with_statement({'master': dissolve})


define foo = Character('Foo', callback=foo_callback)
define bar = Character('Bar')


label start:
    scene background
    show foo at left
    show bar at right
    bar 'Welcome, this my friend Foo.'
    foo 'Boo!'
    bar 'Pretty unnerving, right?'
    foo 'Boo!' with fade # Overrides dissolve in callback.
    foo 'Boo-ooooOOOHH!'
    pause
    return

olddog
Newbie
Posts: 18
Joined: Sun Dec 30, 2018 11:27 am
Projects: Kismet, a TF/TG game
Contact:

Re: Add blur to character callback?

#5 Post by olddog »

Wow, that worked exactly like I wanted! It kept the blur through the conversation and everything. Thank you so much! This will also be great reference for any similar things I need to do.

Post Reply

Who is online

Users browsing this forum: Google [Bot]