Messy character customization tutorial

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.
Post Reply
Message
Author
User avatar
Rinmaru
Regular
Posts: 59
Joined: Sun Apr 27, 2014 3:45 am
Completed: Cardinal Cross
Projects: Cardinal Cross
Tumblr: impqueengames
Deviantart: rinmaru
Contact:

Messy character customization tutorial

#1 Post by Rinmaru »

A very messy character customization tutorial I used in my game.
Many people were wondering how to do it, so I made a tutorial of my way.
It's very messy and there is probably a better way to do it but I hope it will at least give you an idea.
You can download it here.
tutorial preview
tutorial preview

User avatar
Ryuushiro
Regular
Posts: 64
Joined: Fri Jun 29, 2012 8:24 pm
Completed: Artist for "Maid With Perfection", Artist for "Love and Romance: a study of intimacy", art for "Sleepier & Sleepier", Backgrounds for "Panzer Hearts", Sketch backgrounds for "Caramel Mokaccino DEMO
Projects: "Hunting Fable"
Tumblr: wafflemeido
Deviantart: WaffleMeido
Skype: wafflemeido
Location: Brazil
Contact:

Re: Messy character customization tutorial

#2 Post by Ryuushiro »

This is so useful! It's so nice of you to share it ;7;

Thank you, Rin~
________________

VISIT MY WEBSITE FOR COMMISSIONS: { HERE }
DeviantartPatreon
________________

Image

User avatar
amaturemanga
Regular
Posts: 97
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

Re: Messy character customization tutorial

#3 Post by amaturemanga »

i followed your tutorial and im getting errors and its not working for me here are my errors along with my code:

error
File "game/script.rpy", line 26: expected statement.
has vbox

File "game/script.rpy", line 28: expected statement.
hbox:

File "game/script.rpy", line 39: expected statement.
add character_img :

Code: Select all

# You can place the script of your game in this file.
init:
    $ char = "base"
    $ hair1 = "hair1"
    $ hair2 = "hair2"
    $ hair3 = "hair3"
    $ hair4 = "hair4"
    $ hair5 = "hair5"
    $ hair6 = "hair6"
init python:
        def draw_character(st, at) :
            return LiveComposite(
                (670, 670),
                (0, 0), "character/"+ char +"/hair1/%s.png"%hair1
                (0, 0), "character/"+ char +"/hair2/%s.png"%hair2
                (0, 0), "character/"+ char +"/hair3/%s.png"%hair3
                (0, 0), "character/"+ char +"/hair4/%s.png"%hair4
                (0, 0), "character/"+ char +"/hair5/%s.png"%hair5
                (0, 0), "character/"+ char +"/hair6/%s.png"%hair6
                
                ),.1
            
init:
    image character = DynamicDisplayable(draw_character)
    
    has vbox
    
    hbox:
        vbox:
                $ ui.text("Hair styles", size= 23,color="#496682")
                textbutton _("Hair 1") action [ SetVariable( "hair1")]
                textbutton _("Hair 2") action [ SetVariable( "hair2")]
                textbutton _("Hair 3") action [ SetVariable( "hair3")]
                textbutton _("Hair 4") action [ SetVariable( "hair4")]
                textbutton _("Hair 5") action [ SetVariable( "hair5")]
                textbutton _("Hair 6") action [ SetVariable( "hair6")]
              
       
    add character_img:
        pos (-60,81)
# Declare images below this line, using the image statement.
image mainmenu = "hypnotic_student.png"
image ctc_animation = Animation("ctcarrow01.png", 0.2, "ctcarrow02.png", 0.2, xalign=0.9, yalign=0.9)

# Declare characters used by this game.
define story = Character(None, kind = nvl, ctc = None)

define player = Character("[playername]")

# The game starts here.
label splashscreen:
    scene black 
    $ renpy.pause(1)
    
    show text "The following story is a work of fiction and contain fantasy situations and does not reflect hypnosis in real life" with dissolve
    $ renpy.pause(2)
    
    hide text with dissolve
    $renpy.pause(1)
    
    $ renpy.pause(1)
    
    show text "AmatureManga Productions Presents\na story by: AmatureManga   and   Art by: SilverKazeNinja" with dissolve ## fix
    $ renpy.pause(2)
    play music "Metaphysik.mp3"
    hide text with dissolve
    $renpy.pause(2)
    return ## fix
    
label start:
    $ story = Character(None, ctc="ctc_animation", ctc_position="fixed", kind=nvl)
    stop music
    with dissolve
    
    window show fade
    $ playername = renpy.input("Please enter your character's name below.")
    $ playername = playername.strip()
    window hide fade  
    
