• Search is back up, but the index is being rebuilt, there may still be some minor problems until this is complete.

Ren'Py Character creation menu (Stats)

Avalonica

Newbie
Oct 11, 2017
40
20
Hello all!

I would love to implement a Character Creation Stats menu in my VN. Sadly I am too bad at coding to make something useful out of this:
You don't have permission to view the spoiler content. Log in or register now.

Here is what people said about the above code in DISCORD
You don't have permission to view the spoiler content. Log in or register now.

Is it possible from the code to make a Character Creation Stats Menu that as an example works like this:

Player starts with "10" free points to spend.

Points left: 10
Strength: 10 [-] [+]
Dexterity: 10 [-][+]

Points left: 9
Strength: 11 [-] [+]
<--- player press [+] one time and 1 point is taken from "points left" and goes to Strength
Dexterity: 10 [-][+]

Points left: 7
Strength: 11 [-] [+]
Dexterity: 12 [-][+]
<--- player press [+] two times and 2 points is taken from "points left" and goes to Dexterity

While the player start with 10 free points it's important that she/he can't use "more" than that in the Character Creation. And it's also important that not any points can be "stolen" from the ones that exist in Strength or Dexterity either by pressing the [-] at start.

A system like this would for sure benefit my VN's if it can be made. Oh, and if anyone decide to "fix" the above code, please test-run it in a clean Ren'py project and after a successful run paste it in here. Can't risk it won't run can we
:lol:


Hoping for the best.
A.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,355
15,268
Well, by itself the code isn't really bad. It have just one error and a missing thing.

Python:
screen modify_stats():
    vbox:
        # The missing thing is the display of the points.
        text "Point(s) to distribute [total_points]"
        hbox: # for strength
            # The error was here.
            textbutton "+" action Function(add_stat, strength_points)
            # Missing.
            text "Strength [strength_points]"
            # Error.
            textbutton "-" action Function(decrease_stat, strength_points)
        hbox: #dexterity
            # Error.
            textbutton "+" action Function(add_stat, dexterity_points)
            # Missing.
            text "Dexterity [dexterity_points]"
            # Error.
            textbutton "-" action Function(decrease_stat, dexterity_points)
When you use the screen action, you need to pass the function itself, not it's result like you did. And the parameters for the code are passed as secondary parameters to Function.
  • myVar = add_stat : myVar will contain the code ;
  • myVar = add_stat() : myVar will contain the value returned by the code.
 
  • Like
Reactions: dawnstar