Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Hiya. I got combat working in my game, where attacks scale off other variables like strength and weapons. However, I currently need help with the health bar. While I can get the enemy to attack the player, the health bar does not update from variables, such as constitution, leaving an empty part where the increase should occur. Here is my code:
DewyNebula wrote: ↑Tue May 14, 2024 4:24 pm
Hiya. I got combat working in my game, where attacks scale off other variables like strength and weapons. However, I currently need help with the health bar. While I can get the enemy to attack the player, the health bar does not update from variables, such as constitution, leaving an empty part where the increase should occur. Here is my code:
I can't say what's wrong as I don't see the part of code where you show the screen and change the value. If the code is correct, then maybe try to update the screen using
DewyNebula wrote: ↑Tue May 14, 2024 4:24 pm
Hiya. I got combat working in my game, where attacks scale off other variables like strength and weapons. However, I currently need help with the health bar. While I can get the enemy to attack the player, the health bar does not update from variables, such as constitution, leaving an empty part where the increase should occur. Here is my code:
I can't say what's wrong as I don't see the part of code where you show the screen and change the value. If the code is correct, then maybe try to update the screen using
When I test this code it works alright. What is the problem again?
PS. If you increase constitution, the bar maximum increases, not the current health. The bar's height in pixels is fixed, so it looks like the empty part of the bar grows. E.g. health was 20, the bar range was 100. You add 50 to constitution, and the bar range becomes 150. The health is still 20, so before it looked like 1/5th of the bar filled (20/100), now it looks like 20/150 of the bar is filled.
If the problem is solved, please edit the original post and add [SOLVED] to the title.
When I test this code it works alright. What is the problem again?
PS. If you increase constitution, the bar maximum increases, not the current health. The bar's height in pixels is fixed, so it looks like the empty part of the bar grows. E.g. health was 20, the bar range was 100. You add 50 to constitution, and the bar range becomes 150. The health is still 20, so before it looked like 1/5th of the bar filled (20/100), now it looks like 20/150 of the bar is filled.
Oh, that makes sense. When I set the current health to equal the health function, I thought it would remain full if the health function increased. That was my mistake. Thank you for the help!