Really Simple Character Creation Stats

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
Steamgirl
Veteran
Posts: 321
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Really Simple Character Creation Stats

#1 Post by Steamgirl » Mon Feb 03, 2014 5:22 pm

It's not pretty, but it works! Hope it serves as a good starting point. :)

Copy it into your screens.rpy file or where ever.

Image

Code: Select all

##############################################################################
# Character Creation Screen - by Steamgirl
#
# A screen lets you distribute skill points.
# To use this screen initialise the various points
# Then use the following in your script:
# call screen character_creation
##############################################################################
# Example initialisation of points below. Move it where you want it.
init:
    #The number of maximum creation points
    $ init_creation_points = 10
    #The current number of creation points
    $ creation_points = init_creation_points

    #Skill 1 (in the example case, it's Charisma)
    $ skill1_max = 10
    $ skill1_points = 0

    #Skill 2 (in the example case, it's Strength)
    $ skill2_max = 10
    $ skill2_points = 0

screen character_creation:
    
    frame:
        has vbox
        hbox:
            text "Points available: [creation_points]"
        hbox:
            if creation_points == 0:
                textbutton ("Charisma") xminimum 200 action None
            else:
                textbutton ("Charisma") xminimum 200 action [SetVariable("skill1_points", skill1_points + 1), SetVariable("creation_points", creation_points - 1)]
            bar range skill1_max value skill1_points xmaximum 200
        hbox:
            if creation_points == 0:
                textbutton ("Strength") xminimum 200 action None
            else:
                textbutton ("Strength") xminimum 200 action [SetVariable("skill2_points", skill2_points + 1), SetVariable("creation_points", creation_points - 1)]
            bar range skill2_max value skill2_points xmaximum 200
        hbox:
            textbutton ("Start Over") action [SetVariable("skill1_points", 0), SetVariable("skill2_points", 0), SetVariable("creation_points", init_creation_points)]
            if creation_points == 0:
                textbutton ("Finished") action Return()
            else:
                textbutton ("Finished") action None

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

Re: Really Simple Character Creation Stats

#2 Post by Ishigreensa » Tue Jul 15, 2014 6:26 pm

Is there a way to make the label font larger? When I design extra big screens: I am using a 2400 x 1200 for a game console widget, and the labels are too small to read in the bar readouts. I would like to be able to make the bar labels bigger and maybe the bars bigger, too.

User avatar
Steamgirl
Veteran
Posts: 321
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: Really Simple Character Creation Stats

#3 Post by Steamgirl » Fri Jul 25, 2014 6:05 pm

I'm not that good with styles etc but here's something to let you set the text size?

Code: Select all

##############################################################################
# Character Creation Screen - by Steamgirl
#
# A screen lets you distribute skill points.
# To use this screen initialise the various points
# Then use the following in your script:
# call screen character_creation
##############################################################################
# Example initialisation of points below. Move it where you want it.
init:
    #The number of maximum creation points
    $ init_creation_points = 10
    #The current number of creation points
    $ creation_points = init_creation_points

    #Skill 1 (in the example case, it's Charisma)
    $ skill1_max = 10
    $ skill1_points = 0

    #Skill 2 (in the example case, it's Strength)
    $ skill2_max = 10
    $ skill2_points = 0

    #Creating a style which sets the text size
    $ style.create('creation_points_style', 'default')
    $ style.creation_points_style_text.size = 30 #change this value for bigger/smaller text
    $ style.creation_points_style_button_text.size = 30 #change this value for bigger/smaller text on the buttom
    
screen character_creation:
    
    frame:
        style_group "creation_points_style"
        has vbox
        hbox:
            text "Points available: [creation_points]"
        hbox:
            if creation_points == 0:
                textbutton ("Charisma") xminimum 200 action None
            else:
                textbutton ("Charisma") xminimum 200 action [SetVariable("skill1_points", skill1_points + 1), SetVariable("creation_points", creation_points - 1)]
            bar range skill1_max value skill1_points xmaximum 200 #ymaximum 36
        hbox:
            if creation_points == 0:
                textbutton ("Strength") xminimum 200 action None
            else:
                textbutton ("Strength") xminimum 200 action [SetVariable("skill2_points", skill2_points + 1), SetVariable("creation_points", creation_points - 1)]
            bar range skill2_max value skill2_points xmaximum 200 #ymaximum 36
        hbox:
            textbutton ("Start Over") action [SetVariable("skill1_points", 0), SetVariable("skill2_points", 0), SetVariable("creation_points", init_creation_points)]
            if creation_points == 0:
                textbutton ("Finished") action Return()
            else:
                textbutton ("Finished") action None
Unfortunately I couldn't find a good way to make bars wider - using ymaximum makes them wider but in a tiled way. XD
If you change xmaximum to a higher number, the bars will be wider.

Kairuza
Newbie
Posts: 1
Joined: Wed Oct 15, 2014 1:52 am
Soundcloud: Link in a Barrel
Contact:

Re: Really Simple Character Creation Stats

#4 Post by Kairuza » Wed Oct 15, 2014 1:56 am

Hey, sorry to be a bother, but I'm trying to learn how to use the Ren'py engine and I want to use this script however I'm not sure how to call the stats from the script if it's in the Screen.rpy file. Can you just call them from the Screen.rpy file? Thanks

User avatar
Steamgirl
Veteran
Posts: 321
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: Really Simple Character Creation Stats

#5 Post by Steamgirl » Sat Apr 25, 2015 11:02 am

Sorry for the reply 6 months later, but you use 'call screen character_creation' to pop the screen up inside your script.rpy. ^_^

##############################################################################
# Character Creation Screen - by Steamgirl
#
# A screen lets you distribute skill points.
# To use this screen initialise the various points

# Then use the following in your script:
# call screen character_creation

DanielCross
Newbie
Posts: 24
Joined: Sun Apr 26, 2015 9:29 pm
Contact:

Re: Really Simple Character Creation Stats

#6 Post by DanielCross » Fri May 22, 2015 4:13 pm

Hi! I've got a problem I'm trying to figure out and I was wondering if you have any pointers for me. I'm trying to add the numerical values of the stats after the bars (which go up or down as the bar goes up or down), but I can't seem to figure out how to do it. Do you have any suggestions?

User avatar
Steamgirl
Veteran
Posts: 321
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: Really Simple Character Creation Stats

#7 Post by Steamgirl » Fri May 22, 2015 5:26 pm

It's probably something like this:

Code: Select all

        hbox:
            if creation_points == 0:
                textbutton ("Charisma") xminimum 200 action None
            else:
                textbutton ("Charisma") xminimum 200 action [SetVariable("skill1_points", skill1_points + 1), SetVariable("creation_points", creation_points - 1)]
            bar range skill1_max value skill1_points xmaximum 200 #ymaximum 36
            text skill1_points

DanielCross
Newbie
Posts: 24
Joined: Sun Apr 26, 2015 9:29 pm
Contact:

Re: Really Simple Character Creation Stats

#8 Post by DanielCross » Fri May 22, 2015 5:57 pm

O.O

That was embarrassingly easy. Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users