Sprite transformation during dialogue
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.
Sprite transformation during dialogue
I have been looking around for a while but have so far been unable to figure out whether this is even possible with the current version of Ren'Py without the use of additional image files.
I am looking for a function that dims the inactive characters (darkens the sprite) currently on the screen (but not talking).
Is this possible? And if so, I would much appreciate an example!
I am looking for a function that dims the inactive characters (darkens the sprite) currently on the screen (but not talking).
Is this possible? And if so, I would much appreciate an example!
Re: Sprite transformation during dialogue
Almost anything is POSSIBLE on Renpy. Doing this efficiently (i.e., by recognizing which character is speaking and dimming all other characters) is a pain in the butt though. Doing it by hand is even more of a pain in the butt. But well, the clues are all available, just a matter of cobbling them together to do what you want.
Darkening images: http://www.renpy.org/doc/html/displayab ... atrixcolor
ConditionSwitch: http://lemmasoft.renai.us/forums/viewto ... 51&t=19063
Character callbacks: http://www.renpy.org/wiki/renpy/doc/coo ... d_Lip_Flap (this is an example of tracking who's speaking -- be warned, it's not easy to understand)
Darkening images: http://www.renpy.org/doc/html/displayab ... atrixcolor
ConditionSwitch: http://lemmasoft.renai.us/forums/viewto ... 51&t=19063
Character callbacks: http://www.renpy.org/wiki/renpy/doc/coo ... d_Lip_Flap (this is an example of tracking who's speaking -- be warned, it's not easy to understand)
Re: Sprite transformation during dialogue
MatrixColor seems to be what I need, but I am not sure how to call it for individual characters. I honestly don't mind doing it by hand if doing so "only" requires something like:
Code: Select all
show character with MatrixColor
- Donmai
- Eileen-Class Veteran
- Posts: 1960
- Joined: Sun Jun 10, 2012 1:45 am
- Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
- Projects: Slumberland
- Location: Brazil
- Contact:
Re: Sprite transformation during dialogue
Maybe this thread could help: http://lemmasoft.renai.us/forums/viewto ... =8&t=34286philat wrote:Almost anything is POSSIBLE on Renpy. Doing this efficiently (i.e., by recognizing which character is speaking and dimming all other characters) is a pain in the butt though.
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)
TOIRE NO HANAKO (A Story About Fear)
Re: Sprite transformation during dialogue
...dammit, good catch. I'd been using character callbacks, which are way more of a hassle.Donmai wrote:Maybe this thread could help: http://lemmasoft.renai.us/forums/viewto ... =8&t=34286philat wrote:Almost anything is POSSIBLE on Renpy. Doing this efficiently (i.e., by recognizing which character is speaking and dimming all other characters) is a pain in the butt though.
Re: Sprite transformation during dialogue
While this sounds great and all, and I really do appreciate the help, I'm not at all familiar with neither Python nor Ren'Py. Would combining MatrixColor, ConditionSwitch, and _last_say_who achieve my goal? That is, to have the sprite of whomever isn't talking darken without the use of new images to do so?
Re: Sprite transformation during dialogue
I've fiddled with IMMatrixcolor and while it works for a pre-built single image, I had trouble figuring out how to make it work for Composite images.
Anyways, I don't exactly know enough to know exactly how to do this, but wouldn't there be a way to rewrite how the default "say" command works, so that any time you try to just use it normally, it also flags that "character X" is the one speaking, and therefore all "not-character X" would be not speaking?
I've sort of being trying to figure out how to do something similar, to have the game understand that "Bob's" dialog lines are attached to "Bob's" character sprite, and to know where he is on the screen, so that if I place the sprite on the left, the game knows he's on the left, and if I place him on the right, it knows he's on the right, so I can get a word balloon's tail to point in the right direction without having to manually set it each time.
Anyways, I don't exactly know enough to know exactly how to do this, but wouldn't there be a way to rewrite how the default "say" command works, so that any time you try to just use it normally, it also flags that "character X" is the one speaking, and therefore all "not-character X" would be not speaking?
I've sort of being trying to figure out how to do something similar, to have the game understand that "Bob's" dialog lines are attached to "Bob's" character sprite, and to know where he is on the screen, so that if I place the sprite on the left, the game knows he's on the left, and if I place him on the right, it knows he's on the right, so I can get a word balloon's tail to point in the right direction without having to manually set it each time.
Re: Sprite transformation during dialogue
Yes. Define a ConditionSwitch image that uses _last_say_who as a condition to switch between the normal sprite and darkened sprite. (Examples of using im.MatrixColor are in the documentation.) Then show the ConditionSwitch image as you would normally show any other image in your script.PXL wrote:While this sounds great and all, and I really do appreciate the help, I'm not at all familiar with neither Python nor Ren'Py. Would combining MatrixColor, ConditionSwitch, and _last_say_who achieve my goal? That is, to have the sprite of whomever isn't talking darken without the use of new images to do so?
Re: Sprite transformation during dialogue
Haven't thought about the second part of your question, but I'm bored at work and procastinating today, so gave some thought to the first part. The issue is that image manipulators (all the im. functions like im.Scale, im.Flip, im.Matrixcolor, etc.) only take images, not displayables like LiveComposite. To get around that, I fiddled a bit with AlphaBlend instead.Onishion wrote:I've fiddled with IMMatrixcolor and while it works for a pre-built single image, I had trouble figuring out how to make it work for Composite images.
Anyways, I don't exactly know enough to know exactly how to do this, but wouldn't there be a way to rewrite how the default "say" command works, so that any time you try to just use it normally, it also flags that "character X" is the one speaking, and therefore all "not-character X" would be not speaking?
I've sort of being trying to figure out how to do something similar, to have the game understand that "Bob's" dialog lines are attached to "Bob's" character sprite, and to know where he is on the screen, so that if I place the sprite on the left, the game knows he's on the left, and if I place him on the right, it knows he's on the right, so I can get a word balloon's tail to point in the right direction without having to manually set it each time.
As a disclaimer, I only tried this with a LiveComposite made up of one image and one ConditionSwitch. As such, I don't know if this is going to be hilariously expensive to run with more complex images, but... so far it works? Not as fancy im.MatrixColor, but it will at least give general tints to images, which is enough to get the job done for this particular use case.
Code: Select all
image livecomp = LiveComposite(define LiveComposite here as normal)
image livecompalpha:
Flatten("livecomp") # makes a semitransparent version of livecomp to act as the control. Uses Flatten because otherwise, alpha is applied to each layer, making everything weird
alpha 0.5
image ablivecomp = AlphaBlend("livecompalpha", "livecomp", Solid("#000"), alpha=True) # blends livecomp and the Solid() to darken image
Re: Sprite transformation during dialogue
Interesting. I might try that later and hope by computer doesn't melt when it's applied to by dozens of layers character sprite.
Re: Sprite transformation during dialogue
I feel like my thread may have been hijacked a bit, but I'm glad someone got the answers they needed. I, however, am not using LiveComposite. So if I was to do something like this for several characters, how would the code look and how would I use it?
Re: Sprite transformation during dialogue
PXL wrote:I feel like my thread may have been hijacked a bit, but I'm glad someone got the answers they needed. I, however, am not using LiveComposite. So if I was to do something like this for several characters, how would the code look and how would I use it?
Everything you need has been linked to in this thread. At some point, you're going to have to learn to fish. I'm not trying to be antagonistic, I'm trying to calibrate your expectations for this forum.philat wrote:Yes. Define a ConditionSwitch image that uses _last_say_who as a condition to switch between the normal sprite and darkened sprite. (Examples of using im.MatrixColor are in the documentation.) Then show the ConditionSwitch image as you would normally show any other image in your script.
Re: Sprite transformation during dialogue
I'm sorry but I asked for an example exactly because I have no idea of how to put any of this together.philat wrote:Everything you need has been linked to in this thread. At some point, you're going to have to learn to fish. I'm not trying to be antagonistic, I'm trying to calibrate your expectations for this forum.
Re: Sprite transformation during dialogue
Why? Again, I'm not trying to be an asshole. I'm asking. What are you having difficulty with (at some level of specificity beyond "everything")? Do you understand what variables are? Do you understand conditions (if A, then B, if not, then C)? Do you understand how ConditionSwitch changes an image based on a variable? Do you understand how im.MatrixColor can be used to darken an image?
Take a stab at putting something together. If it doesn't work, post what you came up with, and we can discuss what went wrong.
Take a stab at putting something together. If it doesn't work, post what you came up with, and we can discuss what went wrong.
- Donmai
- Eileen-Class Veteran
- Posts: 1960
- Joined: Sun Jun 10, 2012 1:45 am
- Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
- Projects: Slumberland
- Location: Brazil
- Contact:
Re: Sprite transformation during dialogue
Hi, PXL. If you have problems understanding how to use ConditionSwitch, there's a tutorial here: http://lemmasoft.renai.us/forums/viewto ... 51&t=19063
Remember _last_say_who is the variable you want to test.
Remember _last_say_who is the variable you want to test.
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)
TOIRE NO HANAKO (A Story About Fear)
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot]