As far as I understand, the general Ren'Py line of thinking is this: when the game launches, load and apply all of the "image" commands, so the game won't refresh it's loading process every time they are called for through "show (...)".
Here is what I would like to do, but I don't how - especially since it contradicts the previously described line of thinking fundamentally: whenever a picture (not all of them, just the chosen ones) is called by "show (...)" statement, it should have a version A. However, once the "who" (speaker) changes to a different value (for example, another character starts speaking), the image should be replaced by version B - preferably with all the transformations applied to it during the original "show" statement, such as fade.
Here is an example how does this look like in the game when I add it manually (it looks weird on thumbnail but works when opened : P):
I just don't want to do this for the thousands of lines of dialogues that I currently have so I wonder if you know how to make it occur on its own. I would really appreciate your help.
How can I force my game to replace an image with another image whenever the speaker (name) changes?
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.
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.
- Aureus
- Veteran
- Posts: 278
- Joined: Sun Aug 06, 2017 4:49 am
- Completed: The Tavern, Tales From Windy Meadow
- Projects: Roadwarden
- Organization: Moral Anxiety Studio
- itch: moral-anxiety
- Location: Breslau, Poland
- Contact:
How can I force my game to replace an image with another image whenever the speaker (name) changes?
Tales From Windy Meadow - slice of life, pixel art Visual Novel set in a fantasy village. now available on Steam.
Re: How can I force my game to replace an image with another image whenever the speaker (name) changes?
Your line of thinking is logical, and it's correct to an extend, but Renpy's actually a lot smarter than that - and it redraws stuff as and when they need to be redrawn (preserving the order). I can't pretend to know every thing about it, but I know there're things like callbacks that can trigger a redraw for example.
What you want to do is actually quite doable, although I've not done the fade effect myself but it should be doable with ATL. In fact the method I'm sharing is what someone else taught me from before:
First add this variable define to your script: https://www.renpy.org/doc/html/config.h ... _attribute
As the documentation explains:
What that config variable does is, when e (eileen) speaks, it'll check to see if the associated image is showing (eileen), and if so it'll show the image with the speaking attribute instead (eileen speaking).
So you'll need to add a new image to your character(s):
That achieves the initial goal of showing a different image, the next step is how do we make non-speaking characters darker? First of all, we need to consider this: we're not actually doing anything special with non-speaking characters, we're declaring a new image for speaking characters. Therefore we actually need to darken the default characters and make the speaking character image the brighter version.
Second thing is, whether you want to make your own darker sprites or use Renpy's transforms to do it for you.
I've gotten help to get Renpy to darken my non-speaking character for me, however I'm not experienced enough with the ATL to suggest how to make it fade from bright to dark - though it's definitely doable.
My code to make my non-speaking characters darker is as follows:
This thread does talk about darkening a sprite overtime, though I haven't got time to test it out myself:
viewtopic.php?f=8&t=38231
Good luck!
What you want to do is actually quite doable, although I've not done the fade effect myself but it should be doable with ATL. In fact the method I'm sharing is what someone else taught me from before:
First add this variable define to your script: https://www.renpy.org/doc/html/config.h ... _attribute
Code: Select all
define config.speaking_attribute = "speaking" # you can call it whatever you want though, "speaker", "speaking_char", point is to give it something
It's not explained in too much details here, but basically, your speaking character should already have an image name associated to it:If not None, this should be a string giving the name of an image attribute. The image attribute is added to the image when the character is speaking, and removed when the character stops.
Code: Select all
image eileen = "eileen.png"
e = Character("Eileen", image="eileen")
So you'll need to add a new image to your character(s):
Code: Select all
image eileen = "eileen.png"
image eileen speaking = "eileen-speaking.png"
e = Character("Eileen", image="eileen")
That achieves the initial goal of showing a different image, the next step is how do we make non-speaking characters darker? First of all, we need to consider this: we're not actually doing anything special with non-speaking characters, we're declaring a new image for speaking characters. Therefore we actually need to darken the default characters and make the speaking character image the brighter version.
Second thing is, whether you want to make your own darker sprites or use Renpy's transforms to do it for you.
I've gotten help to get Renpy to darken my non-speaking character for me, however I'm not experienced enough with the ATL to suggest how to make it fade from bright to dark - though it's definitely doable.
My code to make my non-speaking characters darker is as follows:
Code: Select all
transform darken(child,value=0.25):
AlphaBlend(At(child, mask(value)), child, Solid("#000"), alpha=True)
image eileen:
At("eileen.png", darken)
image eileen speaking:
"eileen.png"
viewtopic.php?f=8&t=38231
Good luck!
- Aureus
- Veteran
- Posts: 278
- Joined: Sun Aug 06, 2017 4:49 am
- Completed: The Tavern, Tales From Windy Meadow
- Projects: Roadwarden
- Organization: Moral Anxiety Studio
- itch: moral-anxiety
- Location: Breslau, Poland
- Contact:
Re: How can I force my game to replace an image with another image whenever the speaker (name) changes?
Thank you for writing back, kivik! However - do you have an idea how could I use it not only for a character, but also for all the portraits this character has? Basically, some of my characters have 10+ portraits available and a simple "speaking-not speaking" pair won't work for me. : ( Or maybe the answer is already here but I just missed it, if that's the case, I apologize.
Tales From Windy Meadow - slice of life, pixel art Visual Novel set in a fantasy village. now available on Steam.
Re: How can I force my game to replace an image with another image whenever the speaker (name) changes?
Admittedly the approach is easier for me, because I use Dynamic Images myself, so I only need a single image for each of my characters - and change their corresponding image by variables, for example:
If you can't / don't fancy using that, I'm afraid you'll have to just duplicate your portrait declarations so you have a non-speaking and speaking version for each one.
Code: Select all
image eileen:
At("eileen/[eileen.outfit]-[eileen.mood].png", darken)
image eileen speaking:
"eileen/[eileen.outfit]-[eileen.mood].png"
- Aureus
- Veteran
- Posts: 278
- Joined: Sun Aug 06, 2017 4:49 am
- Completed: The Tavern, Tales From Windy Meadow
- Projects: Roadwarden
- Organization: Moral Anxiety Studio
- itch: moral-anxiety
- Location: Breslau, Poland
- Contact:
Re: How can I force my game to replace an image with another image whenever the speaker (name) changes?
Thank you so much for explaining this, kivik. <3
Tales From Windy Meadow - slice of life, pixel art Visual Novel set in a fantasy village. now available on Steam.
Who is online
Users browsing this forum: AWizardWithWords, Ocelot, piinkpuddiin