Showing multiple images for one condition live composite
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.
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Showing multiple images for one condition live composite
Sorry I currently have no internet at my house for the time being so I am on my phone.. But still working on my game. When I was a lot newer to Ren'Py I had a lot of tedious code set up because I didn't know of more ways to set things up. I didn't know about ConditionSwitch for live composite and such so I had a bunch of if statements and a bunch of versions of a live composite with slight changes lol. What I am doing now is condensing those. I can use condition switch for one outcome per condition. But not multiple. (showing multiple images of one condition is true) how do I go about this? I tried using an if statement inside but it also won't seem to let me do more than one outcome per condition. What would the proper syntax for this be or can you do it at all? I hope this makes sense. I can't share my code on my phone..
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Showing multiple images for one condition live composite
Have you tried nesting some ConditionSwitch() inside a LiveComposite()?
https://www.renpy.org/doc/html/displaya ... eComposite
https://www.renpy.org/doc/html/displaya ... eComposite
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: Showing multiple images for one condition live composite
Yes that's what I mean. It works but I can't make one condition have multiple outcomes. It only Does The first outcome
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: Showing multiple images for one condition live composite
For instance I want three images to only show (outfit pieces) if a variable is true. It only reads the first image listed and then the character is basically half naked
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Showing multiple images for one condition live composite
Can you show your code?
Is it something like this?:
Is it something like this?:
Code: Select all
image test = LiveComposite(
(300, 600),
(0, 0), ConditionSwitch(
"var == 1", "top1.png",
"var == 2", "top2.png",
"True", "top3.png"),
(0, 0), ConditionSwitch(
"var == 1", "middle1.png",
"var == 2", "middle2.png",
"True", "middle3.png"),
(0, 0), ConditionSwitch(
"bott_var == 1", "bottom1.png",
"bott_var == 2", "bottom2.png",
"True", "bottom3.png")
)Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: Showing multiple images for one condition live composite
I can't post code I'm on my phone and yes it looks like that. I need it to be "var == True", "mypic1.png", "mypic2.png", "mypic3.png"
I need three images to show from one variable. It doesn't work if I put them in one line like above and if I do
"var == True", "mypic1.png",
"var == True", "mypic2.png"
That doesn't work either. It only reads the first one. Understand?
I need three images to show from one variable. It doesn't work if I put them in one line like above and if I do
"var == True", "mypic1.png",
"var == True", "mypic2.png"
That doesn't work either. It only reads the first one. Understand?
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Showing multiple images for one condition live composite
I think I understand.
I've tested my code and it works, but only one image of every ConditionSwitch will show, and these images are nested in the LiveComposite.
In my example, if you set "var=True" you will see "top1.png" and "middle1.png". The two of them nested inside the LiveComposite.
Another way is to nest several LiveComposite inside one ConditionSwitch, maybe this makes more sense to your needs:In this example, when var=True you'll see mypic1, 2 and 3. If it's False, you'll see mypic4, 5, 6.
I've tested my code and it works, but only one image of every ConditionSwitch will show, and these images are nested in the LiveComposite.
In my example, if you set "var=True" you will see "top1.png" and "middle1.png". The two of them nested inside the LiveComposite.
Another way is to nest several LiveComposite inside one ConditionSwitch, maybe this makes more sense to your needs:
Code: Select all
image test2 = ConditionSwitch(
"var", LiveComposite(
(200,100),
(0, 0), "mypic1.png",
(50, 0), "mypic2.png",
(100, 0), "mypic3.png"),
"True", LiveComposite(
(200,100),
(0, 0), "mypic4.png",
(50, 0), "mypic5.png",
(100, 0), "mypic6.png")
)Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: Showing multiple images for one condition live composite
The last example might work. I will try that out
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: Showing multiple images for one condition live composite
Well this is actually what I had in the beginning lol I guess there isn't a simpler solution
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Showing multiple images for one condition live composite
Well, the thing is, if you want to present different images together, the simplest way is to combine them in a single image with GIMP, Photoshop or similar. I presume that you have the images separated because, in some place, you are going to use them separately, if not, put them together and the code will be simpler.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- namastaii
- Eileen-Class Veteran
- Posts: 1350
- Joined: Mon Feb 02, 2015 8:35 pm
- Projects: Template Maker for Ren'Py, What Life
- Github: lunalucid
- Skype: Discord: lunalucid#1991
- Soundcloud: LunaLucidMusic
- itch: lunalucid
- Location: USA
- Contact:
Re: Showing multiple images for one condition live composite
They are separate because they are pieces to the player's character that change. I can't put them together as an image. They all change often
Re: Showing multiple images for one condition live composite
I think Xavimat's first solution would do what you want:
In that example, if Var was 1, then it would show the "#1" images for all three layers at once. If Var was 2, then the second set of images would all display. The way Condition Switches work is that it goes down the list from top to bottom, and the first time it hits something that is "true," it takes that result and then quits to the next thing.
Code: Select all
image test = LiveComposite(
(300, 600),
(0, 0), ConditionSwitch( #This would display the bottom-most layer, let's say this is the shoes.
"var == 1", "bottom1.png",
"var == 2", "bottom2.png",
"True", "bottom3.png")
(0, 0), ConditionSwitch( #This would display a middle later, let's say the pants
"var == 1", "middle1.png",
"var == 2", "middle2.png",
"True", "middle3.png"),
(0, 0), ConditionSwitch( #This would display a top layer, let's say the shirt
"var == 1", "top1.png",
"var == 2", "top2.png",
"True", "top3.png"),
)
Re: Showing multiple images for one condition live composite
Yeap, it was the correct answerOnishion wrote:I think Xavimat's first solution would do what you want:
I think namastaii asked if this was possible:
Code: Select all
image test = LiveComposite(
(300, 600),
(0, 0), ConditionSwitch( #This would display the bottom-most layer, let's say this is the shoes.
"var == 1", "bottom1.png",
"var == 2", "bottom2.png",
"var == 3", "bottom3.png",
"var == 1", "middle1.png",
"var == 2", "middle2.png",
"var == 3", "middle3.png",
"var == 1", "top1.png",
"var == 2", "top2.png",
"var == 3", "top3.png")
)
