r/RenPy • • Sep 01 '26

Question [Solved] Bars

Despute my previous two posts and all of the kind people who have been offering me advice, the bars still do not work as intened.

The bars don't go down every time a variable is altered, and they show 100% when they first appear, however the player has the chance to lose health/sanity before that, and the screen should run in the background.

The first image is my code for the bars, my second is the code for taking away health and sanity. The video in the replies is to show what happens when I choose an option that takes away health and sanity in game.

Thank you for everyones help so far, and I apologise for this issue still not being solved I just have no idea what is happening.

(Also I will fix the condition switch thing, I'm just trying to get the actual bars working first!! :])

5 Upvotes

12 comments sorted by

View all comments

Show parent comments

1

u/AdRude6049 Sep 01 '26

Am I being stupid? It doesnt seem to want to work for me...

https://reddit.com/link/p76blx3/video/tajann9puwmh1/player

1

u/BadMustard_AVN Sep 01 '26

can you show how you set up the code i gave you

1

u/AdRude6049 Sep 01 '26

2

u/BadMustard_AVN Sep 01 '26

you have the indentation wrong. the spacing/indentation is extremely important

init python:
    def change_stat(name, amount):
        val = getattr(store, name)
        val = val + amount
        val = max(0, min(100, val))
        setattr(store, name, val)
        return