window show fade 
story "I am walking down a dark corridor. It is a corridor i am very familiar with."
story "As this is a dream i have almost every night."
story "I can feel the darkness telling every fiber in my body to turn back,"
story "but i know... i know i have to press forward as i reach the familiar corner..."
nvl clear 
window hide fade

window show fade
story "I turn the corner and find myself in a familiar dark abandoned room"
nvl clear
window hide fade

 
return
    

User avatar
Rinmaru
Regular
Posts: 59
Joined: Sun Apr 27, 2014 3:45 am
Completed: Cardinal Cross
Projects: Cardinal Cross
Tumblr: impqueengames
Deviantart: rinmaru
Contact:

Re: Messy character customization tutorial

#4 Post by Rinmaru »

Delete this


has vbox

hbox:
vbox:
$ ui.text("Hair styles", size= 23,color="#496682")
textbutton _("Hair 1") action [ SetVariable( "hair1")]
textbutton _("Hair 2") action [ SetVariable( "hair2")]
textbutton _("Hair 3") action [ SetVariable( "hair3")]
textbutton _("Hair 4") action [ SetVariable( "hair4")]
textbutton _("Hair 5") action [ SetVariable( "hair5")]
textbutton _("Hair 6") action [ SetVariable( "hair6")]


add character_img:
pos (-60,81)
You added screen elements in your init block. :lol:
They need to be in a screen.

User avatar
amaturemanga
Regular
Posts: 97
Joined: Sun Mar 08, 2015 6:55 pm
Deviantart: amaturemanga
Skype: amature.manga
Contact:

Re: Messy character customization tutorial

#5 Post by amaturemanga »

Rinmaru wrote:Delete this


has vbox

hbox:
vbox:
$ ui.text("Hair styles", size= 23,color="#496682")
textbutton _("Hair 1") action [ SetVariable( "hair1")]
textbutton _("Hair 2") action [ SetVariable( "hair2")]
textbutton _("Hair 3") action [ SetVariable( "hair3")]
textbutton _("Hair 4") action [ SetVariable( "hair4")]
textbutton _("Hair 5") action [ SetVariable( "hair5")]
textbutton _("Hair 6") action [ SetVariable( "hair6")]


add character_img:
pos (-60,81)
You added screen elements in your init block. :lol:
They need to be in a screen.
well before you responded i actually deleted the entire thing and started it again from scratch its working now but when i click the buttons nothing happens here are my codes:

character_script.rpy

Code: Select all

init python:

    def draw_character(st, at): 
        return LiveComposite(
            (670, 670), 
            (0, 0), "character/"+ body +"/base.png/"+ hairstyle1 +"hair1"%hairstyle1 ,
            (0, 0), "character/"+ body +"/base.png/"+ hairstyle2 +"hair2"%hairstyle2 ,
            (0, 0), "character/"+ body +"/base.png/"+ hairstyle3 +"hair3"%hairstyle3 ,
            (0, 0), "character/"+ body +"/base.png/"+ hairstyle4 +"hair4"%hairstyle4 ,
            (0, 0), "character/"+ body +"/base.png/"+ hairstyle5 +"hair5"%hairstyle5 ,
            (0, 0), "character/"+ body +"/base.png/"+ hairstyle6 +"hair6"%hairstyle6 ,
            ),.1


init:
    image character = DynamicDisplayable(draw_character)
cc_screen.rpy

Code: Select all

define character_img = "base.png"
   

screen character_customization_screen:
    modal True
    tag menu

    # The main menu buttons.
    frame:
        xalign .7
        yalign .5

        has vbox
        
        hbox:
            vbox:
                $ ui.text("Hair styles", size= 23,color="#496682")
                textbutton _("hairstyle1") action [ SetVariable("hairstyle1","hair1")]
                textbutton _("hairstyle2") action [ SetVariable("hairstyle2", "hair2")]
                textbutton _("hairstyle3") action [ SetVariable( "hairstyle3","hair3")]
                textbutton _("hairstyle4") action [ SetVariable( "hairstyle4","hair4")]
                textbutton _("hairstyle5") action [ SetVariable( "hairstyle5","hair5")]
                textbutton _("hairstyle6") action [ SetVariable( "hairstyle6","hair6")]
                
            
                   
           
        
    add character_img:
        pos (-60,81)
settings

Code: Select all

init:
    ## CHARACTER APPEARANCE ##
    $ body = "base"
    $ hairstyle1 = "hair1"
    $ hairstyle2 = "hair2"
    $ hairstyle3 = "hair3"
    $ hairstyle4 = "hair4"
    $ hairstyle5 = "hair5"
    $ hairstyle6 = "hair6"
script

Code: Select all

