Ren'Py restoring health after battle.

Malachite1789

Member
Dec 25, 2019
177
260
Hi there , it's me again.
So i'm old and tired (It's 1am) and i have a small problem that tired brain can't grasp. Hopefully one of you kind souls will let me know the answer so i can finish up the part i'm working on and move on in the am. :)

The problem is i have a (mostly) working combat system in place but at the end of combat i want to restore the players healh to full (including any bonuses that i may add later)
but i can't figure out how to do it. I've tried a few things but nothing seems to work.


Code:
label victory:
    init python:
             import random

    $randomnum = random.randint(5,100) # (adds a random amount of money to the player)
    hide skeleton
    nar "After defeating the skeletal monstrocity it's remains disappear but your coinpurse feels heavier."
    $gold += randomnum
   
    hide screen display_health
    return
This is the where i think it need to go. I tried to use
$playerhealth=5 (5 is the starting value for now) which would work early game, but later on the player may find armour or items that increase that base stat so it would only add 5 instead of restoring it to whatever the value would be.

(I hope that makes sense)

Thanking you in advance.
A grumpy, tired, old git.
 
Last edited:

Malachite1789

Member
Dec 25, 2019
177
260
I may have a workaround. If a put in the inventory system now i can run a check at the start of each combat to see what modifiers the player has and add them on. Then at the end of combat i just run the $playerhealth=5 to restore it to its default value that should work...maybe. i was holding off on the inv system untill i had more combats set up but i guess i can move it up the timescale if there isn't a better way.
 

gojira667

Member
Sep 9, 2019
325
320
The problem is i have a (mostly) working combat system in place but at the end of combat i want to restore the players healh to full (including any bonuses that i may add later)
Just have a max_hp var? You can update that depending on equipment. Set health on start of combat/victory, $ playerhealth = max_hp.