best way to do expressions using miniature avatars
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.
-
- Regular
- Posts: 42
- Joined: Fri Jun 15, 2007 9:45 am
- Location: Philly, USA
- Contact:
best way to do expressions using miniature avatars
I've decided that in my game, the main character will have a small avatar on the left of the text box. That's easy enough to copy from the demo, but what about showing different facial expressions? Should I create a different character for each expression? What's the elegant way to code this? I'm thinking of Nettestadt and Jitteh Dawn as examples of the desired effect.
EDIT: FYI, I'm also using DynamicCharacter so that the user can input a name, so the solution needs to work with this.
EDIT: FYI, I'm also using DynamicCharacter so that the user can input a name, so the solution needs to work with this.
"HOLD ON TIGHT" ~ Outfits and expressions, where art thou? And why does Elsa's face look so awful??? *bangs head in*
Everytime you delete a traceback, someone else gets it. -PyTom
Everytime you delete a traceback, someone else gets it. -PyTom
- PyTom
- Ren'Py Creator
- Posts: 16093
- 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: best way to do expressions using miniature avatars
Nowadays, you can use ShowingSwitch to choose the expression. See the example at the website, it should work similarly for a DynamicCharacter.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Veteran
- Posts: 373
- Joined: Tue Jul 10, 2007 2:54 am
- Projects: Starlight Ep0, Ep1
- Location: San Fransisco
- Contact:
Re: best way to do expressions using miniature avatars
I can see how ConditionSwitch could be used for the desired effect, but I am not quite clear on the usage of ShowingSwitch.
This is the code I found:
Now what? If I do:
I get an error if I don't define that image or I get two images if I do.
Am I just supposed to do this?
That works but seems kinda... dunno... odd.
*scratches head*
This is the code I found:
Code: Select all
init:
$ e = Character(
'Eileen',
color="#c8ffc8",
window_left_padding=160,
show_side_image=ShowingSwitch(
"eileen happy", "eileen_side_happy.png",
"eileen vhappy", "eileen_side_vhappy.png",
"eileen concerned", "eileen_side_concerned.png",
None, Null(),
xalign=0.0, yalign=1.0))
Code: Select all
e "How am I feeling today?"
show eileen happy
Am I just supposed to do this?
Code: Select all
init:
image eileen happy = Null()
*scratches head*
-
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
Re: best way to do expressions using miniature avatars
I believe (correct me if I'm wrong, PyTom) that where ConditionSwitch selects an image based on an arbitrary condition, ShowingSwitch selects an image according to which other images are displayed. So you're supposed to have two images: one full-size character image, and one smaller image by the message window. From your description it sounds like you want just the smaller image; declaring the full-size image as Null() might work, but it "seems odd" because it's extra effort. Perhaps you want something more like:rocket wrote:I can see how ConditionSwitch could be used for the desired effect, but I am not quite clear on the usage of ShowingSwitch.
~snip~
I get an error if I don't define that image or I get two images if I do.
Code: Select all
show_side_image=ConditionSwitch(
"eileen_expr == 'happy'", "eileen_side_happy.png",
"eileen_expr == 'vhappy'", "eileen_side_vhappy.png",
"eileen_expr == 'concerned'", "eileen_side_concerned.png",
-
- Veteran
- Posts: 373
- Joined: Tue Jul 10, 2007 2:54 am
- Projects: Starlight Ep0, Ep1
- Location: San Fransisco
- Contact:
Re: best way to do expressions using miniature avatars
Yes exactly.
It's odd because working around the system that way allows me to use normal "show charaName.mood" statements, whereas ConditionSwitch would force me to rewrite my script and put in "show charaName" "charaNameMood = mood" pairs.
*shrug*
It's odd because working around the system that way allows me to use normal "show charaName.mood" statements, whereas ConditionSwitch would force me to rewrite my script and put in "show charaName" "charaNameMood = mood" pairs.
*shrug*
-
- Regular
- Posts: 87
- Joined: Sat Jun 23, 2007 9:19 am
- Projects: ALICE.NET
- Location: The other end of the internet.
- Contact:
Re: best way to do expressions using miniature avatars
Hmm, good point-- I guess my method is the one that takes extra effort. n.n"rocket wrote:It's odd because working around the system that way allows me to use normal "show charaName.mood" statements, whereas ConditionSwitch would force me to rewrite my script and put in "show charaName" "charaNameMood = mood" pairs.
-
- Veteran
- Posts: 373
- Joined: Tue Jul 10, 2007 2:54 am
- Projects: Starlight Ep0, Ep1
- Location: San Fransisco
- Contact:
Re: best way to do expressions using miniature avatars
PyTom! Please enlighten us! What is the intended usage of ShowingSwitch? What are we missing?!
:edit:
Wait, no, I'm an idiot.
If you were using the mini picture you wouldn't necessarily use "show charaName" because they'd just show up when you had them speak. So you could:
Is that the intended usage? *blinks*
:edit:
Wait, no, I'm an idiot.
If you were using the mini picture you wouldn't necessarily use "show charaName" because they'd just show up when you had them speak. So you could:
Code: Select all
show jenny
$ jennyMood = happy
jen "I'm so happy!"
$ lucyMood=angry
lucy "Baka! What's there to be happy about?!"
jen "Huh who's that?"
show lucy
lucy "Tada, it's me! It's me!"
lucy "Stop hogging the stage!"
play sound push
hide jenny
$ lucyMood=happy
lucy "Much better."
$ jennyMood = sad
jenny "Boo hoo!"
- PyTom
- Ren'Py Creator
- Posts: 16093
- 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: best way to do expressions using miniature avatars
ShowingSwitch is intended for use with show_side_image, so that the side image's expression can easily match the emotion displayed on the screen. Unlike ConditionSwitch, ShowingSwitch properly deals with image prediction, so it's the better of the two to use if you can get away with it. (Even if you have to define some images to be Null().
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot]