[tutorial] Dress up game

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Message
Author
User avatar
pyopyon
Veteran
Posts: 451
Joined: Thu Aug 29, 2013 4:35 am
Completed: https://chouette.itch.io/
Projects: Ocean Pearls, Catching the Fox [NaNo16], Singles
Organization: Jellyfish Parade
Tumblr: jelpiparade
Skype: miss.chouette
Soundcloud: pyopyon
itch: chouette
Contact:

Re: [tutorial] Dress up game

#46 Post by pyopyon »

I've been having craaaazy issues with the dress up game-- mainly a singular one that I somehow managed to break my save function-- no matter where I save in the game, it jumps RIGHT back to the dress up game when I try to pull up the save.

sighs.

In any case, is there a way to move it as its own separate menu outside of the game? I'm getting really desperate bc my game release date is in five days (four if you count today) and I thought I would have this fixed by now ;~;

If you've got ANY idea how to help me with the whole screwed up save option thing, the board I made for it is here: http://lemmasoft.renai.us/forums/viewto ... =8&t=25689

On the other hand, this whole separating it into its own menu thing is looking like a reeeeally good option right about now...

edit: my bad-- I've been using the game example coding instead of the board's coding. Oops;;
Image ImageImage

WiP: Image

✿ Writer for Trade/Commission ✿

User avatar
pyopyon
Veteran
Posts: 451
Joined: Thu Aug 29, 2013 4:35 am
Completed: https://chouette.itch.io/
Projects: Ocean Pearls, Catching the Fox [NaNo16], Singles
Organization: Jellyfish Parade
Tumblr: jelpiparade
Skype: miss.chouette
Soundcloud: pyopyon
itch: chouette
Contact:

Re: [tutorial] Dress up game

#47 Post by pyopyon »

Is there a way to remove the speech box while the player is customizing?

Image
Image ImageImage

WiP: Image

✿ Writer for Trade/Commission ✿

User avatar
leon
Miko-Class Veteran
Posts: 554
Joined: Sun Oct 09, 2011 11:15 pm
Completed: Visual Novel Tycoon, Night at the Hospital, Time Labyrinth, The Buried Moon, Left of Center, Super Otome Quest
Projects: Lemon Project, Porcelain Heart, Dream's Dénouement
Organization: Team ANARKY
Contact:

Re: [tutorial] Dress up game

#48 Post by leon »

pyopyon wrote:edit: my bad-- I've been using the game example coding instead of the board's coding. Oops;;
Actually the example should work as well. I just saw I used label there (and can't remember why)... Anyhow, glad you sorted it out.
pyopyon wrote:Is there a way to remove the speech box while the player is customizing?
Change the dialogue with $ renpy.pause()
Instead of this:

Code: Select all

label cont:
    girl "La, la, la!"
    girl "La, la, la."    
    jump cont
Use this:

Code: Select all

label cont:
    $ renpy.pause()
    jump cont

User avatar
pyopyon
Veteran
Posts: 451
Joined: Thu Aug 29, 2013 4:35 am
Completed: https://chouette.itch.io/
Projects: Ocean Pearls, Catching the Fox [NaNo16], Singles
Organization: Jellyfish Parade
Tumblr: jelpiparade
Skype: miss.chouette
Soundcloud: pyopyon
itch: chouette
Contact:

Re: [tutorial] Dress up game

#49 Post by pyopyon »

Ah, I got it! Thank you!!
Image ImageImage

WiP: Image

✿ Writer for Trade/Commission ✿

Iulnith
Newbie
Posts: 3
Joined: Mon May 12, 2014 12:17 pm
Contact:

Re: [tutorial] Dress up game

#50 Post by Iulnith »

I was wondering, using this coding will I still be able to use ''sprite expressions''? I hope I'm using the correct term :oops: . For example, stuff like if a character was angry her/his face would look angry. I understand this is possible when the player is using a ''set character'' which they did not create. But is it possible with characters they have made in the character creation? Thank you for taking time to read this.

User avatar
pyopyon
Veteran
Posts: 451
Joined: Thu Aug 29, 2013 4:35 am
Completed: https://chouette.itch.io/
Projects: Ocean Pearls, Catching the Fox [NaNo16], Singles
Organization: Jellyfish Parade
Tumblr: jelpiparade
Skype: miss.chouette
Soundcloud: pyopyon
itch: chouette
Contact:

Re: [tutorial] Dress up game

#51 Post by pyopyon »

Yep! I asked this question earlier in another thread, so I'll leave it here.
qirien wrote:OK, this is actually simpler than I though, but involves using python, not Ren'Py. Unfortunately, we can't do what Asceai suggested because we are using a DynamicDisplayable, and im.FactorScale only works on images...

But, what you can do is add the following function in your code (I put it right before the draw_char):

Code: Select all

    def get_expression():
        if (pov_expr == "default"):
            return "default.png"
        else:
            return "%s.png"%pov_expr
Now we need to have your draw_char functions call this one, like this:

Code: Select all

    def draw_char_side(st, at): # same thing as above, just scaled and positioned for the sideimage; there's probably more elegant solution than this...

        return LiveComposite(
            (384, 674),
            (0, 375), im.FactorScale("base.png", .45, .45),
            (0, 375), im.FactorScale("skin%d.png"%skin, .45, .45),
            (0, 375), im.FactorScale(get_expression(), .45, .45),
            (0, 375), im.FactorScale("eyes%d.png"%eyes, .45, .45),
            (0, 375), im.FactorScale("other%d.png"%other, .45, .45),
            (0, 375), im.FactorScale("pants%d.png"%pants, .45, .45),
            (0, 375), im.FactorScale("shirt%d.png"%shirt, .45, .45),            
            (0, 375), im.FactorScale("jacket%d.png"%jacket, .45, .45),
            (0, 375), im.FactorScale("hair%d.png"%hair, .45, .45)
            ),.1
        
Now the only thing left to do is modify pov_expr whenever we want the character to change their expression. For example, in your code, you would put something like this:

Code: Select all

    # Expression One
    $ pov_expr = "frown"
    char "Seriously, I'm super dissatisfied right now!"
    char "Go get me chocolate!"

    # Expression Two
    $ pov_expr = "happy"
    char "Aww- you got me chocolate?"
    char "You're so nice!! I didn't expect it at all!"
    
    # Expression Three
    $ pov_expr = "blawk"    
    char "W-what do you mean you got it because I was cute?!"
    char "Don't joke so much!"
    
Basically, whatever filename you want it to use for the expression, set pov_expr to that without the ".png".
Image ImageImage

WiP: Image

✿ Writer for Trade/Commission ✿

Ishigreensa
Newbie
Posts: 20
Joined: Sun Jul 06, 2014 8:11 am
Contact:

Re: [tutorial] Dress up game

#52 Post by Ishigreensa »

I know an easier way to 'flip the image' and even add more positions.
def draw cha1(st,at):
return LiveComposite(
(xxx,xxx),
(0 , 0), ("base" + "pos.png"),

Of course, you will need to add pos variable to everything you want to trigger.

You then same your images as flipped and as regular in your image folder for the game.

in the top:
init python:
shirt, pants, hair, poss = 1, 1, 1, 1
notice I used two ss in pos. That's because pos is a keyword in renpy, but poss is not. It is not
misspelled by accident, but rather makes sure renpy doesn't treat it as the pos keyword statement.

Mii
Newbie
Posts: 11
Joined: Thu Feb 19, 2015 9:26 am
Contact:

Re: [tutorial] Dress up game

#53 Post by Mii »

Can anyone please post an example on how to use the players chosen character in events CGs please? i just can't rap my head around how to get it to work with CGs without an example. also if you have multiple style of eyes for a character how do the expressions to work
for example:
the player chose cute eye and then you show a sad expression in game using this code
pyopyon wrote:Yep! I asked this question earlier in another thread, so I'll leave it here.

qirien wrote:
OK, this is actually simpler than I though, but involves using python, not Ren'Py. Unfortunately, we can't do what Asceai suggested because we are using a DynamicDisplayable, and im.FactorScale only works on images...

But, what you can do is add the following function in your code (I put it right before the draw_char):
Code:
def get_expression():
if (pov_expr == "default"):
return "default.png"
else:
return "%s.png"%pov_expr


Now we need to have your draw_char functions call this one, like this:
Code:
def draw_char_side(st, at): # same thing as above, just scaled and positioned for the sideimage; there's probably more elegant solution than this...

return LiveComposite(
(384, 674),
(0, 375), im.FactorScale("base.png", .45, .45),
(0, 375), im.FactorScale("skin%d.png"%skin, .45, .45),
(0, 375), im.FactorScale(get_expression(), .45, .45),
(0, 375), im.FactorScale("eyes%d.png"%eyes, .45, .45),
(0, 375), im.FactorScale("other%d.png"%other, .45, .45),
(0, 375), im.FactorScale("pants%d.png"%pants, .45, .45),
(0, 375), im.FactorScale("shirt%d.png"%shirt, .45, .45),
(0, 375), im.FactorScale("jacket%d.png"%jacket, .45, .45),
(0, 375), im.FactorScale("hair%d.png"%hair, .45, .45)
),.1



Now the only thing left to do is modify pov_expr whenever we want the character to change their expression. For example, in your code, you would put something like this:

Code:
# Expression One
$ pov_expr = "frown"
char "Seriously, I'm super dissatisfied right now!"
char "Go get me chocolate!"

# Expression Two
$ pov_expr = "happy"
char "Aww- you got me chocolate?"
char "You're so nice!! I didn't expect it at all!"

# Expression Three
$ pov_expr = "blawk"
char "W-what do you mean you got it because I was cute?!"
char "Don't joke so much!"



Basically, whatever filename you want it to use for the expression, set pov_expr to that without the ".png".
but say the player chose fierce eyes instead how would you make sure the player chosen eyes for that expression showed up instead of the cute eyes?

User avatar
AERenoir
Veteran
Posts: 320
Joined: Fri May 27, 2011 8:23 pm
Contact:

Re: [tutorial] Dress up game

#54 Post by AERenoir »

Mii wrote:Can anyone please post an example on how to use the players chosen character in events CGs please? i just can't rap my head around how to get it to work with CGs without an example.
^Seconding this ask. IS there a way to link the result of the dressup game with a CG, since they have an entirely different set of assets? Way back whenever I'm using the Condition Switch to make the appropriate article of clothing or accessory show up, but it results with a huge bulky code.

glithch
Regular
Posts: 93
Joined: Sat Jul 23, 2016 5:32 am
Contact:

Re: [tutorial] Dress up game

#55 Post by glithch »

heyyy guys, i have a very noobie question. how do you change the amound of clothes :x mmy sprite doesnt have as many hair options as the one in the example(but has more shirts) and i cant find a number of those options anywhere in the script...

Kamos
Regular
Posts: 33
Joined: Mon Jan 02, 2017 5:18 am
Tumblr: Kamos
Contact:

Re: [tutorial] Dress up game

#56 Post by Kamos »

I'm sorry, but an uncaught exception occurred.

While running game code:
ScriptError: Name (u'C:\\Users\\Ales\\renpy games\\Dressup/game/options.rpy', 1343828317, 0) is defined twice, at images/options.rpyc:10 and game/options.rpy:10.

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "D:\renpy-6.99.9-sdk\renpy\bootstrap.py", line 295, in bootstrap
renpy.main.main()
File "D:\renpy-6.99.9-sdk\renpy\main.py", line 364, in main
renpy.game.script.load_script() # sets renpy.game.script.
File "D:\renpy-6.99.9-sdk\renpy\script.py", line 265, in load_script
self.load_appropriate_file(".rpyc", ".rpy", dir, fn, initcode)
File "D:\renpy-6.99.9-sdk\renpy\script.py", line 753, in load_appropriate_file
self.finish_load(stmts, initcode, filename=fn + source)
File "D:\renpy-6.99.9-sdk\renpy\script.py", line 419, in finish_load
bad_node.filename, bad_node.linenumber))
ScriptError: Name (u'C:\\Users\\Ales\\renpy games\\Dressup/game/options.rpy', 1343828317, 0) is defined twice, at images/options.rpyc:10 and game/options.rpy:10.

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187

User avatar
emilkun
Newbie
Posts: 16
Joined: Tue Apr 28, 2015 6:11 am
Location: England
Contact:

Re: [tutorial] Dress up game

#57 Post by emilkun »

Thank you very much for this whole thread, it has been very useful, thanks a looot!
Last edited by emilkun on Wed Sep 06, 2017 3:46 pm, edited 1 time in total.

ladyluna2004
Newbie
Posts: 14
Joined: Sun Sep 03, 2017 6:40 am
Contact:

Re: [tutorial] Dress up game

#58 Post by ladyluna2004 »

Cool, i could use for a character creation screen for my visual novel. Thanks for the tutorial!

User avatar
beastcarving
Regular
Posts: 139
Joined: Mon May 13, 2019 5:03 pm
Completed: Pulse Cage https://beastcarving.itch.io/pulse-cage-the-full-series
Projects: Your Brother's Religion
Organization: BeastCarving Studio
IRC Nick: BeastCarving
Tumblr: beastcarving
Deviantart: beastcarving
Github: beastcarving
itch: beastcarving
Contact:

Re: [tutorial] Dress up game

#59 Post by beastcarving »

Added Persistent.data to the dress up doll, so you can show her on your menus as well.

Code: Select all

 $ avatar = Character(Persistent, 'Me', color="#700a1b", show_two_window=True,show_side_image=DynamicDisplayable(draw_girl_side))
Haven't tested it yet, but it should go something like this. Correct me if it's done wrong.
Image Pulse Cage (full game)Image Your Brother's Religion (Demo)
PLAY HERE: https://beastcarving.itch.io/
Love my work: https://www.patreon.com/beastcarving

Post Reply

Who is online

Users browsing this forum: No registered users