Character Stats Question [SOLVED]
Posted: Sun Aug 14, 2022 5:55 pm
Is it possible to be able to code something like the attachment below? Sort of like those games where in the beginning you can customize the character's stats
Supporting creators of visual novels and story-based games since 2003.
https://lemmasoft.renai.us/forums/
Code: Select all
default stat_kindness = 0
default stat_strength = 0
default stat_magic = 0
default available_points = 5
screen Stats():
vbox align(.5,.5):
# You can repeat the below for each stat
hbox:
text "Kindness"
null width 30
textbutton "-":
action SetVariable("stat_kindness", stat_kindness-1), SetVariable("available_points", available_points+1)
if stat_kindness <= 0:
sensitive False # Only if you don't want the stat to be below 0
text str(stat_kindness)
textbutton "+":
action SetVariable("stat_kindness", stat_kindness+1), SetVariable("available_points", available_points-1)
if available_points <= 0:
sensitive False
text "Available points: [available_points]"
nice!!! thank you!! also, how do you set max points for certain stats?laure44 wrote: ↑Sun Aug 14, 2022 6:27 pm It can be quite simple to do.
You'd need a few variables and a screen.
That's just a basic code, I'd also recommend checking the documentation to customize the appearance of your screens.Code: Select all
default stat_kindness = 0 default stat_strength = 0 default stat_magic = 0 default available_points = 5 screen Stats(): vbox align(.5,.5): # You can repeat the below for each stat hbox: text "Kindness" null width 30 textbutton "-": action SetVariable("stat_kindness", stat_kindness-1), SetVariable("available_points", available_points+1) if stat_kindness <= 0: sensitive False # Only if you don't want the stat to be below 0 text str(stat_kindness) textbutton "+": action SetVariable("stat_kindness", stat_kindness+1), SetVariable("available_points", available_points-1) if available_points <= 0: sensitive False text "Available points: [available_points]"
Pretty much the same way you set the minimum amount of points, like so:Pink_Juicy wrote: ↑Sun Aug 14, 2022 6:58 pm nice!!! thank you!! also, how do you set max points for certain stats?
Code: Select all
textbutton "+":
action SetVariable("stat_kindness", stat_kindness+1), SetVariable("available_points", available_points-1)
if available_points <= 0 or stat_kindness == 10: # change 10 to whatever you want, you could also use a variable to set the maximum if you wanted to
sensitive False