I'm very new to Ren'py and coding in general and I'd like to implement a basic stats system into my game. I would like the player to be able to create his own character and to set the stats with a menu.
I would like a menu with a name input, a minus and plus buttons, the stat's name and value, the remaining creation points and a continue button that only shows when the creation points are all used.
Something like this :
However, I have no idea how to get the buttons - and + to work in the following manner :
Button "+" adds 1 to a stat and removes 1 to the creationpoints value, it has a rule that disable it to prevent the stat value to go further 10 and below 0 for the creationpoints.
Button "-" removes 1 to a stat and adds one to the creationpoints value. + A rule that disable it to prevent the stat value to go below 1.
When it comes to events that add or remove stat points I made the following functions :
Code: Select all
init python:
def plus_stat(x,stat):
if stat >= 10:
stat = 10
else:
stat += x
if stat >= 10:
stat = 10
return stat
def minus_stat(x,stat):
if stat <= 1:
return stat
else:
stat -= x
if stat <= 1:
stat = 1
return stat
strengh = 1
label start :
$ strength = plus_stat(2,strength)
"Strength : [strength]"
output :
"Strength : 3"
$ strength = plus_stat(25,strength)
"Strength : [strength]"
output :
"Strength : 10"
Therefore I need your help to learn how to build a working clean menu that allows the player to set its stats just like a character creation menu. Tutorials, code samples, old threads, anything you think that might help me would be much appreciated.
Thank you for you help.