[Solved] Regrouping multiple Live2D expressions into one

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
laure44
Regular
Posts: 60
Joined: Mon Mar 08, 2021 10:55 pm
Projects: Arkan'sTower, Gemshine Lorelei!
Location: France
Contact:

[Solved] Regrouping multiple Live2D expressions into one

#1 Post by laure44 » Mon Mar 08, 2021 11:14 pm

Hello! I've been working on Live2D sprites recently, it took me a while to understand how everything works, and now I'm enjoying this new feature very much.

I want my characters to have A LOT of different animations, by taking advantage of non exclusive expressions. I wanted to know if there is a way to combine multiple expressions into one, to call them at the same time in a faster way?

For instance : I have a "wideeyed" and a "blueforehead" expressions. I want to create some kind of alias that regroups both (say "terrified").

Which would result in writing

Code: Select all

show sprite idle terrified
instead of

Code: Select all

show sprite idle wideeyed blueforehead
Would that be possible?

Thanks in advance!
Last edited by laure44 on Sun Mar 14, 2021 2:08 pm, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Regrouping multiple Live2D expressions into one

#2 Post by PyTom » Sat Mar 13, 2021 12:28 pm

Yes. The Live2D displayable has a parameter, attribute_function, that's used for this. It takes in a tuple of attributes, and returns a tuple of attributes, which should let you do arbitrary things.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
laure44
Regular
Posts: 60
Joined: Mon Mar 08, 2021 10:55 pm
Projects: Arkan'sTower, Gemshine Lorelei!
Location: France
Contact:

Re: Regrouping multiple Live2D expressions into one

#3 Post by laure44 » Sun Mar 14, 2021 2:08 pm

I did not realize attribute_function was meant for this! I managed to make it work. Thank you very much, PyTom!

Post Reply

Who is online

Users browsing this forum: Alex, Google [Bot], nyeowmi