[SOLVED] Character expressions not changing

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
DollhouseRose
Regular
Posts: 61
Joined: Tue Aug 27, 2019 2:36 pm
Completed: Graveyard Girls & Starlight Shores
Projects: Graveyard Girls & Starlight Shores
Organization: Delphinium Interactive
itch: tidalblossoms
Location: Canada
Contact:

[SOLVED] Character expressions not changing

#1 Post by DollhouseRose » Wed Aug 28, 2019 5:37 pm

So in my scene, the character arrives and things seem fine/sprites are displaying properly at first. But once I reuse an expression, it doesn't appear when I use "show" in the second instances. I've tried using the "hide" feature, but when I use it after every change of expressions to hide the previous expression, it gets exhausting to constantly command "hide", and when I do that my game gets choppy. Text loads slowly, and transitions like dissolve are distorted in a laggy way. I've included my code below.

show smile1kc
with dissolve

i "Blah."
d "Blah blah?"

show shock1kc
with dissolve

i "How did you know?"
d "My roommate told me, he knows you."

show smirk2kc
with dissolve

i "He did? How nice of him... Did he mention that blahblah?"
d "..."
d "No, Blah."

show smile3kc
with dissolve

i "Blah!"
i "Blah."
d "Blah."

show shock1kc
with dissolve


So for example, when I use "shock1kc" in the second instance at the bottom of this code, it doesn't display the shock expression. Sorry, I'm a total noob. Can anyone help me out?
Last edited by DollhouseRose on Wed Sep 18, 2019 1:35 pm, edited 1 time in total.

User avatar
parttimestorier
Veteran
Posts: 428
Joined: Thu Feb 09, 2017 10:29 pm
Completed: No Other Medicine, Well Met By Moonlight, RE:BURN, The Light at the End of the Ocean, Take A Hike!, Wizard School Woes
Projects: Seeds of Dreams
itch: janetitor
Location: Canada
Contact:

Re: Character expressions not changing

#2 Post by parttimestorier » Wed Aug 28, 2019 6:50 pm

I'm not sure if this is the problem, but I wonder if it has something to do with how you've defined the images? I've always done it with the character name first and then the description of the expression second, like "show kc shock1" and "show kc smile1" or something. That's the way the tutorial does it, with examples like "eileen happy". I would guess that maybe the way you have it set up might means that it doesn't recognize that they're different expressions for the same character, and so it's treating them all as separate images and just layering them over each other instead of switching between them. I would try rearranging the way you've defined the images and see if anything changes.
ImageImageImage

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Character expressions not changing

#3 Post by Remix » Wed Aug 28, 2019 6:51 pm

You should try to use tags within your image definitions... If you show a tag (with different attributes/expression) that is already showing, it replaces it...

Code: Select all

# just the tag on its own
image 1kc = "images/normal1kc.png"
# same tag, with attribute smile
image 1kc smile = "images/smile1kc.png"
# same tag, with attribute shock
image 1kc shock = "images/shock1kc.png"

define kc = Character("KC", image="1kc")

label start:

    show 1kc
    kc smile "smiling"
    kc shock "shocking"
    kc -shock "normal"
Even better is to name your images well and let Ren'Py do all the defines automatically

Code: Select all

define config.automatic_images = [' ', '_'] # Add underscores in interpreted automatic image names
Now, if you have 1kc_shock.png it will automatically create an image with tag 1kc and attribute shock
Note: the image name starts with the tag
Frameworks & Scriptlets:

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: Character expressions not changing

#4 Post by hell_oh_world » Wed Aug 28, 2019 6:56 pm

DollhouseRose wrote:
Wed Aug 28, 2019 5:37 pm
So in my scene, the character arrives and things seem fine/sprites are displaying properly at first. But once I reuse an expression, it doesn't appear when I use "show" in the second instances. I've tried using the "hide" feature, but when I use it after every change of expressions to hide the previous expression, it gets exhausting to constantly command "hide", and when I do that my game gets choppy. Text loads slowly, and transitions like dissolve are distorted in a laggy way. I've included my code below.

show smile1kc
with dissolve

i "Blah."
d "Blah blah?"

show shock1kc
with dissolve

i "How did you know?"
d "My roommate told me, he knows you."

show smirk2kc
with dissolve

i "He did? How nice of him... Did he mention that blahblah?"
d "..."
d "No, Blah."

show smile3kc
with dissolve

i "Blah!"
i "Blah."
d "Blah."

show shock1kc
with dissolve


So for example, when I use "shock1kc" in the second instance at the bottom of this code, it doesn't display the shock expression. Sorry, I'm a total noob. Can anyone help me out?
Try to declare your images like this:

Code: Select all

image kc shock = ""
image kc smirk = ""

label start:
	"some dialogue"
	show kc shock
	
	"some dialogue"
	show kc smirk
	
	## These will automatically replace the images of the same tag without the need for the hide statement.
The reason maybe its not showing on the second instance because you don't have any interactions on your code.

Code: Select all

show smile1kc
        with dissolve

        i "Blah."
        d "Blah blah?"

        show shock1kc
        with dissolve

        i "How did you know?"
        d "My roommate told me, he knows you."

        show smirk2kc
        with dissolve

        i "He did? How nice of him... Did he mention that blahblah?"
        d "..."
        d "No, Blah."

        show smile3kc
        with dissolve

        i "Blah!"
        i "Blah."
        d "Blah."

        show shock1kc ## Are these the last lines of your code?
        with dissolve ## Are these the last lines of your code?
If those were the last lines then no next interactions are available so it will lead to an end.
You could use pause statement to see if the second instance appears.

Code: Select all

show smile1kc
        with dissolve

        i "Blah."
        d "Blah blah?"

        show shock1kc
        with dissolve

        i "How did you know?"
        d "My roommate told me, he knows you."

        show smirk2kc
        with dissolve

        i "He did? How nice of him... Did he mention that blahblah?"
        d "..."
        d "No, Blah."

        show smile3kc
        with dissolve

        i "Blah!"
        i "Blah."
        d "Blah."

        show shock1kc ## Are these the last lines of your code?
        with dissolve ## Are these the last lines of your code?
       
       pause # waits for the next interaction from the user

User avatar
DollhouseRose
Regular
Posts: 61
Joined: Tue Aug 27, 2019 2:36 pm
Completed: Graveyard Girls & Starlight Shores
Projects: Graveyard Girls & Starlight Shores
Organization: Delphinium Interactive
itch: tidalblossoms
Location: Canada
Contact:

Re: Character expressions not changing

#5 Post by DollhouseRose » Thu Aug 29, 2019 3:41 pm

Thanks for your help everyone! I wasn't defining images at the beginning of my game and just using the file name from the images directory. After defining the images for my main characters, the expressions changed perfectly. I've left minor character images undefined (because I've got 100s of lines of code with them undefined running fine) and it seems alright because they don't appear or change as frequently. I appreciate all the help!

Post Reply

Who is online

Users browsing this forum: Google [Bot]