Transition Condition Switch + im.Composite

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
SandraMJ
Newbie
Posts: 16
Joined: Fri Jun 23, 2017 6:11 am
Completed: The Hayseed Knight
Projects: The Hayseed Knight
itch: sandramj
Contact:

Transition Condition Switch + im.Composite

#1 Post by SandraMJ »

Hello everyone, I've been stalking the forum and the cookbook for a while, but I'm a complete noob when it comes to programming and I haven't found a clear answer to this, so it'd be amazing if you could help me out.

I find Asceai's TransitionConditionSwitch a great idea, but my way of composing sprites relies on im.Composite.
I was wondering if there is a way to have several variables (say, a variable to check if they're working, and so should be wearing an appropriate work attire, making the outfit sprite visible consequently), plus a way to change the expression of the sprite's face, rather than the whole image as shown in Asceai's thread.

Basically, something like this, except... well, making sense.

Code: Select all

image eina work = im.Composite (
    (1030,1000),
    (0,0), "eina/base 2.png",
    TransitionConditionSwitch(Dissolve(0.2, alpha=True),
    "face == 'angry' ",(0,0), "eina/angry 2.png",
    "work == True ", (0,0), "eina/bandana 2.png",
    "work == True ", (0,0), "eina/apron 2.png",
    (0,0), "eina/arms folded.png",
    ))
Thank you very much for your time, and my apologies if this doesn't make any sense whatsoever.

User avatar
juunishi master
Regular
Posts: 61
Joined: Sat Oct 31, 2015 12:08 am
Organization: Linemancer Works
Skype: juunishi_master
itch: juunishi-master
Location: Indonesia
Contact:

Re: Transition Condition Switch + im.Composite

#2 Post by juunishi master »

Uhm, you're not using LiveComposite like in this thread? viewtopic.php?f=51&t=21840

I'm a noob in renPy too and not really sure if TransitionConditionSwitch could be used with im.Composite or not.

(My last experience with TransitionConditionSwitch ended up with errors which I couldn't figure out why or how it could happened)

User avatar
SandraMJ
Newbie
Posts: 16
Joined: Fri Jun 23, 2017 6:11 am
Completed: The Hayseed Knight
Projects: The Hayseed Knight
itch: sandramj
Contact:

Re: Transition Condition Switch + im.Composite

#3 Post by SandraMJ »

I'm not honestly sure if I should use LiveComposite or imComposite here, but I would like to use TransitionConditionSwitch on the mere basis that I'd prefer not to write a million "with Dissolve", haha.

However, the most important question here for me is whether I could do something like the variables I mentioned, since I'm gonna have to generate a mind boggling amount of sprites otherwise.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Transition Condition Switch + im.Composite

#4 Post by trooper6 »

You def want LiveComposite not im.Composite.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
SandraMJ
Newbie
Posts: 16
Joined: Fri Jun 23, 2017 6:11 am
Completed: The Hayseed Knight
Projects: The Hayseed Knight
itch: sandramj
Contact:

Re: Transition Condition Switch + im.Composite

#5 Post by SandraMJ »

Hey, after some more investigation on TransitionCondition Switch and looking into live Composite, I ended up figuring a way to get the result I wanted! Here's a small excerpt in case it'll help some other noob sometime:

I use "emood" as a variable to change the expression/pose of this particular character as needed, and "work" as a variable to change the character's outfit depending on whether they're at work or not since that's a recurring scene.

Code: Select all

image eina 2 = LiveComposite(
        (1030,1212),
        (0,0), "eina/base 2.png",
        (0,0), TransitionConditionSwitch(Dissolve(0.2, alpha=True),       
            "emood == 'angry' ", "eina/angry 2.png",
            "emood == 'worried'", "eina/worried.png",
            "emood == 'smirk' ", "eina/smirk.png",
            "emood == 'hmph' ", "eina/hmph 2.png",
            ),
        
        (0,0), TransitionConditionSwitch(Dissolve(0.2, alpha=True),
            "work == False ", "null.png",
            "work == True " and "emood == 'worried'" or "emood == 'smirk'", "eina/bandana.png",
            "work == True " and "emood == 'angry'" or "emood == 'hmph'", "eina/bandana 2.png",
            ),
        (0,0), TransitionConditionSwitch(Dissolve(0.2, alpha=True),
            "work == False ", "null.png",
            "work == True ", "eina/apron 2.png",
            ),
        (0,0), TransitionConditionSwitch(Dissolve(0.2, alpha=True),
            "emood == 'angry' ", "eina/arms what.png", 
            "emood == 'worried'", "eina/arms chin.png",
            ), 
        )
Thank you very much for pointing me in the right direction :) Now what I'm wondering is how could I move some of those. For example:

Code: Select all

 (0,0), TransitionConditionSwitch(Dissolve(0.2, alpha=True),       
            "emood == 'angry' ", "eina/angry 2.png",
            "emood == 'worried'", "eina/worried.png",
            "emood == 'smirk' ", "eina/smirk.png",
            "emood == 'hmph' ", "eina/hmph 2.png",
            ),
There, the smirk face needs to be placed at (5,10). Could I make the switch change its position?

Post Reply

Who is online

Users browsing this forum: Andredron