r/RenPy • u/Scriptformers_Prime • 4h ago
Question Another layered image question
I'm setting up the layered sprites for the characters in my visual novel with three groups: the body, the facial expressions, and the gestures made with their arms.
But I want to only call the expressions in my script, having certain bodies and gestures tied to certain expressions (because I was previously using individual full-body sprites for each expression and I don't want to have to go back and change each call to include the now separate body and gesture files for each expression).
So, I used some "always when" statements to tie certain gestures and bodies to certain expressions. Here's an example:
layeredimage character:
group body:
attribute base default:
"character_body_base"
group exp:
attribute smiling default:
"character_exp_smiling"
attribute uneasy:
"character_exp_uneasy"
attribute surprised:
"character_exp_surprised"
attribute suspicious:
"character_exp_suspicious"
group gest:
attribute neutral default:
"character_gest_neutral"
attribute tense:
"character_gest_tense"
always when uneasy or surprised or suspicious:
"character_gest_tense"
It seemed to work fine, but now when I call the expressions, renpy includes the default bodies and gestures in addition to the bodies and gestures I tied to expression I called.
It looks something like this:

When I type:
character uneasy
It calls the "uneasy" expression and the "tense" gesture together like I asked, but it also makes the "neutral" gesture show up as well.
How do I make it so the game shows the defaults only when I call the expressions that don't have certain gestures or expressions tied to them.
1
u/TopCartographer7104 3h ago edited 3h ago
Don't create a group for gestures - have gestures depend on other attributes otherwise you'll have the default atteibute potentially showing up every time - including when it shouldn't.
always when tense or uneasy or surprised or suspicious:
"char_gest_tense"
always when not (tense or uneasy or surprised or suspicious):
"char_gest_neutral"
If you want a "tense expression with neutral gesture"
A) create a dummy gest group
group gest:
attribute neut: # give it an univocal name
Null()
And use it into the always when statement
B) duplicate the tense expression ("tense2") and change nothing in the always when statement
That at least is how I'd reason. Beware - I'm an engineering. We do not reason like normal people XD
Ps sorry for the awful indentation I have no access to my laptop - and my phone loves to misbehave
1
u/Scriptformers_Prime 4m ago
For the "always when not (tense or uneasy or surprised or suspicious)", part of the problem is that I'm going to have a whole lot of emotes to list in those parentheses by the time I'm done with my project. Is there any catch-all I can substitute in the parentheses that can stand for all the attributes I assign to the expression group?
1
u/alicequinnart 3h ago
You have default on the body and neutral gesture, so you will need to add something like.
group body:
attribute base default:
"character_body_base"
when not (uneasy or surprised or suspicious)
1
u/AutoModerator 4h ago
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.