#đź”’ Stats

13 messages · Page 1 of 1 (latest)

glad wasp
#

So, I recently started learning python and I’m trying to give player stats on my code but I’m not to sure how to do it is there anything that could make you have a limit to the stats you choose? I currently have:

A character class, being able to choose your name and print that says “you have 5 stat points” aswell as three stat options (attack, defence and health) that need a number to be chosen but there needs a limit so if they choose 2, 2, 1 it makes five or if they did all 2s it would tell them they can’t do that because 5 is the limit

My code is:

print(f”STATS”)

print(f”You have 5 STAT points”)

attack = input(“Choose attack STATS”)

It’s the same for the other two stats aswell

Does this make sense?

old obsidianBOT
#

@glad wasp

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

round plaza
#

add all the stats together
if the number is above 5 then its not valid

#

or you could just do 5 inputs and each one can only add 1 stat

glad wasp
round plaza
#

make a function and call it something like add_stats
that function takes 1 argument which is the amount of stat points to add
inside the function you have a loop that runs until there are 0 stat points left
inside the loop you get the player input

#

the player could just enter the skill they would like to enhance

cyan tree
glad wasp
#

Thank you both for the help I’m gonna try these out and see how it goes :)

cloud quiver
#

You can close the post with the command: !close

glad wasp
#

!close

old obsidianBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.