one character with multiple poses and clothes to wear

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
shiza
Regular
Posts: 29
Joined: Wed Jun 14, 2017 12:36 pm
Contact:

one character with multiple poses and clothes to wear

#1 Post by shiza »

So I have a character that consists of a body layer and a clothing layer. the character has a lot of poses and clothing to fit onto their respected pose. For the sake of organization I gave my character a separate folder to hold all the images.

What code do I need to put in to create image that allows me to swap between layers and still have it attached to my character?

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: one character with multiple poses and clothes to wear

#2 Post by RicharDann »

You may want to use LiveComposite.

Here's a related thread:viewtopic.php?f=8&t=43675
The most important step is always the next one.

shiza
Regular
Posts: 29
Joined: Wed Jun 14, 2017 12:36 pm
Contact:

Re: one character with multiple poses and clothes to wear

#3 Post by shiza »

RicharDann wrote: Thu Nov 16, 2017 1:54 pm You may want to use LiveComposite.

Here's a related thread:viewtopic.php?f=8&t=43675
ok so i can swap between layers but the image doesn't refresh once the conditional statments are changed.

define kim_cloth_code = 0

init:
image kim = LiveComposite(
(198, 650),
(0,0), "kim/calm_side.png",
(0,0), ConditionSwitch(
"kim_cloth_code == 1", "kim/calm_c3.png",
"True", "kim/calm_c4.png")
)

#start the game
show kim #this will show the kim/calm_c4.png layer
hide kim
$kim_cloth_code = 0
show kim # sprite should have changed clothes but instead it keeps wearing the same layer.

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: one character with multiple poses and clothes to wear

#4 Post by RicharDann »

It would be better if you formatted your code by putting it between [code] and [/code] mantaining identation so it's easier to read. Anyway the problem seems to be that you're not changing the value in the script.
One thing to note is that kim_cloth_code variable should be defined using default instead of define. Define is used for values that do not change.

Code: Select all

default kim_cloth_code = 0 

image kim = LiveComposite(
    (198, 650),
    (0,0), "kim/calm_side.png",
    (0,0), ConditionSwitch("kim_cloth_code == 1", "kim/calm_c3.png", 
                           "True", "kim/calm_c4.png")
)
                         
label start:

    show kim #Here we show the image

    "Let's change clothes."

    $ kim_cloth_code = 1 #Here we change the value from default, wich is 0, to 1.
    
    #At this point LiveComposite will notice you changed the variable and show calm_c3 

    "I've changed"
    
    $ kim_cloth_code = 0 #If you do this here, it will change back to show calm_c4
    
The most important step is always the next one.

Ace94
Regular
Posts: 113
Joined: Sat Apr 08, 2017 4:22 pm
Contact:

Re: one character with multiple poses and clothes to wear

#5 Post by Ace94 »

Would this be helpful to you? https://github.com/koroshiya/renpy-image-definer

I'm unsure how exactly to "run" the script as it says in the discription...

How would you run this code?

Code: Select all

define_images('bg/', 0, False)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]