Character Stats Question [SOLVED]
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
- Pink_Juicy
- Regular
- Posts: 26
- Joined: Tue Feb 09, 2021 4:09 pm
- Contact:
Character Stats Question [SOLVED]
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
Last edited by Pink_Juicy on Sun Aug 14, 2022 6:59 pm, edited 1 time in total.
-
- Regular
- Posts: 84
- Joined: Mon Mar 08, 2021 10:55 pm
- Projects: Arkan'sTower, Gemshine Lorelei!
- Location: France
- Contact:
Re: Character Stats Question
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.
You'd need a few variables and a screen.
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]"
- Pink_Juicy
- Regular
- Posts: 26
- Joined: Tue Feb 09, 2021 4:09 pm
- Contact:
Re: Character Stats Question
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]"
-
- Regular
- Posts: 84
- Joined: Mon Mar 08, 2021 10:55 pm
- Projects: Arkan'sTower, Gemshine Lorelei!
- Location: France
- Contact:
Re: Character Stats Question
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
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]