# You can place the script of your game in this file.
init python:

    def draw_character(st, at): 
        return LiveComposite(
            (670, 670), 
            (0, 0), "base.png/"+ body +"/base.png/"+ hairstyle1 +"hair1"%hairstyle1 ,
            (0, 0), "base.png/"+ body +"/base.png/"+ hairstyle2 +"hair2"%hairstyle2 ,
            (0, 0), "base.png/"+ body +"/base.png/"+ hairstyle3 +"hair3"%hairstyle3 ,
            (0, 0), "base.png/"+ body +"/base.png/"+ hairstyle4 +"hair4"%hairstyle4 ,
            (0, 0), "base.png/"+ body +"/base.png/"+ hairstyle5 +"hair5"%hairstyle5 ,
            (0, 0), "base.png/"+ body +"/base.png/"+ hairstyle6 +"hair6"%hairstyle6 ,
            ),.1


init:
    image base = DynamicDisplayable(draw_character)
# Declare images below this line, using the image statement.
image mainmenu = "hypnotic_student.png"
image ctc_animation = Animation("ctcarrow01.png", 0.2, "ctcarrow02.png", 0.2, xalign=0.9, yalign=0.9)

# Declare characters used by this game.
define story = Character(None, kind = nvl, ctc = None)

define player = Character("[playername]")

# The game starts here.
label splashscreen:
    scene black 
    $ renpy.pause(1)
    
    show text "The following story is a work of fiction and contain fantasy situations and does not reflect hypnosis in real life" with dissolve
    $ renpy.pause(2)
    
    hide text with dissolve
    $renpy.pause(1)
    
    $ renpy.pause(1)
    
    show text "AmatureManga Productions Presents\na story by: AmatureManga   and   Art by: SilverKazeNinja" with dissolve ## fix
    $ renpy.pause(2)
    play music "Metaphysik.mp3"
    hide text with dissolve
    $renpy.pause(2)
    return ## fix
    
label start:
    show screen character_customization_screen
    $renpy.pause()
    
    $ story = Character(None, ctc="ctc_animation", ctc_position="fixed", kind=nvl)
    stop music
    with dissolve
    
    window show fade
    $ playername = renpy.input("Please enter your character's name below.")
    $ playername = playername.strip()
    window hide fade  
    
window show fade 
story "I am walking down a dark corridor. It is a corridor i am very familiar with."
story "As this is a dream i have almost every night."
story "I can feel the darkness telling every fiber in my body to turn back,"
story "but i know... i know i have to press forward as i reach the familiar corner..."
nvl clear 
window hide fade

window show fade
story "I turn the corner and find myself in a familiar dark abandoned room"
nvl clear
window hide fade

 
return
    

User avatar
stwkun
Regular
Posts: 82
Joined: Wed Jan 02, 2013 7:57 pm
Organization: Stw Projects
Contact:

Re: Messy character customization tutorial

#6 Post by stwkun »

Someday I will use this example. Thanks for sharing :D

LaziRice
Newbie
Posts: 16
Joined: Thu Feb 19, 2015 10:51 pm
Tumblr: Dango-Pop
Contact:

Re: Messy character customization tutorial

#7 Post by LaziRice »

Oh wow thank you so much for posting this! I am definitely going to use this in the future ^^

User avatar
Nebou
Newbie
Posts: 1
Joined: Thu Aug 31, 2017 12:54 am
Tumblr: neboou
Deviantart: theturkster
Contact:

Re: Messy character customization tutorial

#8 Post by Nebou »

amaturemanga wrote: Thu Apr 16, 2015 10:57 am init python:

def draw_character(st, at):
return LiveComposite(
(670, 670),
(0, 0), "character/"+ body +"/base.png/"+ hairstyle1 +"hair1"%hairstyle1 ,
(0, 0), "character/"+ body +"/base.png/"+ hairstyle2 +"hair2"%hairstyle2 ,
(0, 0), "character/"+ body +"/base.png/"+ hairstyle3 +"hair3"%hairstyle3 ,
(0, 0), "character/"+ body +"/base.png/"+ hairstyle4 +"hair4"%hairstyle4 ,
(0, 0), "character/"+ body +"/base.png/"+ hairstyle5 +"hair5"%hairstyle5 ,
(0, 0), "character/"+ body +"/base.png/"+ hairstyle6 +"hair6"%hairstyle6 ,
),.1
im pretty sure you only need 1 string for this sort of composite since your only doing hair:
(0, 0), "character/"+ body +"/base.png/"+ hairstyle +"%s.png"%hairstyle ,
the way you had it set up made the default state of the character locked(you might need to alter that depending on how your files are set up but), aside from that it looks fine

also i realize this thread's been dead since 2015 but i figured better a late solution than no solution at all lol

Post Reply

Who is online

Users browsing this forum: No registered users