Live Composite - user chosen character outfit problem

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
Aviala
Miko-Class Veteran
Posts: 533
Joined: Tue Sep 03, 2013 8:40 am
Completed: Your Royal Gayness, Love Bug, Lovingly Evil
Organization: Lizard Hazard Games
Tumblr: lizardhazardgames
itch: aviala
Location: Finland
Contact:

Live Composite - user chosen character outfit problem

#1 Post by Aviala »

Hey all!

First of all, sorry for asking so many questions here OTL
I just ran into a problem that doesn't show an error message and I can't understand why it doesn't work.
So, in my game, the player can choose the main character's outfit. I succesfully made a live composite code that doesn't crash and shows the first outfit successfully. However, when I try to change the outfit to the pajama outfit by changing the currentclothes variable to 3, it still shows the same outfit.

Code: Select all

image prince: 
    LiveComposite((464,1080),
    (0,0), ConditionSwitch(
    "prince_body == 'body1'", "images/sprites2/body1.png",
    "prince_body == 'body2'", "images/sprites2/body2.png"
    ),
    (0,0), ConditionSwitch(
    "prince_expression == 'calm'", "images/sprites2/calm.png",
    "prince_expression == 'happy'", "images/sprites2/happy.png",
    "prince_expression == 'angry'", "images/sprites2/angry.png",
    "prince_expression == 'sad'", "images/sprites2/sad.png",

    ),
    (0,0), ConditionSwitch(
    "prince_clothes == 'clothesbody1'", "images/sprites2/clothes%d.png" %currentclothes, #name all clothes that are in pose 1 clothes1, clothes2 etc
    "prince_clothes == 'clothesbody2'", "images/sprites2/clothes2b%d.png" %currentclothes, #name all clothes that are in pose 2 clothes2b1 etc
    "prince_clothes == 'clothesbody3'", "images/sprites2/clothes3b%d.png" %currentclothes,
    "prince_clothes == 'clothesbody4'", "images/sprites2/clothes4b%d.png" %currentclothes,
    ),
        
    (0,0), ConditionSwitch(
    "prince_extras == 'falcon'", "images/sprites2/falcon.png",
    "prince_extras == 'flower'", "images/sprites2/flower.png",
    ),
    )

label princeclothes:

    python:
        currentclothes = 1
        prince_expression = "calm"
        prince_body = "body1"
        prince_clothes = "clothesbody1"
        prince_extras = "falcon"
    
    
    show prince
    p "I'm wearing my normal clothes."

    python:
        currentclothes = 3
        prince_expression = "calm"
        prince_body = "body1"
        prince_clothes = "clothesbody1"
        prince_extras = "falcon"
        
    p "I'm wearing my pajamas!!" #except that he's not!
What am I doing wrong? Why doesn't the outfit change like it's supposed to? I'm puzzled, because the code manages to show the correct outfit the first time when I set currentclothes to 1, but for some reasonthere's no change when I set it to 3. Maybe it's because the live composite code thinks I'm not changing anything because I'm setting prince_clothes to clothesbody1 twice? I'm just guessing here, help would be appreciated!

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Live Composite - user chosen character outfit problem

#2 Post by Divona »

Interpolating Data

Code: Select all

    (0,0), ConditionSwitch(
    "prince_clothes == 'clothesbody1'", "images/sprites2/clothes[currentclothes].png", #name all clothes that are in pose 1 clothes1, clothes2 etc
    "prince_clothes == 'clothesbody2'", "images/sprites2/clothes2b[currentclothes].png", #name all clothes that are in pose 2 clothes2b1 etc
    "prince_clothes == 'clothesbody3'", "images/sprites2/clothes3b[currentclothes].png",
    "prince_clothes == 'clothesbody4'", "images/sprites2/clothes4b[currentclothes].png",
    ),
Last edited by Divona on Sat Sep 23, 2017 7:46 am, edited 1 time in total.
Completed:
Image

User avatar
Aviala
Miko-Class Veteran
Posts: 533
Joined: Tue Sep 03, 2013 8:40 am
Completed: Your Royal Gayness, Love Bug, Lovingly Evil
Organization: Lizard Hazard Games
Tumblr: lizardhazardgames
itch: aviala
Location: Finland
Contact:

Re: Live Composite - user chosen character outfit problem

#3 Post by Aviala »

Awesome, thanks! It works!
I already tried this method earlier but changed to the one I was using because it didn't work, but I think the problem was somewhere else, like a missing comma that I fixed along the way... But I still kept thinking the method you suggested wouldn't work.

Anyway, it's fixed now and all is well!

Post Reply

Who is online

Users browsing this forum: apocolocyntose